Return the proportion of a brand's followers who also follower an
    exemplar. We merge all exemplar followers into one big pseudo-account.
186744
def proportion_merge(brands, exemplars):
    
    scores = {}
    exemplar_followers = set()
    for followers in exemplars.values():
        exemplar_followers |= followers

    for brand, followers in brands:
        scores[brand] = _proportion(followers, exemplar_followers)
    return scores
288961
def merge_from(self, other):
        """"""
        if other.national_number_pattern is not None:
            self.national_number_pattern = other.national_number_pattern
        if other.example_number is not None:
            self.example_number = other.example_number
640203
def follower_num(self):
        
        follower_num_block = self.soup.find('div', class_='zg-gray-normal')
        # 无人关注时 找不到对应block，直接返回0 （感谢知乎用户 段晓晨 提出此问题）
        if follower_num_block is None or follower_num_block.strong is None:
            return 0
        return int(follower_num_block.strong.text)
12972
def perp_product(self, other):
        

        return self.x * other.y - self.y * other.x
161228
def get_followers(self):
        
        return github.PaginatedList.PaginatedList(
            NamedUser,
            self._requester,
            self.url + "/followers",
            None
        )
1314252
function getFollowers(T, user_id, max_followers, finish) {
  return getFollowersIt(T, user_id, [], -1, max_followers, finish);
}
619822
def merge(self, other):
        
        Stats.merge(self, other)
        self.changes += other.changes
722401
def compute_rarity_scores(exemplars):
    
    scores = defaultdict(lambda: 0.)
    for followers in exemplars.values():
        score = 1. / len(followers)
        for f in followers:
            scores[f] += score
    return scores
1016786
def get_followers(self, first_user_id=None):
        
        params = {"access_token": self.token}
        if first_user_id:
            params["next_openid"] = first_user_id
        return self.get(
            "https://api.weixin.qq.com/cgi-bin/user/get", params=params
        )
896047
async function isAlreadyFollowing(follower, following) {
    //check
    let followers = await ga.golos.golos.api.getFollowersAsync(following, follower, "blog", 1);
    if(followers && followers.length == 1 && followers[0].follower == follower) {
        info(JSON.stringify(followers[0]));
        return true;
    }
    return false;
}
526212
def _get_representative_batch(merged):
    
    out = {}
    for mgroup in merged:
        mgroup = sorted(list(mgroup))
        for x in mgroup:
            out[x] = mgroup[0]
    return out
948341
def compute_rarity_scores_log(exemplars):
    
    scores = defaultdict(lambda: 0.)
    for followers in exemplars.values():
        score = 1. / math.log(len(followers))
        for f in followers:
            scores[f] += score
    return scores
644462
def fit(self, weighted, show_progress=True):
        
        self.similarity = all_pairs_knn(weighted, self.K,
                                        show_progress=show_progress,
                                        num_threads=self.num_threads).tocsr()
        self.scorer = NearestNeighboursScorer(self.similarity)
570298
def get_followers(self) -> Iterator['Profile']:
        
        if not self._context.is_logged_in:
            raise LoginRequiredException("--login required to get a profile's followers.")
        self._obtain_metadata()
        yield from (Profile(self._context, node) for node in
                    self._context.graphql_node_list("37479f2b8209594dde7facb0d904896a",
                                                    {'id': str(self.userid)},
                                                    'https://www.instagram.com/' + self.username + '/',
                                                    lambda d: d['data']['user']['edge_followed_by'],
                                                    self._rhx_gis))
347418
function followers_active( $uid,  $count = 20)
	{
		$param = array();
		$this->id_format($uid);
		$param['uid'] = $uid;
		$param['count'] = $count;
		return $this->oauth->get( 'friendships/followers/active', $param);
	}
479057
def post(self, id):
        ''''''
        model = self.model.objects.only('id').get_or_404(id=id)
        follow, created = Follow.objects.get_or_create(
            follower=current_user.id, following=model, until=None)
        count = Follow.objects.followers(model).count()
        if not current_app.config['TESTING']:
            tracking.send_signal(on_new_follow, request, current_user)
        return {'followers': count}, 201 if created else 200
810090
def _autofollow(api, action, dry_run):
    '''
    
    '''
    try:
        # get the last 5000 followers
        followers = api.followers_ids()

        # Get the last 5000 people user has followed
        friends = api.friends_ids()

    except TweepError as e:
        api.logger.error('%s: error getting followers/followers', action)
        api.logger.error("%s", e)
        return

    if action == "unfollow":
        method = api.destroy_friendship
        independent, dependent = followers, friends

    elif action == "follow":
        method = api.create_friendship
        independent, dependent = friends, followers
    else:
        raise IndexError("Unknown action: {}".format(action))

    api.logger.info('%sing: found %s friends, %s followers', action, len(friends), len(followers))

    # auto-following:
    # for all my followers
    # if i don't already follow them: create friendship

    # auto-unfollowing:
    # for all my friends
    # if they don't follow me: destroy friendship
    targets = [x for x in dependent if x not in independent]

    for uid in targets:
        try:
            api.logger.info('%sing %s', action, uid)

            if not dry_run:
                method(id=uid)

        except RateLimitError:
            api.logger.warning("reached Twitter's rate limit, sleeping for %d minutes", RATE_LIMIT_RESET_MINUTES)
            sleep(RATE_LIMIT_RESET_MINUTES * 60)
            method(id=uid)

        except TweepError as e:
            api.logger.error('error %sing on %s', action, uid)
            api.logger.error("code %s: %s", e.api_code, e)