-
Notifications
You must be signed in to change notification settings - Fork 82
refactor: add typing to & do maintenance of periods #1223
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
257a68d
chore(deps): update pendulum
bonjourmauko 28dc8d5
refactor(variables): remove rubn-time type check
bonjourmauko c745a22
refactor(populations): remove run-time type check
bonjourmauko dd71acf
refactor(types): do not use abstract classes
bonjourmauko c618f26
doc(periods): add types
bonjourmauko 07c93b9
fix(periods): unhandled none
bonjourmauko 9bd5c71
fix(periods): dunder method types
bonjourmauko 7dc706f
chore(periods): add py.typed
bonjourmauko 74b8d11
chore(version): bump
bonjourmauko 4f81fb7
refactor(periods): fix linter warnings
bonjourmauko b27db7c
chore: cleanup
bonjourmauko fbb90c6
Merge branch 'master' into fix-mypy-checks-periods
bonjourmauko dd4ca9f
docs(periods): fix types (#1229)
bonjourmauko 93eec6c
style(periods): fix linter errors (#1229)
bonjourmauko 1ef1d91
refactor(periods)!: fix instant complexity (#1229)
bonjourmauko 33f00cf
refactor(periods): ensure is str in parse (#1229)
bonjourmauko d5ef321
style(periods): fix linter errors (#1229)
bonjourmauko 022e2c4
feat(periods): parse week instants (#1232)
bonjourmauko e1aa7c7
refactor(periods)!: change eternity to int (#1229)
bonjourmauko e68657e
chore(version): bump
bonjourmauko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from pendulum.parsing.exceptions import ParserError | ||
|
||
__all__ = ["ParserError"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,20 @@ | ||
import re | ||
|
||
from .date_unit import DateUnit | ||
import pendulum | ||
|
||
WEEKDAY = DateUnit.WEEKDAY | ||
WEEK = DateUnit.WEEK | ||
DAY = DateUnit.DAY | ||
MONTH = DateUnit.MONTH | ||
YEAR = DateUnit.YEAR | ||
ETERNITY = DateUnit.ETERNITY | ||
from . import types as t | ||
|
||
# Matches "2015", "2015-01", "2015-01-01" | ||
# Does not match "2015-13", "2015-12-32" | ||
INSTANT_PATTERN = re.compile( | ||
r"^\d{4}(-(0[1-9]|1[012]))?(-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01]))?$", | ||
) | ||
|
||
date_by_instant_cache: dict = {} | ||
str_by_instant_cache: dict = {} | ||
date_by_instant_cache: dict[t.Instant, pendulum.Date] = {} | ||
str_by_instant_cache: dict[t.Instant, t.InstantStr] = {} | ||
year_or_month_or_day_re = re.compile( | ||
r"(18|19|20)\d{2}(-(0?[1-9]|1[0-2])(-([0-2]?\d|3[0-1]))?)?$", | ||
) | ||
|
||
|
||
__all__ = ["INSTANT_PATTERN", "date_by_instant_cache", "str_by_instant_cache"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.