We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
FiniteDatetimeRange
1 parent 8f79c0b commit 9c6b29bCopy full SHA for 9c6b29b
xocto/ranges.py
@@ -1200,7 +1200,14 @@ def _is_datetime_range(value: Any) -> bool:
1200
)
1201
1202
1203
+def _is_datetime_range_and_bounded(value: Any) -> bool:
1204
+ return _is_datetime_range(value) and (
1205
+ isinstance(value.start, datetime.datetime)
1206
+ or isinstance(value.end, datetime.datetime)
1207
+ )
1208
+
1209
1210
# Subscripted generics may not be used with isinstance directly.
1211
# TODO: A TypeGuard would be nicer, once we drop Python 3.9.
1212
def _is_half_finite_datetime_range(value: Any) -> bool:
- return _is_datetime_range(value) and isinstance(value, HalfFiniteRange)
1213
+ return _is_datetime_range_and_bounded(value) or isinstance(value, HalfFiniteRange)
0 commit comments