Module server.rating_service.typedefs
Classes
class GameRatingResult (game_id: int, rating_type: str, old_ratings: dict[int, Rating], new_ratings: dict[int, Rating], outcome_map: dict[int, GameOutcome])
-
GameRatingResult(game_id, rating_type, old_ratings, new_ratings, outcome_map)
Expand source code
class GameRatingResult(NamedTuple): game_id: int rating_type: str old_ratings: RatingDict new_ratings: RatingDict outcome_map: dict[PlayerID, GameOutcome]
Ancestors
- builtins.tuple
Instance variables
var game_id : int
-
Alias for field number 0
var new_ratings : dict[int, Rating]
-
Alias for field number 3
var old_ratings : dict[int, Rating]
-
Alias for field number 2
var outcome_map : dict[int, GameOutcome]
-
Alias for field number 4
var rating_type : str
-
Alias for field number 1
class GameRatingSummary (game_id: int, rating_type: str, teams: list[TeamRatingSummary])
-
Holds minimal information needed to rate a game. Fields: - game_id: id of the game to rate - rating_type: str (e.g. "ladder1v1") - teams: a list of two TeamRatingSummaries
Expand source code
class GameRatingSummary(NamedTuple): """ Holds minimal information needed to rate a game. Fields: - game_id: id of the game to rate - rating_type: str (e.g. "ladder1v1") - teams: a list of two TeamRatingSummaries """ game_id: int rating_type: str teams: list[TeamRatingSummary] @classmethod def from_game_info_dict(cls, game_info: dict[str]) -> "GameRatingSummary": if len(game_info["teams"]) != 2: raise ValueError("Detected other than two teams.") return cls( game_info["game_id"], game_info["rating_type"], [ TeamRatingSummary( GameOutcome(summary["outcome"]), set(summary["player_ids"]), summary["army_results"], ) for summary in game_info["teams"] ], )
Ancestors
- builtins.tuple
Static methods
def from_game_info_dict(game_info: dict[str]) ‑> GameRatingSummary
Instance variables
var game_id : int
-
Alias for field number 0
var rating_type : str
-
Alias for field number 1
var teams : list[TeamRatingSummary]
-
Alias for field number 2
class RatingServiceError (*args, **kwargs)
-
Common base class for all non-exit exceptions.
Expand source code
class RatingServiceError(Exception): pass
Ancestors
- builtins.Exception
- builtins.BaseException
Subclasses
class ServiceNotReadyError (*args, **kwargs)
-
Common base class for all non-exit exceptions.
Expand source code
class ServiceNotReadyError(RatingServiceError): pass
Ancestors
- RatingServiceError
- builtins.Exception
- builtins.BaseException