Skip to content
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

Add typing to periods #1229

Closed
Tracked by #1062
bonjourmauko opened this issue Sep 25, 2024 · 0 comments · Fixed by #1223
Closed
Tracked by #1062

Add typing to periods #1229

bonjourmauko opened this issue Sep 25, 2024 · 0 comments · Fixed by #1223
Assignees
Labels
kind:docs Add or improvement of documentation

Comments

@bonjourmauko
Copy link
Member

Part of #1062

@bonjourmauko bonjourmauko added the kind:docs Add or improvement of documentation label Sep 25, 2024
@bonjourmauko bonjourmauko self-assigned this Sep 25, 2024
bonjourmauko added a commit that referenced this issue Sep 26, 2024
bonjourmauko added a commit that referenced this issue Sep 26, 2024
Method `periods.instant` had way too much branching and cyclomatic
complexity. It has been refactored so to make use of
`functools.singledispatch` to improve readability and testing.

BREAKING CHANGE: `periods.instant` no longer returns `None`. Now, it
raises `periods.InstantError` instead.
bonjourmauko added a commit that referenced this issue Sep 26, 2024
Broaden the expected argument type to be of generic type `object`, and
do an explicit casting to help users know that the expected argument for
that function is a string.
bonjourmauko added a commit that referenced this issue Sep 26, 2024
Previously, eternal periods and entities were populated with `inf`
values, which are floats. This was an exception, already, as the rest of
the values are integers. If you store, for example, thousands of
instants in a numpy array, just one eternal instant will force the whole
array to pass from integer to float. Now, eternal instants are populated
with `-1`, and can be produced with `Instant.eternity()` and
`Period.eternity()`. Also, they can be checked with `is_eternal`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:docs Add or improvement of documentation
Projects
Status: Answer given / Dealt with
Development

Successfully merging a pull request may close this issue.

1 participant