Skip to content
12 changes: 6 additions & 6 deletions kloppy/domain/models/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,13 +978,13 @@ class PassEvent(
event_type (EventType): `EventType.PASS`
event_name (str): `"pass"`
result (PassResult): The pass's outcome.
receive_timestamp (Time): The time the pass was received.
receive_timestamp (timedelta): The time the pass was received.
receiver_coordinates (Point): The coordinates where the pass was received.
receiver_player (Player): The intended receiver of the pass.
qualifiers: A list of qualifiers providing additional information about the pass.
"""

receive_timestamp: Optional[Time] = None
receive_timestamp: Optional[timedelta] = None
receiver_player: Optional[Player] = None
receiver_coordinates: Optional[Point] = None

Expand Down Expand Up @@ -1036,13 +1036,13 @@ class CarryEvent(
Attributes:
event_type (EventType): `EventType.CARRY`
event_name (str): `"carry"`
end_timestamp (Time): Duration of the carry.
end_timestamp (timedelta): Duration of the carry.
end_coordinates (Point): Coordinate on the pitch where the carry ended.
result (CarryResult): The outcome of the carry.
qualifiers: A list of qualifiers providing additional information about the carry.
"""

end_timestamp: Time
end_timestamp: timedelta
end_coordinates: Point

@property
Expand Down Expand Up @@ -1387,11 +1387,11 @@ class PressureEvent(
Attributes:
event_type (EventType): `EventType.Pressure`
event_name (str): `"pressure"`
end_timestamp (Time): When the pressing ended.
end_timestamp (timedelta): When the pressing ended.
qualifiers: A list of qualifiers providing additional information about the pressure event.
"""

end_timestamp: Time
end_timestamp: timedelta

@property
def event_type(self) -> EventType:
Expand Down
15 changes: 15 additions & 0 deletions kloppy/domain/models/time.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,21 @@ def __lt__(self, other):
self.period == other.period and self.timestamp < other.timestamp
)

def __le__(self, other):
return self.period < other.period or (
self.period == other.period and self.timestamp <= other.timestamp
)

def __gt__(self, other):
return self.period > other.period or (
self.period == other.period and self.timestamp > other.timestamp
)

def __ge__(self, other):
return self.period > other.period or (
self.period == other.period and self.timestamp >= other.timestamp
)

def __str__(self):
m, s = divmod(self.timestamp.total_seconds(), 60)
return f"P{self.period.id}T{m:02.0f}:{s:02.0f}"
Expand Down
Loading
Loading