Returns a queryset of User objects who are following the given actor (eg my followers).
7875
def followers_qs(self, actor, flag=''):
        
        check(actor)
        queryset = self.filter(
            content_type=ContentType.objects.get_for_model(actor),
            object_id=actor.pk
        ).select_related('user')

        if flag:
            queryset = queryset.filter(flag=flag)
        return queryset
123774
def follower_ids(self, user):
        
        user = str(user)
        user = user.lstrip('@')
        url = 'https://api.twitter.com/1.1/followers/ids.json'

        if re.match(r'^\d+$', user):
            params = {'user_id': user, 'cursor': -1}
        else:
            params = {'screen_name': user, 'cursor': -1}

        while params['cursor'] != 0:
            try:
                resp = self.get(url, params=params, allow_404=True)
            except requests.exceptions.HTTPError as e:
                if e.response.status_code == 404:
                    log.info("no users matching %s", screen_name)
                raise e
            user_ids = resp.json()
            for user_id in user_ids['ids']:
                yield str_type(user_id)
            params['cursor'] = user_ids['next_cursor']
776134
def followers(user_name, repo_name, params={})
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      normalize! params

      response = get_request("/1.0/repositories/#{user}/#{repo.downcase}/followers/", params)
      return response unless block_given?
      response.each { |el| yield el }
    end
624787
def follow(user, obj):
    
    follow, created = Follow.objects.get_or_create(user, obj)
    return follow
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,
    }
