-
Notifications
You must be signed in to change notification settings - Fork 130
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
dates: Rewrite using regular expressions #928
Conversation
f36b3f0
to
f3ee9b9
Compare
49bf6ff
to
215fb80
Compare
Codecov ReportBase: 68.08% // Head: 68.23% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #928 +/- ##
==========================================
+ Coverage 68.08% 68.23% +0.14%
==========================================
Files 62 62
Lines 6690 6727 +37
Branches 1641 1649 +8
==========================================
+ Hits 4555 4590 +35
Misses 1829 1829
- Partials 306 308 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
e987104
to
505c7b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slick, especially in the 'any_to_numeric_type_min/max'.
As far as I can tell from reading the code, looks good to me.
8d12b61
to
7fb35ac
Compare
Converting to draft, at least until #989 is resolved |
Is the plan to eventually replace the remaining treetime-based functions like |
917dc79
to
6229db7
Compare
6229db7
to
53cb6c1
Compare
To be more accurate and remove duplication.
53cb6c1
to
9460e6c
Compare
While re-reading through the commits, I realized it was hard to follow. Just rebased and force-pushed with more verbose commits which should hopefully help make sense of the changes here. |
aeea545
to
6a18b35
Compare
PR contents updated
One function per supported date format makes the top-level numeric_date() easier to follow.
This was previously implicit, but having it explicitly makes the flow more clear.
This rewrites the date parsing functions currently used by filter and frequencies --min-date/--max-date parameters. Note that current logic is retained.
Don't support non-positive years as those years are outside the range of the ISO 8601 standard.
Support both ambiguous dates (e.g. 2020-XX-XX) and incomplete dates (e.g. 2020-06, 2020).
By centralizing all calls to a final base case, this will make it easier to add options such as min/max bounds. It also makes usage of treetime.utils.numeric_date more clear.
This fix a bug¹ where incomplete dates such as --max-date 2018 would not be inclusive, since that had previously resolved to --max-date 2018-01-01. ¹ nextstrain#893
6a18b35
to
3627df2
Compare
Marking as draft again since this needs to go through some more changes following merge of #1140. |
Closing this in favor of #1144, which is an attempt to tackle the same problems while consolidating logic simultaneously. |
Description of proposed changes
This rewrites the date parsing functions currently used by
filter
andfrequencies
--min-date
/--max-date
parameters. Note that it doesn't affect the date parsing functions used for the metadata dates withinaugur filter
.Related issue(s)
--max-date
with year only is not inclusive #893Testing