List of most recent 25 matches before start_at_match_id
338811
def get_match_history(start_at_match_id=None, player_name=None, hero_id=None,
                      skill=0, date_min=None, date_max=None, account_id=None,
                      league_id=None, matches_requested=None, game_mode=None,
                      min_players=None, tournament_games_only=None,
                      **kwargs):
    

    params = {
        "start_at_match_id": start_at_match_id,
        "player_name": player_name,
        "hero_id": hero_id,
        "skill": skill,
        "date_min": date_min,
        "date_max": date_max,
        "account_id": account_id,
        "league_id": league_id,
        "matches_requested": matches_requested,
        "game_mode": game_mode,
        "min_players": min_players,
        "tournament_games_only": tournament_games_only
    }

    return make_request("GetMatchHistory", params, **kwargs)
1049210
def previous(self, match, predicate=None, index=None):
        
        current = match.start
        while current > -1:
            previous_matches = self.ending(current)
            if previous_matches:
                return filter_index(previous_matches, predicate, index)
            current -= 1
        return filter_index(_BaseMatches._base(), predicate, index)
310827
def query_all(**kwargs):
        '''
        
        '''
        kind = kwargs.get('kind', '1')
        limit = kwargs.get('limit', 10)

        return TabPost.select().where(
            (TabPost.kind == kind) &
            (TabPost.valid == 1)
        ).order_by(
            TabPost.time_update.desc()
        ).limit(limit)
262248
private function _getMatchesIdsFromMatches()
    {
        $_matchesIdsFromSlots = $this->_getMatchesIdsFromSlots();
        $db = Db::obtain();
        // basic matches data
        $matchesQuery = 'SELECT * FROM ' . Db::realTablename('matches') . '';
        $where = '';
        $data = array();

        if (null !== $this->getLeagueId()) {
            $where .= 'leagueid = ? AND ';
            array_push($data, $this->getLeagueId());
        }

        if (null !== $this->getTeamId()) {
            $where .= '(radiant_team_id = ? OR dire_team_id = ?) AND ';
            array_push($data, $this->getTeamId());
            array_push($data, $this->getTeamId());
        }

        if (count($_matchesIdsFromSlots)) {
            $where .= 'match_id IN (' . implode(',', $_matchesIdsFromSlots) . ') AND ';
        }

        if (null !== $this->getStartAtMatchId()) {
            $where .= 'match_id > ? AND ';
            array_push($data, $this->getStartAtMatchId());
        }

        if (trim($where) !== '') {
            $matchesQuery .= ' WHERE ' . substr($where, 0, strlen($where) - 4);
        }

        $matchesQuery .= ' ORDER BY start_time DESC';

        if (null !== $this->getMatchesRequested()) {
            $matchesQuery .= ' LIMIT ?';
            array_push($data, $this->getMatchesRequested());
        }

        $matchesInfo = $db->fetchArrayPDO($matchesQuery, $data);
        // no one match found
        if (count($matchesInfo) === 0) {
            return array();
        }
        return $matchesInfo;
    }
894318
def get_recent_matches(self, card_type="micro_card"):
        

        recent_matches_url = self.api_path + "recent_matches/"
        params = {}
        params["card_type"] = card_type
        response = self.get_response(recent_matches_url, params)
        return response
442660
def prev_listing(self, limit=None):
        
        if self.before:
            return self._reddit._limit_get(self._path, eparams={'before': self.before}, limit=limit or self._limit)
        else:
            raise NoMoreError('no previous items')
919846
def list_recent_networks(self) -> List[Network]:
        """"""
        most_recent_times = (
            self.session
            .query(
                Network.name.label('network_name'),
                func.max(Network.created).label('max_created')
            )
            .group_by(Network.name)
            .subquery('most_recent_times')
        )

        and_condition = and_(
            most_recent_times.c.network_name == Network.name,
            most_recent_times.c.max_created == Network.created
        )

        most_recent_networks = self.session.query(Network).join(most_recent_times, and_condition)

        return most_recent_networks.all()