1076507
def get_friends(self, username, offset=0, limit=10):

        

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

        friends = []

        for item in response['results']:
            f = {}
            f['user'] = User()
            f['user'].from_dict(item['user'])
            f['is_watching'] = item['is_watching']
            f['lastvisit'] = item['lastvisit']
            f['watch'] = {
                "friend" : item['watch']['friend'],
                "deviations" : item['watch']['deviations'],
                "journals" : item['watch']['journals'],
                "forum_threads" : item['watch']['forum_threads'],
                "critiques" : item['watch']['critiques'],
                "scraps" : item['watch']['scraps'],
                "activity" : item['watch']['activity'],
                "collections" : item['watch']['collections']
            }

            friends.append(f)

        return {
            "results" : friends,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
1019005
private static Map<String, String> getActors(GitRequest pr) {
        Map<String, String> actors = new HashMap<>();
        if (!StringUtils.isEmpty(pr.getMergeAuthorLDAPDN())) {
            actors.put(pr.getMergeAuthor(), pr.getMergeAuthorLDAPDN());
        }
        Optional.ofNullable(pr.getCommits()).orElse(Collections.emptyList()).stream().filter(c -> !StringUtils.isEmpty(c.getScmAuthorLDAPDN())).forEach(c -> actors.put(c.getScmAuthor(), c.getScmAuthorLDAPDN()));
        Optional.ofNullable(pr.getComments()).orElse(Collections.emptyList()).stream().filter(c -> !StringUtils.isEmpty(c.getUserLDAPDN())).forEach(c -> actors.put(c.getUser(), c.getUserLDAPDN()));
        Optional.ofNullable(pr.getReviews()).orElse(Collections.emptyList()).stream().filter(r -> !StringUtils.isEmpty(r.getAuthorLDAPDN())).forEach(r -> actors.put(r.getAuthor(), r.getAuthorLDAPDN()));
        return actors;
    }
1302767
def get_followers(id_=None, screen_name=None, limit=1e10):
    
    # FIXME: DRY from _tweets_for_user
    if not (id_ or screen_name):
        raise Exception("either id_ or screen_name must not be None")
    if id_:
        key = 'user_id'
        val = id_
    else:
        key = 'screen_name'
        val = screen_name
    cursor = -1
    followers = []
    while len(followers) < limit:
        try:
            response = twapi.request('followers/ids', {key: val, 'count': 5000,
                                                       'cursor': cursor, 'stringify_ids': True})
            if response.status_code in [88, 130, 420, 429]:  # rate limit
                sys.stderr.write('Error for %s: %s\nSleeping for 5 minutes...\n' % (val, response.text))
                time.sleep(300)
            elif response.status_code != 200:
                sys.stderr.write('Skipping bad user: %s\n' % response.text)
                return followers
            else:
                result = json.loads(response.text)
                items = [r for r in response]
                if len(items) == 0:
                    return followers
                else:
                    sys.stderr.write('fetched %d more followers for %s\n' % (len(items), val))
                    time.sleep(1)
                    followers.extend(items)
                    if len(followers) >= limit:
                        return followers[:limit]
                cursor = result['next_cursor']
        except Exception as e:
            sys.stderr.write('Error: %s\nskipping...\n' % e)
            sys.stderr.write(traceback.format_exc())
            return followers
    return followers
1113265
def users(self, request, uuid=None):
        
        project = self.get_object()
        queryset = project.get_users()
        # we need to handle filtration manually because we want to filter only project users, not projects.
        filter_backend = filters.UserConcatenatedNameOrderingBackend()
        queryset = filter_backend.filter_queryset(request, queryset, self)
        queryset = self.paginate_queryset(queryset)
        serializer = self.get_serializer(queryset, many=True)
        return self.get_paginated_response(serializer.data)
717820
def get_likes(self):
        
        from .users import User
        return self._session.fetch_items('likes.getList', User._get_user, count=100, type='post', owner_id=self.from_id, item_id=self.id)
522988
def get_watchers(self, username, offset=0, limit=10):

        

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

        watchers = []

        for item in response['results']:
            w = {}
            w['user'] = User()
            w['user'].from_dict(item['user'])
            w['is_watching'] = item['is_watching']
            w['lastvisit'] = item['lastvisit']
            w['watch'] = {
                "friend" : item['watch']['friend'],
                "deviations" : item['watch']['deviations'],
                "journals" : item['watch']['journals'],
                "forum_threads" : item['watch']['forum_threads'],
                "critiques" : item['watch']['critiques'],
                "scraps" : item['watch']['scraps'],
                "activity" : item['watch']['activity'],
                "collections" : item['watch']['collections']
            }

            watchers.append(w)

        return {
            "results" : watchers,
            "has_more" : response['has_more'],
            "next_offset" : response['next_offset']
        }
1042403
def get_followers(self):
        
        return github.PaginatedList.PaginatedList(
            github.NamedUser.NamedUser,
            self._requester,
            "/user/followers",
            None
        )
1367168
def get_following(self):
        
        return github.PaginatedList.PaginatedList(
            NamedUser,
            self._requester,
            self.url + "/following",
            None
        )
1166681
def toggle(user, obj):
    
    if Follow.objects.is_following(user, obj):
        return unfollow(user, obj)
    return follow(user, obj)
957554
def user(self, obj, with_user_activity=False, follow_flag=None, **kwargs):
        """"""
        q = Q()
        qs = self.public()

        if not obj:
            return qs.none()

        check(obj)

        if with_user_activity:
            q = q | Q(
                actor_content_type=ContentType.objects.get_for_model(obj),
                actor_object_id=obj.pk
            )

        follows = apps.get_model('actstream', 'follow').objects.filter(user=obj)
        if follow_flag:
            follows = follows.filter(flag=follow_flag)
            
        content_types = ContentType.objects.filter(
            pk__in=follows.values('content_type_id')
        )

        if not (content_types.exists() or with_user_activity):
            return qs.none()

        for content_type in content_types:
            object_ids = follows.filter(content_type=content_type)
            q = q | Q(
                actor_content_type=content_type,
                actor_object_id__in=object_ids.values('object_id')
            ) | Q(
                target_content_type=content_type,
                target_object_id__in=object_ids.filter(
                    actor_only=False).values('object_id')
            ) | Q(
                action_object_content_type=content_type,
                action_object_object_id__in=object_ids.filter(
                    actor_only=False).values('object_id')
            )

        return qs.filter(q, **kwargs)
1011998
def user(request, username):
    
    instance = get_object_or_404(
        USER_MODEL,
        **{'is_active': True, username_field: username}
    )
    return render(
        request,
        'actstream/actor.html',
        context={
            'ctype': ContentType.objects.get_for_model(USER_MODEL),
            'actor': instance, 'action_list': models.user_stream(instance)
        }
    )
878644
public function getFollowers(){

        $followers = array();
        $sections = $this->getSections();

        if($sections != null){
            foreach($sections as $section){

                $users = $section->getUsers();
                if($users != null){
                    foreach($users as $user){
                        $followers[] = $user;
                    }
                }

            }
        }

        return $followers;

    }