Repository navigation
Let search_dates return the period of each date - #1437
Merged
AdrianAtZyte merged 3 commits intoOct 26, 2026
Merged
Conversation
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1437 +/- ##
=======================================
Coverage 99.09% 99.09%
=======================================
Files 239 239
Lines 3988 3997 +9
=======================================
+ Hits 3952 3961 +9
Misses 36 36 β View full report in Codecov by Harness. π New features to boost your workflow:
|
AdrianAtZyte
marked this pull request as ready for review
September 23, 2026 15:17
serhii73
approved these changes
Oct 20, 2026
serhii73
left a comment
Collaborator
There was a problem hiding this comment.
Code review (claude code-review, at ed46bd2; probes run on this head and on the merge-base). The new add_period option is opt-in, and I found no wrong date, so I'm approving. The branch conflicts with master, so it needs a rebase before merge. Two points to settle first:
- Undeclared change to
parse(). The freshness parser now reports periodtimefor relative expressions with an hours, minutes or seconds unit wheneverRETURN_TIME_AS_PERIODis set.DateDataParser(settings={'RETURN_TIME_AS_PERIOD': True}).get_date_data('2 hours ago')gavedayon master and givestimehere;in 2 hours,5 minutes agoandhace 2 horaschange the same way, and1 week 2 hours agochanges fromweektotime. That may well be the more correct value, but the PR is described assearch_datesonly, so please add a changelog note (and mention it underRETURN_TIME_AS_PERIODin the settings docs). - Time-span entries always say
day. WithRETURN_TIME_SPAN, both the start and end entries are hard-coded today, so a year or month span reports the wrong granularity (the PR's own test assertsdayfor a one-month span).
Non-blocking notes:
add_periodchanges the tuple arity, together withadd_detected_language, so(s, d, x)cannot be told apart by the caller and the# type: ignore[return-value]hides it from mypy. Always producing 3-tuples internally and trimming once in the public function (or a NamedTuple) would be safer; the(a, b, p) if add_period else (a, b)expression is repeated in three places.- The split path reads
date_data['period']directly, while the ngram path has adate_obj is not Noneguard. - Tests cover only English and Portuguese with one date each; a multi-date text would catch misaligned periods. The docstring still has
versionadded:: VERSION.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #1044, resolves #1162