Skip to content

Match

Tournament Match Model

MapListMap ¤

Map in a Map List

Source code in sendou/models/tournament/match.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class MapListMap:
    """
    Map in a Map List
    """
    map: StageWithMode
    # One of the following:
    # id of the team that picked the map
    # "DEFAULT" if it was a default map, something went wrong with the algorithm typically
    # "TIEBREAKER" if it was a tiebreaker map (selected by the TO)
    # "BOTH" both teams picked the map
    source: Union[int, MapListSourceEnum]
    winner_team_id: Optional[int]
    participated_user_ids: List[int]

    def __init__(self, data: dict):
        self.map = StageWithMode(data.get("map", {}))
        source = data.get("source")
        if isinstance(source, int):
            self.source = source
        else:
            self.source = MapListSourceEnum(source)
        self.winner_team_id = data.get("winnerTeamId", None)
        self.participated_user_ids = data.get("participatedUserIds", [])

MapListSourceEnum ¤

Bases: Enum

Where Map was sourced from

"DEFAULT" if it was a default map, something went wrong with the algorithm typically "TIEBREAKER" if it was a tiebreaker map (selected by the TO) "BOTH" both teams picked the map

Source code in sendou/models/tournament/match.py
13
14
15
16
17
18
19
20
21
22
23
class MapListSourceEnum(Enum):
    """
    Where Map was sourced from

    "DEFAULT" if it was a default map, something went wrong with the algorithm typically
    "TIEBREAKER" if it was a tiebreaker map (selected by the TO)
    "BOTH" both teams picked the map
    """
    DEFAULT = "DEFAULT"
    TIEBREAKER = "TIEBREAKER"
    BOTH = "BOTH"

Match ¤

Bases: BaseModel

A Tournament Match

Attributes:

Name Type Description
team_one Optional[MatchTeam]

Team One

team_two Optional[MatchTeam]

Team Two

map_list List[MapListMap]

Map List

url str

Match URL

Source code in sendou/models/tournament/match.py
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
class Match(BaseModel):
    """
    A Tournament Match

    Attributes:
        team_one (Optional[MatchTeam]): Team One
        team_two (Optional[MatchTeam]): Team Two
        map_list (List[MapListMap]): Map List
        url (str): Match URL
    """
    team_one: Optional[MatchTeam]
    team_two: Optional[MatchTeam]
    map_list: List[MapListMap]
    url: str

    def __init__(self, data: dict, request_client: RequestsClient):
        super().__init__(data, request_client)
        self.team_one = MatchTeam(data.get("teamOne", {}))
        self.team_two = MatchTeam(data.get("teamTwo", {}))
        self.map_list = [MapListMap(m) for m in data.get("mapList", [])]
        self.url = data.get("url", "")

    @staticmethod
    def api_route(**kwargs) -> str:
        """
        Get the API route

        Args:
            match_id (int): Match ID

        Returns:
            str: API Route
        """
        return f"api/tournament-match/{kwargs.get('match_id')}"

api_route(**kwargs) staticmethod ¤

Get the API route

Parameters:

Name Type Description Default
match_id int

Match ID

required

Returns:

Name Type Description
str str

API Route

Source code in sendou/models/tournament/match.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
@staticmethod
def api_route(**kwargs) -> str:
    """
    Get the API route

    Args:
        match_id (int): Match ID

    Returns:
        str: API Route
    """
    return f"api/tournament-match/{kwargs.get('match_id')}"

MatchTeam ¤

Team in a Match

Attributes:

Name Type Description
id int

Team ID

score int

Team Score

Source code in sendou/models/tournament/match.py
51
52
53
54
55
56
57
58
59
60
61
62
63
64
class MatchTeam:
    """
    Team in a Match

    Attributes:
        id (int): Team ID
        score (int): Team Score
    """
    id: int
    score: int

    def __init__(self, data: dict):
        self.id = data.get("id", 0)
        self.score = data.get("score", 0)