Returns a dictionary that includes top MMR live games

        :param partner: (int, optional)
        :return: dictionary of prize pools, see :doc:`responses </responses>`
551554
def get_top_live_games(self, partner='', **kwargs):
        
        if 'partner' not in kwargs:
            kwargs['partner'] = partner
        url = self.__build_url(urls.GET_TOP_LIVE_GAME, **kwargs)
        req = self.executor(url)
        if self.logger:
            self.logger.info('URL: {0}'.format(url))
        if not self.__check_http_err(req.status_code):
            return response.build(req, url, self.raw_mode)
609158
def PluRunOff_single_winner(self, profile):
        

        # Currently, we expect the profile to contain complete ordering over candidates. Ties are
        # allowed however.
        elecType = profile.getElecType()
        if elecType != "soc" and elecType != "toc" and elecType != "csv":
            print("ERROR: unsupported election type")
            exit()

        # Initialization
        prefcounts = profile.getPreferenceCounts()
        len_prefcounts = len(prefcounts)
        rankmaps = profile.getRankMaps()
        ranking = MechanismPlurality().getRanking(profile)

        # 1st round: find the top 2 candidates in plurality scores
        # Compute the 1st-place candidate in plurality scores
        # print(ranking)
        max_cand = ranking[0][0][0]

        # Compute the 2nd-place candidate in plurality scores
        # Automatically using tie-breaking rule--numerically increasing order
        if len(ranking[0][0]) > 1:
            second_max_cand = ranking[0][0][1]
        else:
            second_max_cand = ranking[0][1][0]

        top_2 = [max_cand, second_max_cand]
        # 2nd round: find the candidate with maximum plurality score
        dict_top2 = {max_cand: 0, second_max_cand: 0}
        for i in range(len_prefcounts):
            vote_top2 = {key: value for key, value in rankmaps[i].items() if key in top_2}
            top_position = min(vote_top2.values())
            keys = [x for x in vote_top2.keys() if vote_top2[x] == top_position]
            for key in keys:
                dict_top2[key] += prefcounts[i]

        # print(dict_top2)
        winner = max(dict_top2.items(), key=lambda x: x[1])[0]

        return winner
1180760
def get_status(self):
        
        status = ctypes.c_int32()
        result = self.library.Par_GetStatus(self.pointer, ctypes.byref(status))
        check_error(result, "partner")
        return status
601953
def getWinners(self, profile):
        

        # Initialize
        stats = self.Stats()

        wmg = profile.getWmg()
        known_winners = set()
        I = list(wmg.keys())

        G = nx.DiGraph()
        G.add_nodes_from(I)

        E = nx.DiGraph()
        E.add_nodes_from(I)
        for cand1, cand2 in itertools.permutations(wmg.keys(), 2):
            if wmg[cand1][cand2] > 0:
                E.add_edge(cand1, cand2, weight=wmg[cand1][cand2])

        # print(wmg)
        # self.output_graph(E)

        # Sample
        num_samples = 200
        for i in range(num_samples):
            self.sample(E, I, known_winners, stats)


        stats.num_sampled = len(known_winners)
        stats.sampled = sorted(known_winners.copy())

        # Start search

        # Each node contains (G, E)
        root = Node(value=(G, E))
        stackNode = []
        stackNode.append(root)

        hashtable = set()

        while stackNode:
            # Pop new node to explore
            node = stackNode.pop()
            (G, E) = node.value

            # Check hash
            hash_state = hash(str(G.edges()) + str(E.edges()))
            if hash_state in hashtable:
                stats.num_hashes += 1
                if self.debug_mode == 3:
                    print("hashed in outer hashtable")
                continue
            hashtable.add(hash_state)

            stats.num_outer_nodes += 1
            stats.num_nodes += 1

            if self.debug_mode == 3:
                print("Popped new node: ")
                print("G:", G.edges())
                print("E:", E.edges())

            # Flag for whether expanding the current tier required finding max children
            f_found_max_children = 0

            # Continue performing RP on this state as long as tie-breaking order doesn't matter
            while len(E.edges()) != 0:
                if self.stop_conditions(G, E, I, known_winners, stats) != -1:
                    # Stop condition hit
                    break

                (max_weight, max_edge) = max([(d['weight'], (u, v)) for (u, v, d) in E.edges(data=True)])
                ties = [d['weight'] for (u, v, d) in E.edges(data=True)].count(max_weight)

                if ties == 1:
                    # Tier only has one edge
                    if self.debug_mode == 3:
                        print("Only 1 edge in tier")

                    E.remove_edges_from([max_edge])
                    if nx.has_path(G, max_edge[1], max_edge[0]) is False:
                        G.add_edges_from([max_edge])

                else:
                    # This tier has multiple edges with same max weight.
                    tier = [(u, v) for (u, v, d) in E.edges(data=True) if d['weight'] == max_weight]
                    if self.debug_mode == 3:
                        print("Tier =", tier)

                    E.remove_edges_from(tier)

                    # Compute "bridge edges" which are not in any cycle
                    Gc = G.copy()
                    Gc.add_edges_from(tier)
                    scc = [list(g.edges()) for g in nx.strongly_connected_component_subgraphs(Gc, copy=True) if
                           len(g.edges()) != 0]
                    bridges = set(Gc.edges()) - set(itertools.chain(*scc))
                    G.add_edges_from(bridges)
                    tier = list(set(tier) - bridges)

                    G_tc = nx.transitive_closure(G)

                    # Remove "inconsistent edges" that cannot be added to G without causing cycle
                    reverse_G = nx.DiGraph.reverse(G_tc)
                    tier = list(set(tier) - set(reverse_G.edges()))

                    # Remove "redundant edges": if there is already path from e[0] to e[1], can immediately add e
                    redundant_edges = set()
                    for e in tier:
                        if G_tc.has_edge(e[0], e[1]):
                            redundant_edges.add(e)
                            G.add_edges_from([e])
                    stats.num_redundant_edges += len(redundant_edges)
                    tier = list(set(tier) - redundant_edges)

                    if len(tier) == 0:
                        # No need to find max children, as tier is now empty
                        continue

                    max_children = self.find_max_children_scc_decomposition(G, tier, scc, bridges, I, known_winners, stats)

                    # Determine priority ordering of maximal children
                    children = dict()
                    index = 0
                    for child in max_children:
                        # child_node = Node(value=(self.edges2string(child.edges(), I), self.edges2string(E.edges(), I)))
                        child_node = Node(value=(child, E.copy()))
                        c_in_deg = child.in_degree(I)
                        available = set([x[0] for x in c_in_deg if x[1] == 0])
                        priority = len(available - known_winners)
                        # children[child_node] = (priority, index)
                        children[child_node] = index
                        child.add_nodes_from(I)
                        index += 1
                        continue

                    children_items = sorted(children.items(), key=lambda x: x[1])
                    sorted_children = [key for key, value in children_items]
                    stackNode += sorted_children
                    f_found_max_children = 1
                    break

            # f_found_max_children is needed since, if we just added more nodes to stack, then current (G, E) is not actual valid state
            if len(E.edges()) == 0 and f_found_max_children == 0:
                # E is empty
                if self.debug_mode >= 2:
                    print("E is empty")
                self.add_winners(G, I, known_winners, stats)

        return sorted(known_winners), stats