636391
function getLiveMatchServersCount($lobbyLogin, $scriptName, $titleIdString)
	{
		return $this->db->execute(
				'SELECT COUNT(*) FROM MatchServers '.
				'WHERE DATE_ADD(lastLive, INTERVAL 15 MINUTE) > NOW() '.
				'AND lobbyLogin = %s AND scriptName = %s AND titleIdString = %s',
				$this->db->quote($lobbyLogin), $this->db->quote($scriptName), $this->db->quote($titleIdString)
			)->fetchSingleValue(0);
	}
963939
def change_number_matches(self, current_match=0, total_matches=0):
        """"""
        if current_match and total_matches:
            matches_string = u"{} {} {}".format(current_match, _(u"of"),
                                               total_matches)
            self.number_matches_text.setText(matches_string)
        elif total_matches:
            matches_string = u"{} {}".format(total_matches, _(u"matches"))
            self.number_matches_text.setText(matches_string)
        else:
            self.number_matches_text.setText(_(u"no matches"))
798400
def timeline_list(self, id, max_id=None, min_id=None, since_id=None, limit=None):
        
        id = self.__unpack_id(id)
        return self.timeline('list/{0}'.format(id), max_id=max_id,
                             min_id=min_id, since_id=since_id, limit=limit)
1074449
def query_recent_most(num=8, recent=30):
        '''
        
        '''
        time_that = int(time.time()) - recent * 24 * 3600
        return TabPost.select().where(
            TabPost.time_update > time_that
        ).order_by(
            TabPost.view_count.desc()
        ).limit(num)
625513
private void pruneMatches() {
		int index = 0;
		while( index < matches.size ) {
			AssociatedTripleIndex a = matches.get(index);
			// not matched. Remove it from the list by copying that last element over it
			if( a.c == -1 ) {
				a.set(matches.get(matches.size-1));
				matches.size--;
			} else {
				index++;
			}
		}
	}
202878
def load_matches(self):
        
        if not self.exists():
            return []

        matches = []
        with open(self.location(), 'r') as f:
            for line in f.readlines():
                match_obj = json.loads(line.strip("\n"))
                if match_obj['processed']:
                    continue

                matches.append(match_obj)

        return matches
1171404
def query_recent(num=8, **kwargs):
        '''
        
        '''
        order_by_create = kwargs.get('order_by_create', False)
        kind = kwargs.get('kind', None)
        if order_by_create:
            if kind:
                recent_recs = TabPost.select().where(
                    (TabPost.kind == kind) & (TabPost.valid == 1)
                ).order_by(
                    TabPost.time_create.desc()
                ).limit(num)
            else:
                recent_recs = TabPost.select().where(
                    TabPost.valid == 1
                ).order_by(
                    TabPost.time_create.desc()
                ).limit(num)
        else:
            if kind:
                recent_recs = TabPost.select().where(
                    (TabPost.kind == kind) & (TabPost.valid == 1)
                ).order_by(
                    TabPost.time_update.desc()
                ).limit(num)
            else:
                recent_recs = TabPost.select().where(
                    TabPost.valid == 1
                ).order_by(
                    TabPost.time_update.desc()
                ).limit(num)
        return recent_recs
136540
def all(cls, start_position="", max_results=100, qb=None):
        
        return cls.where("", start_position=start_position, max_results=max_results, qb=qb)
319380
def save_matches(self, matches):
        
        if not os.path.exists(os.path.dirname(self.location())):
            os.makedirs(os.path.dirname(self.location()))

        with open(self.location(), "w+") as f:
            matches = [m for m in matches if not m['processed']]
            for m in matches:
                match_obj = json.dumps(m)
                f.write(match_obj + "\n")
1166934
def namedb_get_history_rows( cur, history_id, offset=None, count=None, reverse=False ):
    
    ret = []
    if not reverse:
        select_query = "SELECT * FROM history WHERE history_id = ? ORDER BY block_id ASC, vtxindex ASC"
    else:
        select_query = "SELECT * FROM history WHERE history_id = ? ORDER BY block_id DESC, vtxindex DESC"

    args = (history_id,)

    if count is not None:
        select_query += " LIMIT ?"
        args += (count,)

        if offset is not None:
            select_query += " OFFSET ?"
            args += (offset,)

    select_query += ";"

    history_rows = namedb_query_execute( cur, select_query, args)
    for r in history_rows:
        rd = dict(r)
        ret.append(rd)

    return ret