ServingState

The ServingState dataclass encapsulates the serving team, player, receiver, and court side for the upcoming/next point in the match. It is exposed through the server property of the MatchScore.

Serving Geometry and 4-Game Rotation Cycle
Deuce ('right') and Ad ('left') diagonal serving boxes and the 4-game server/receiver rotation state machine.

Properties

  • Name
    team
    Type
    TeamId
    Description

    The TeamId about to serve the upcoming/next point (TeamId.A or TeamId.B).

  • Name
    player
    Type
    Player | None
    Description

    The specific Player about to serve the upcoming/next point, or None if player details are not configured.

  • Name
    receiver
    Type
    Player | None
    Description

    The specific Player about to receive the upcoming/next serve, or None if team details are not configured.

  • Name
    court_side
    Type
    'left' | 'right' | None
    Description

    The side of the court from which the serve is executed ("left" or "right"), or None.


Initialization

Creates a new instance of a ServingState.

Keyword Arguments

  • Name
    team
    Type
    TeamId
    Description

    The TeamId about to serve the upcoming/next point (TeamId.A or TeamId.B).

  • Name
    player
    Type
    Player | None
    Description

    The specific Player about to serve the upcoming/next point, or None if player details are not configured.

  • Name
    receiver
    Type
    Player | None
    Description

    The specific Player about to receive the upcoming/next serve, or None if player details are not configured.

  • Name
    court_side
    Type
    'left' | 'right' | None
    Description

    The side of the court from which the serve is executed ("left" or "right"), or None.

Instantiation

class
ServingState
from padelkit import ServingState, TeamId, Player

server_state = ServingState(
    team=TeamId.A,
    player=Player(name="A. Galán"),
    receiver=Player(name="F. Belasteguín"),
    court_side="right"
)

Output structure

ServingState(
  team=<TeamId.A: 'A'>,
  player=Player(name='A. Galán', ...),
  receiver=Player(name='F. Belasteguín', ...),
  court_side='right'
)

methodsto_dict / from_dict

Dictionary Serialization

  • Name
    serving_state.to_dict()
    Type
    dict[str, Any]
    Description

    Serializes the serving state (team, player, receiver, court_side) into a JSON-compatible dictionary.

  • Name
    ServingState.from_dict(data)
    Type
    ServingState
    Description

    Classmethod that reconstructs a ServingState instance from a dictionary.

Serialize ServingState

method
to_dict / from_dict
from padelkit import Player, ServingState, TeamId

state = ServingState(team=TeamId.A, player=Player("Galán"), court_side="right")
assert ServingState.from_dict(state.to_dict()) == state

Was this page helpful?