1348008
def confsponsor(self):
        """"""
        sponsors = chained_get(self._confevent, ['confsponsors', 'confsponsor'], [])
        if len(sponsors) == 0:
            return None
        if isinstance(sponsors, list):
            return [s['$'] for s in sponsors]
        return sponsors
1240091
def get_ranked_players():
    """"""

    rankings_page = requests.get(RANKINGS_URL)
    root = etree.HTML(rankings_page.text)
    player_rows = root.xpath('//div[@id="ranked"]//tr')

    for row in player_rows[1:]:
        player_row = row.xpath('td[@class!="country"]//text()')
        yield _Player(
            name=player_row[1],
            country=row[1][0].get('title'),
            triple_crowns=player_row[3],
            monthly_win=player_row[4],
            biggest_cash=player_row[5],
            plb_score=player_row[6],
            biggest_score=player_row[7],
            average_score=player_row[8],
            previous_rank=player_row[9],
        )
59480
def dataframe(self):
        
        if self._points_for is None and self._points_against is None:
            return None
        fields_to_include = {
            'boxscore_index': self.boxscore_index,
            'date': self.date,
            'datetime': self.datetime,
            'day_of_week': self.day_of_week,
            'game': self.game,
            'location': self.location,
            'losses': self.losses,
            'opponent_abbr': self.opponent_abbr,
            'opponent_conference': self.opponent_conference,
            'opponent_name': self.opponent_name,
            'opponent_rank': self.opponent_rank,
            'points_against': self.points_against,
            'points_for': self.points_for,
            'rank': self.rank,
            'result': self.result,
            'streak': self.streak,
            'time': self.time,
            'wins': self.wins
        }
        return pd.DataFrame([fields_to_include], index=[self._boxscore])
