Match
The Match class is the top-level entity representing a padel match. It encapsulates both the metadata (teams, duration, location) and the state management logic by holding a MatchScoreHistory instance.
Properties
- Name
history- Type
- MatchScoreHistory
- Description
The underlying
MatchScoreHistoryengine driving the score logic.
- Name
winner- Type
- Team | None
- Description
Returns the
Teamthat won the match based onbest_of_sets, orNoneif incomplete.
- Name
is_completed- Type
- bool
- Description
Returns
Trueif a winner has been decided.
Initialization
You can create a Match by providing optional parameters. If no teams are provided, default generic teams will be instantiated.
Keyword Arguments
- Name
teams- Type
- dict[TeamId, Team]
- Description
A dictionary mapping a
TeamIdto aTeamobject.
- Name
best_of_sets- Type
- int
- Description
The number of sets to determine a winner (e.g.,
3means the first to win 2 sets wins).
- Name
duration_minutes- Type
- int | None
- Description
Total duration of the match in minutes.
- Name
date- Type
- datetime | None
- Description
The date and time of the match.
- Name
location- Type
- str | None
- Description
The venue or location.
- Name
court_type- Type
- str | None
- Description
E.g., "Indoor", "Outdoor".
Instantiation
from padelkit import Match
from datetime import datetime
match = Match(
best_of_sets=3,
location="Club Padel",
date=datetime.now()
)
Output structure
Match(
teams=...,
best_of_sets=3,
duration_minutes=None,
date=datetime.datetime(...),
location='Club Padel',
court_type=None
)