Iterates over all badges pages of a steam profile
            Parses all badges (using parse_badge()) to return the appId, play time ('till now) and the number of card drops left.

            @param appid_filter only look for appids listed here
197937
def parse_badges_pages(self, appid_filter=None):
        ''' 
        '''
        appid_filter = appid_filter or []
        filter_appids = True if appid_filter else False
        parsed_apps = {}
        currentPage = badgePages = 1

        retry = False
        while currentPage <= badgePages and (filter_appids == False or len(appid_filter) > 0):
            r = self.swb.get('https://steamcommunity.com/my/badges', params={'p': currentPage})
            if r.status_code == 302:
                if retry:
                    # We already tries to force a login
                    raise Exception('Unable to fetch badges')
                # Looks like we've been redirected. Force a login and retry
                print('Need to login again')
                self.swb.login()
                retry = True
                continue

            soup = BeautifulSoup(r.content, 'html.parser')
            if currentPage == 1:
                try:
                    badgePages = int(soup.find_all('a', {'class': 'pagelink'})[-1].get_text())
                except:
                    pass

            for b in soup.find_all('div', {'class': 'badge_title_stats'}):
                try:
                    app = self.parse_badge(b)
                except PageParserError:
                    # Could not correctly parse app info, continue with the next one
                    continue

                # AppId's where given as filter, check if this AppId is one of those
                if filter_appids:
                    if app.appid in appid_filter:
                        appid_filter.remove(app.appid)
                    else:
                        # This appid is NOT in the filter list.
                        # don't include it in the returned list
                        continue

                # Add app info to the list of parsed badges
                parsed_apps[app.appid] = app

                if filter_appids and len(appid_filter) == 0:
                    # AppId's where given as filter and all of them where found already
                    # so we are done.
                    break
            # Continue with next page
            currentPage += 1

        if not parsed_apps:
            #FIXME: empty badges page == no good.
            print('ERRPOR: Could not find any badges on badge page')
            from tempfile import NamedTemporaryFile
            tmpf = NamedTemporaryFile(prefix='quickDump_', suffix='.html', delete=False)
            print('Dumping r.content to: "file://%s"' % tmpf.name)
            tmpf.write(r.content)
            tmpf.close()
            rname = tmpf.name.replace('.html', '.dat')
            with open(rname, 'w') as tmpf:
                print('Dumping r to: "file://%s"' % rname)
                tmpf.write(vars(r))

        return parsed_apps
934204
public int getHistoryCount(int profileId, String clientUUID, HashMap<String, String[]> searchFilter) {
        int count = 0;
        Statement query = null;
        ResultSet results = null;

        try (Connection sqlConnection = sqlService.getConnection()) {

            String sqlQuery = "SELECT COUNT(" + Constants.GENERIC_ID + ") FROM " + Constants.DB_TABLE_HISTORY + " ";

            // see if profileId is set or not (-1)
            if (profileId != -1) {
                sqlQuery += "WHERE " + Constants.GENERIC_PROFILE_ID + "=" + profileId + " ";
            }

            if (clientUUID != null && clientUUID.compareTo("") != 0) {
                sqlQuery += "AND " + Constants.GENERIC_CLIENT_UUID + "='" + clientUUID + "' ";
            }

            sqlQuery += ";";

            logger.info("Query: {}", sqlQuery);

            query = sqlConnection.createStatement();
            results = query.executeQuery(sqlQuery);
            if (results.next()) {
                count = results.getInt(1);
            }
            query.close();
        } catch (Exception e) {

        } finally {
            try {
                if (results != null) {
                    results.close();
                }
            } catch (Exception e) {
            }
            try {
                if (query != null) {
                    query.close();
                }
            } catch (Exception e) {
            }
        }

        return count;
    }
451463
def get_actions(self, filters, since=None, before=None, limit=1000):
        
        if limit > 1000:
            raise NotImplementedError(
                "Fetching more than 1000 items is not implemented")
        resp = self.stats.session.open(
            "{0}/members/{1}/actions?{2}".format(
                self.stats.url, self.username, urllib.urlencode({
                    "key": self.key,
                    "token": self.token,
                    "filter": filters,
                    "limit": limit,
                    "since": str(since),
                    "before": str(before)})))

        actions = json.loads(resp.read())
        log.data(pretty(actions))
        # print[act for act in actions if "shortLink" not in
        # act['data']['board'].keys()]
        actions = [act for act in actions if act['data']
                   ['board']['id'] in self.board_ids]
        return actions
1100801
protected function fetchApplications($filter = array())
    {
        $repositories = $this->repositories;

        /** @var ApplicationRepository $appRepo */
        $appRepo      = $repositories->get('Applications/Application');
        $query        = array('isDraft' => null);

        foreach ($filter as $key => $value) {
            switch ($key) {
                case "before":
                    $date = new \DateTime($value);
                    $q = array('$lt' => $date);
                    if (isset($query['dateCreated.date'])) {
                        $query['dateCreated.date'] = array_merge(
                            $query['dateCreated.date'],
                            $q
                        );
                    } else {
                        $query['dateCreated.date'] = $q;
                    }
                    break;

                case "after":
                    $date = new \DateTime($value);
                    $q = array('$gt' => $date);
                    if (isset($query['dateCreated.date'])) {
                        $query['dateCreated.date'] = array_merge(
                            $query['dateCreated.date'],
                            $q
                        );
                    } else {
                        $query['dateCreated.date'] = $q;
                    }
                    break;

                case "id":
                    $query['_id'] = new \MongoId($value);
                    break;
                case "isDraft":
                    $query['isDraft'] = (bool) $value;
                    break;
                default:
                    $query[$key] = $value;
                    break;
            }
        }
        
        $applications = $appRepo->findBy($query);
        
        return $applications;
    }
849551
def games_played(self, app_ids):
        
        if not isinstance(app_ids, list):
            raise ValueError("Expected app_ids to be of type list")

        self.current_games_played = app_ids = list(map(int, app_ids))

        self.send(MsgProto(EMsg.ClientGamesPlayed),
                  {'games_played': [{'game_id': app_id} for app_id in app_ids]}
                  )
1205570
function getRankedApps (apps) {
    const findRank = (list, app) => (list.indexOf(app.appId) + 1) || undefined;

    const queries = R.uniq(apps.map(store.getCollectionQuery));
    const queryIndex = queries.map((q) => [q.collection, q.category]);
    return Promise.all(queries.map(store.list))
      .then(R.map(R.map(R.prop('appId'))))
      .then(R.zipObj(queryIndex))
      .then(function (listMap) {
        // for each app, get its collection/category list and find its rank in there
        const findList = (app) => listMap[[store.getCollection(app), store.getGenre(app)]];
        return apps.map((app) => findRank(findList(app), app));
      })
      .then(R.reject(R.isNil))
      .then(function (results) {
        if (!results.length) {
          return {count: 0, avgRank: undefined, score: 1};
        }

        const stats = {
          count: results.length,
          avgRank: R.sum(results) / results.length
        };

        const countScore = calc.zScore(apps.length, stats.count);
        const avgRankScore = calc.iScore(1, 100, stats.avgRank);
        const score = calc.aggregate([5, 1], [countScore, avgRankScore]);
        return R.assoc('score', score, stats);
      });
  }
1269102
def get_community_badge_progress(self, steamID, badgeID, format=None):
        
        parameters = {'steamid' : steamID, 'badgeid' : badgeID}
        if format is not None:
            parameters['format'] = format
        url = self.create_request_url(self.interface, 'GetCommunityBadgeProgress', 1,
            parameters)
        data = self.retrieve_request(url)
        return self.return_data(data, format=format)
499050
public static af_persistant_stat_info[] get_filtered(nitro_service service, filtervalue[] filter) throws Exception
	{
		af_persistant_stat_info obj = new af_persistant_stat_info();
		options option = new options();
		option.set_filter(filter);
		af_persistant_stat_info[] response = (af_persistant_stat_info[]) obj.getfiltered(service, option);
		return response;
	}
417744
public List<Friend> getFriends(Filter<Friend> filter) {
		final ArrayList<Friend> friends = new ArrayList<>();
		for (final RosterEntry e : connection.getRoster().getEntries()) {
			final Friend f = new Friend(this, connection, e);
			if (filter.accept(f)) {
				friends.add(f);
			}
		}
		return friends;
	}
522003
public static device_profile[] get_filtered(nitro_service service, String filter) throws Exception
	{
		device_profile obj = new device_profile();
		options option = new options();
		option.set_filter(filter);
		device_profile[] response = (device_profile[]) obj.getfiltered(service, option);
		return response;
	}
718091
def get_children(self, usage_id_filter=None):
        
        if not self.has_children:
            return []

        return [
            self.get_child(usage_id)
            for usage_id in self.children
            if usage_id_filter is None or usage_id_filter(usage_id)
        ]
749412
public static appfwprofile[] get_filtered(nitro_service service, String filter) throws Exception{
		appfwprofile obj = new appfwprofile();
		options option = new options();
		option.set_filter(filter);
		appfwprofile[] response = (appfwprofile[]) obj.getfiltered(service, option);
		return response;
	}
255036
def parse_filter(filter)
      filter.is_a?(Hash) ? URI.encode(filter.to_json) : filter
    end
102235
def _filters(self):
        
        filters = super()._filters()

        if self.ids:
            def get_todo(p_id):
                """
                Safely obtains a todo item given the user-supplied ID.
                Returns None if an invalid ID was entered.
                """
                try:
                    return self.todolist.todo(p_id)
                except InvalidTodoException:
                    return None

            todos = [get_todo(i) for i in self.ids]
            filters.append(InstanceFilter(todos))

        if not self.show_all:
            filters.append(HiddenTagFilter())

        return filters
928035
public static activity_status[] get_filtered(nitro_service service, String filter) throws Exception
	{
		activity_status obj = new activity_status();
		options option = new options();
		option.set_filter(filter);
		activity_status[] response = (activity_status[]) obj.getfiltered(service, option);
		return response;
	}
90737
public function getAll($appId = null, array $queryParams = [])
    {
        $response = $this->api->applications()->profiles()->getAll($appId, $queryParams);

        return new ProfilesResponse($response);
    }
637444
public static snmpengineid[] get_filtered(nitro_service service, String filter) throws Exception{
		snmpengineid obj = new snmpengineid();
		options option = new options();
		option.set_filter(filter);
		snmpengineid[] response = (snmpengineid[]) obj.getfiltered(service, option);
		return response;
	}