694835
def STVsocwinners(self, profile):
        
        ordering = profile.getOrderVectors()
        prefcounts = profile.getPreferenceCounts()
        m = profile.numCands

        if min(ordering[0]) == 0:
            startstate = set(range(m))
        else:
            startstate = set(range(1, m + 1))

        ordering, startstate = self.preprocessing(ordering, prefcounts, m, startstate)
        m_star = len(startstate)
        known_winners = set()
        # ----------Some statistics--------------
        hashtable2 = set()

        # push the node of start state into the priority queue
        root = Node(value=startstate)
        stackNode = []
        stackNode.append(root)

        while stackNode:
            # ------------pop the current node-----------------
            node = stackNode.pop()
            # -------------------------------------------------
            state = node.value.copy()

            # use heuristic to delete all the candidates which satisfy the following condition

            # goal state 1: if the state set contains only 1 candidate, then stop
            if len(state) == 1 and list(state)[0] not in known_winners:
                known_winners.add(list(state)[0])
                continue
            # goal state 2 (pruning): if the state set is subset of the known_winners set, then stop
            if state <= known_winners:
                continue
            # ----------Compute plurality score for the current remaining candidates--------------
            plural_score = self.get_plurality_scores3(prefcounts, ordering, state, m_star)
            minscore = min(plural_score.values())
            for to_be_deleted in state:
                if plural_score[to_be_deleted] == minscore:
                    child_state = state.copy()
                    child_state.remove(to_be_deleted)
                    tpc = tuple(sorted(child_state))
                    if tpc in hashtable2:
                        continue
                    else:
                        hashtable2.add(tpc)
                        child_node = Node(value=child_state)
                        stackNode.append(child_node)

        return sorted(known_winners)
703651
def _iter_categorized_partners(self, state):
        '''
        
        '''
        # categorize partners into the structure
        # partner_class -> list of its instances
        categorized = dict()
        for partner in state.descriptor.partners:
            category, index = categorized.get(partner.__class__,
                                              (list(), len(categorized)))
            category.append(partner)
            categorized[partner.__class__] = tuple([category, index])

        for category, (brothers, index) in sorted(categorized.items(),
                                                  key=lambda x: x[1][1]):
            for partner in brothers:
                yield partner, brothers
439062
def get_player_bans(self, steamIDS, format=None):
        
        parameters = {'steamids' : steamIDS}
        if format is not None:
            parameters['format'] = format
        url = self.create_request_url(self.interface, 'GetPlayerBans', 1,
            parameters)
        data = self.retrieve_request(url)
        return self.return_data(data, format=format)
641461
def dataframe(self):
        
        if self._points_for is None and self._points_against is None:
            return None
        fields_to_include = {
            'arena': self.arena,
            'boxscore_index': self.boxscore_index,
            'date': self.date,
            'datetime': self.datetime,
            'game': self.game,
            'location': self.location,
            'opponent_abbr': self.opponent_abbr,
            'opponent_conference': self.opponent_conference,
            'opponent_name': self.opponent_name,
            'opponent_rank': self.opponent_rank,
            'overtimes': self.overtimes,
            'points_against': self.points_against,
            'points_for': self.points_for,
            'result': self.result,
            'season_losses': self.season_losses,
            'season_wins': self.season_wins,
            'streak': self.streak,
            'time': self.time,
            'type': self.type
        }
        return pd.DataFrame([fields_to_include], index=[self._boxscore])
197727
public Collection<PartnerSubscription> list(long partnerId, long accountId)
    {
        return HTTP.GET(String.format("/v2/partners/%d/accounts/%d/subscriptions", partnerId, accountId), PARTNER_SUBSCRIPTIONS).get();
    }
13989
async def get_matches(self, state: MatchState = MatchState.all_):
        
        matches = await self.connection('GET',
                                        'tournaments/{}/matches'.format(self._tournament_id),
                                        state=state.value,
                                        participant_id=self._id)
        # return [await self._tournament.get_match(m['match']['id']) for m in matches] 3.6 only...
        ms = []
        for m in matches:
            ms.append(await self._tournament.get_match(m['match']['id']))
        return ms
617795
async def get_final_ranking(self) -> OrderedDict:
        
        if self._state != TournamentState.complete.value:
            return None

        ranking = {}
        for p in self.participants:
            if p.final_rank in ranking:
                ranking[p.final_rank].append(p)
            else:
                ranking[p.final_rank] = [p]

        return OrderedDict(sorted(ranking.items(), key=lambda t: t[0]))
794491
def to_dict(self):
        ''''''
        d = {'id': self.id,
                'kind': self.kind}
        if self.rate != 0.0:
            d['rate'] = self.rate
        participants = []
        for p in self.participants:
            participants.append(p.to_dict())
        if participants:
            d['participants'] = participants
        props = []
        for name in self.properties:
            p = {'name': name}
            if self.properties[name]:
                p['value'] = str(self.properties[name])
            props.append(p)
        if props:
            d[RTS_EXT_NS_YAML + 'properties'] = props
        return d
830115
def get_connection_pool(self, pool_id, *args, **kwargs):
        
        assert isinstance(pool_id, (str, unicode))
        if not hasattr(self, '_pools'):
            self._pools = {}
        if pool_id not in self._pools:
            self._pools[pool_id] = ConnectionPool(*args, **kwargs)
        # logging.debug("%s: _connections = %d", pool_id, self._pools[pool_id]._connections)
        return self._pools[pool_id]
1031400
def competition_list_files(self, competition):
        
        competition_list_files_result = self.process_response(
            self.competitions_data_list_files_with_http_info(id=competition))
        return [File(f) for f in competition_list_files_result]