Get current users and add in any search results.

        :returns: a list of dicts with keys
         - id
         - title
        :rtype: list
182616
def users(self):
        
        existing_users = self.existing_users()
        existing_user_ids = [x['id'] for x in existing_users]

        # Only add search results that are not already members
        sharing = getMultiAdapter((self.my_workspace(), self.request),
                                  name='sharing')
        search_results = sharing.user_search_results()
        users = existing_users + [x for x in search_results
                                  if x['id'] not in existing_user_ids]

        users.sort(key=lambda x: safe_unicode(x["title"]))
        return users
1334787
def get_statuses(self, username, offset=0, limit=10):

        

        response = self._req('/user/statuses/', {
            "username" : username,
            'offset' : offset,
            'limit' : limit
        })

        statuses = []

        for item in response['results']:
            s = Status()
            s.from_dict(item)
            statuses.append(s)

        return {
            "results" : statuses,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
1269533
def _get_user(self) -> Dict:
        

        if 'callback_query' in self._update:
            return self._update['callback_query']['from']
        elif 'inline_query' in self._update:
            return self._update['inline_query']['from']
        elif 'message' in self._update:
            return self._update['message']['from']
540726
def users(self):
        
        return sa.orm.relationship(
            "User",
            secondary="users_resources_permissions",
            passive_deletes=True,
            passive_updates=True,
        )
757924
def get_users_indexed_by_lang():
        
        result = {}
        users = TransUser.objects.filter(active=True).select_related('user')
        for user in users:
            for lang in user.languages.all():
                if lang.code not in result:
                    result[lang.code] = set()
                result[lang.code].add(user)
        return result
480099
def get_users_for_assigned_to():
    
    User = get_user_model()
    return User.objects.filter(is_active=True, is_staff=True)
757071
def get_keys(self):
        
        return github.PaginatedList.PaginatedList(
            github.UserKey.UserKey,
            self._requester,
            self.url + "/keys",
            None
        )
1199165
def users(self):
        
        if not hasattr(self, "_users"):
            us = {}
            if "users" in self.doc:
                for ur in self.doc["users"]:
                    us[ur["name"]] = u = copy.deepcopy(ur["user"])
                    BytesOrFile.maybe_set(u, "client-certificate")
                    BytesOrFile.maybe_set(u, "client-key")
            self._users = us
        return self._users
686605
def searchusers(self, pattern):
        
        return [User(self, **rawuser) for rawuser in
                self._getusers(match=pattern).get('users', [])]
273625
def by_user(self):  # pragma: no cover
        
        users = [i for i in self.__get_users()]
        user_groups = {}
        group_results = {
            tuple(value): key
            for (key, value) in self.by_group().items()
        }
        for user in users:
            user_groups[user] = []
            for user_list, group in group_results.items():
                if user in user_list:
                    user_groups[user].append(group)

        return user_groups
402614
def to_dict(self):
        
        users = dict(users=list())
        for user in self:
            users['users'].append(user.to_dict())
        return users
2649
def users(self):
        
        friends = [MyPlexUser(self, elem) for elem in self.query(MyPlexUser.key)]
        requested = [MyPlexUser(self, elem, self.REQUESTED) for elem in self.query(self.REQUESTED)]
        return friends + requested
425566
def users(self):
        
        if not self.__users:
            self.__users = Users(self.__connection)
        return self.__users
445975
def existing_users(context):
    
    members = IWorkspace(context).members
    info = []
    for userid, details in members.items():
        user = api.user.get(userid)
        if user is None:
            continue
        user = user.getUser()
        title = user.getProperty('fullname') or user.getId() or userid
        # XXX tbd, we don't know what a persons description is, yet
        description = _(u'Here we could have a nice status of this person')
        classes = description and 'has-description' or 'has-no-description'
        portal = api.portal.get()
        portrait = '%s/portal_memberdata/portraits/%s' % \
                   (portal.absolute_url(), userid)
        info.append(
            dict(
                id=userid,
                title=title,
                description=description,
                portrait=portrait,
                cls=classes,
                member=True,
                admin='Admins' in details['groups'],
            )
        )

    return info
1058263
def get(context, request, username=None):
    
    user_ids = []

    # Don't allow anonymous users to query a user other than themselves
    if api.is_anonymous():
        username = "current"

    # query all users if no username was given
    if username is None:
        user_ids = api.get_member_ids()
    elif username == "current":
        current_user = api.get_current_user()
        user_ids = [current_user.getId()]
    else:
        user_ids = [username]

    # Prepare batch
    size = req.get_batch_size()
    start = req.get_batch_start()
    batch = api.make_batch(user_ids, size, start)

    # get the user info for the user ids in the current batch
    users = map(get_user_info, batch.get_batch())

    return {
        "pagesize": batch.get_pagesize(),
        "next": batch.make_next_url(),
        "previous": batch.make_prev_url(),
        "page": batch.get_pagenumber(),
        "pages": batch.get_numpages(),
        "count": batch.get_sequence_length(),
        "items": users,
    }
1144511
def get_users(profile='pagerduty', subdomain=None, api_key=None):
    '''
    
    '''

    return _list_items(
        'users',
        'id',
        profile=profile,
        subdomain=subdomain,
        api_key=api_key,
    )
1090612
def read_since_ids(users):
    
    since_ids = {}
    for user in users:
        if config.has_option(SECTIONS['INCREMENTS'], user):
            since_ids[user] = config.getint(SECTIONS['INCREMENTS'], user) + 1
    return since_ids