Bases: BaseModel
Bespoke immutable date class designed to simplify working with times,
in particular input parsing, time calculations, and ranges.
hour
class-attribute
instance-attribute
hour: int = Field(frozen=FROZEN)
minute
class-attribute
instance-attribute
minute: int = Field(default=0, frozen=FROZEN)
model_config
class-attribute
instance-attribute
model_config = ConfigDict(frozen=FROZEN)
second
class-attribute
instance-attribute
second: float = Field(default=0.0, frozen=FROZEN)
triplet
property
triplet: tuple[int, int, float]
__add__
__add__(mins: int | float) -> Time
__and__
__and__(date: Date) -> DateTime
__eq__
__eq__(other: Any) -> bool
__ge__
__ge__(other: Time) -> bool
__gt__
__gt__(other: Time) -> bool
__le__
__le__(other: Time) -> bool
__lt__
__lt__(other: Time) -> bool
__rshift__
__rshift__(other: Time) -> TimeSpan
__sub__
__sub__(subtrahend: Time) -> TimeDelta
__sub__(subtrahend: int) -> Time
__sub__(subtrahend: Time | int) -> Time | TimeDelta
_ceiling
staticmethod
_ceiling(raw_units: float, increment: int | float) -> float
_floor
staticmethod
_floor(raw_units: float, increment: int | float) -> float
_round_to
staticmethod
_round_to(raw_units: float, round_to: int | float, round_down: bool) -> float
_sub
_sub(mins: int | float) -> Time
add
add(unit: Unit, n: int | float) -> Time
add_hours
add_hours(n: int | float) -> Time
add_hours_bounded
add_hours_bounded(n: int | float) -> Time
add_hours_wraparound
add_hours_wraparound(n: int | float) -> tuple[Time, int]
add_minutes
add_minutes(n: int | float) -> Time
add_minutes_bounded
add_minutes_bounded(n: int | float) -> Time
add_minutes_wraparound
add_minutes_wraparound(n: int | float) -> tuple[Time, int]
add_seconds
add_seconds(n: int | float) -> Time
add_seconds_bounded
add_seconds_bounded(n: int | float) -> Time
add_seconds_wraparound
add_seconds_wraparound(n: int | float) -> tuple[Time, int]
ceiling
ceiling(unit: Unit, increment: int | float = 1) -> Time
floor
floor(unit: Unit, increment: int | float = 1) -> Time
from_hours
classmethod
from_hours(n: int | float, places: int | None = 10, allow_wrap: bool = True) -> Self
from_minutes
classmethod
from_minutes(n: int | float, places: int | None = 10, allow_wrap: bool = True) -> Self
from_ordinal
classmethod
from_ordinal(ordinal: float) -> Self
from_seconds
classmethod
from_seconds(n: int | float, places: int | None = 10, allow_wrap: bool = True) -> Self
from_unit
classmethod
from_unit(unit: Unit, n: int | float, places: int | None = 10, allow_wrap: bool = True) -> Self
hms
classmethod
hms(hour: int, minute: int = 0, second: int | float = 0) -> Self
hours_from
hours_from(other: Time) -> float
hours_from_last
hours_from_last(other: Time) -> float
hours_to
hours_to(other: Time) -> float
hours_to_next
hours_to_next(other: Time) -> float
if_valid
classmethod
if_valid(time_string: object) -> Self | None
Parse a string and return an instance of Time if possible; otherwise None.
minutes_from
minutes_from(other: Time) -> float
minutes_from_last
minutes_from_last(other: Time) -> float
minutes_to
minutes_to(other: Time) -> float
minutes_to_next
minutes_to_next(other: Time) -> float
range
range(stop: Time | int, *, unit: U, step: int = 1, inclusive: bool = False) -> TimeRange[U]
round_hours
round_hours(round_to: int | float = 1, round_down: bool = False) -> Time
round_minutes
round_minutes(round_to: int | float = 1, round_down: bool = False) -> Time
round_seconds
round_seconds(round_to: int | float = 1, round_down: bool = False) -> Time
seconds_from
seconds_from(other: Time) -> float
seconds_from_last
seconds_from_last(other: Time) -> float
seconds_to
seconds_to(other: Time) -> float
seconds_to_next
seconds_to_next(other: Time) -> float
span
span(other: Time, name: str | None = None) -> TimeSpan
to
to(other: Time) -> TimeSpan
to_hours
to_hours(places: int | None = 10) -> float
to_minutes
to_minutes(places: int | None = 10) -> float
to_seconds
to_seconds(places: int | None = 10) -> float
validate_time
classmethod
validate_time(raw_time: str | dict | list | tuple) -> dict[str, int | float]