Skip to content

Allow for FiniteDatetimeRange to be considered as "half-open" #216

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

feds01
Copy link

@feds01 feds01 commented May 16, 2025

_is_half_finite_datetime_range currently checks whether that passed
item is indeed a HalfFiniteRange. We change the implementation to allow
for both HalfFiniteRange and FiniteDatetimeRange to be passed in and
treated as the same item. This is because a HalfFiniteRange is a
a superset of FiniteDatetimeRange and we want to allow for both
types to be passed in and treated as the same item.

@feds01 feds01 self-assigned this May 16, 2025
@feds01 feds01 force-pushed the augment-is-half-finite-datetime-range branch from c5e8e3d to 9c6b29b Compare May 18, 2025 13:51
@@ -1200,7 +1200,14 @@ def _is_datetime_range(value: Any) -> bool:
)


def _is_datetime_range_and_bounded(value: Any) -> bool:
return _is_datetime_range(value) and (
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍷 We already check with _is_datetime_range that both start and end must be datetime | None. The second part of this clause is checking whether we at least have a start or an end, meaning that we'd have a half-finite range.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant