-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Description
Problem
The PassEvent class declares three fields as required, but many serializers set them to None because data providers don't always provide this information:
@dataclass(repr=False)
class PassEvent(Event):
receive_timestamp: float # Declared as required
receiver_player: Player # Declared as required
receiver_coordinates: Point # Declared as required
result: PassResultEvidence
receiver_player: Set toNonein 13+ serializers (impect, metrica, sportec, scisports, statsbomb, smrtstats, datafactory, korastats, statsperform, wyscout v3)receiver_coordinates: Set toNonein 6+ serializers (impect, wyscout v2/v3, metrica, sportec, datafactory)receive_timestamp: Set toNonein 5+ serializers (smrtstats, metrica, statsperform, sportec)
Impact
- Type hints are violated (mypy/pyright would flag errors)
- Misleading API - suggests fields are always available
- Potential runtime errors when code assumes non-None values
Proposed Solution
Make these fields explicitly optional, matching the pattern used in ShotEvent.result_coordinates:
@dataclass(repr=False)
class PassEvent(Event):
receive_timestamp: Optional[float] = None
receiver_player: Optional[Player] = None
receiver_coordinates: Optional[Point] = None
result: PassResultThis is backwards compatible at runtime but properly reflects the actual data model.
Metadata
Metadata
Assignees
Labels
No labels