whist_core.session.userlist¶
Handles users joining and leaving a table.
Module Contents¶
Classes¶
Entry class containing the player object and its current status at the table. |
|
User handler for tables. |
- class whist_core.session.userlist.UserListEntry¶
Bases:
pydantic.BaseModelEntry class containing the player object and its current status at the table.
- player: whist_core.user.player.Player¶
- status: whist_core.user.status.Status¶
- class whist_core.session.userlist.UserList¶
Bases:
pydantic.BaseModelUser handler for tables.
- property players: list[whist_core.user.player.Player]¶
Returns all players at the table. :return: players of the table :rtype: list[Player]
- property ready: bool¶
Returns if all players are ready. :return: Ready or not :rtype: boolean
- property teams: list[whist_core.scoring.team.Team]¶
Returns the teams. :return: list of teams
- users: Dict[str, UserListEntry]¶
- __len__()¶
Amount of players
- team(player: whist_core.user.player.Player) int | None¶
Gets the id of the team for a player. :param player: for which the id should be retrieved :type player: Player :return: Integer if player joined a team or None if not. :rtype: int
- team_size(team: int) int¶
Gets the size of the team. :param team: ID of the team :type team: int :return: Amount of members :rtype: int
- is_joined(player: whist_core.user.player.Player) bool¶
Checks if the player is already at the table. :param player: to check :type player: Player :return: True if is member else false :rtype: bool
- append(player: whist_core.user.player.Player)¶
Adds a player to the list. :param player: player to join :type player: Player :return: None :rtype: None
- remove(player: whist_core.user.player.Player)¶
Removes the player from the list. :param player: player to leave :type player: Player :return: None :rtype: None
- apply_distribution(distribution: whist_core.session.distribution.Distribution) None¶
Apply the changes of teams. :param distribution: matrix of player assignment to teams :return: None
- change_team(player: whist_core.user.player.Player, team: int) None¶
Player changes teams. :param player: to change teams :type player: Player :param team: id of the new team :type team: int :return: None :rtype: None
- player_ready(player: whist_core.user.player.Player)¶
Player says they is ready. :param player: player who is ready, must be joined :type player: Player :return: Raised PlayerNotJoinedError if the player has not yet joined. :rtype: None
- player_unready(player: whist_core.user.player.Player)¶
Player says they is not ready. :param player: player who is not ready :type player: Player :return: Raised PlayerNotJoinedError if the player has not yet joined. :rtype: None
- _get_status(player) whist_core.user.status.Status¶
- _get_entry(player) UserListEntry¶