MCPcopy Index your code
hub / github.com/pathwaycom/pathway / zero_length_interval

Function zero_length_interval

python/pathway/stdlib/temporal/utils.py:27–35  ·  view source on GitHub ↗
(interval_type: type[IntervalType])

Source from the content-addressed store, hash-verified

25
26
27def zero_length_interval(interval_type: type[IntervalType]) -> IntervalType:
28 if issubclass(interval_type, datetime.timedelta):
29 return datetime.timedelta(0)
30 elif issubclass(interval_type, int):
31 return 0
32 elif issubclass(interval_type, float):
33 return 0.0
34 else:
35 raise Exception("unsupported interval type")
36
37
38def _get_possible_types(type: Any) -> tuple[dt.DType, ...]:

Callers 1

_applyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected