Skip to content

Fix leap years when PREFER_DATES_FROM is set - #738

Merged
noviluni merged 5 commits into
scrapinghub:masterfrom
noviluni:fix_leap_years_prefer_dates_from
Jul 6, 2020
Merged

noviluni merged 5 commits into
scrapinghub:masterfrom
noviluni:fix_leap_years_prefer_dates_from

Conversation

@noviluni

@noviluni noviluni commented Jul 2, 2020

Copy link
Copy Markdown
Contributor

fixes: #520, #693

@codecov

codecov Bot commented Jul 2, 2020 •

Copy link
Copy Markdown

Codecov Report

Merging #738 into master will increase coverage by 0.05%.
The diff coverage is 97.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #738      +/-   ##
==========================================
+ Coverage   95.34%   95.39%   +0.05%     
==========================================
  Files         304      304              
  Lines        2622     2651      +29     
==========================================
+ Hits         2500     2529      +29     
  Misses        122      122              
Impacted Files Coverage Δ
dateparser/parser.py 98.98% <96.42%> (+0.05%) ⬆️
dateparser/utils/__init__.py 97.03% <100.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e11a18a...ea9597b. Read the comment docs.

@noviluni noviluni changed the title Fix leap years prefer dates from Fix leap years when PREFER_DATES_FROM is set Jul 2, 2020
Comment thread dateparser/parser.py Resolved
Comment thread dateparser/parser.py Resolved
Comment thread dateparser/utils/__init__.py Resolved
Comment thread dateparser/utils/__init__.py Resolved

@eamanu eamanu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

:)

Comment thread dateparser/parser.py

from dateparser.utils import set_correct_day_from_settings, \
get_last_day_of_month
get_last_day_of_month, get_previous_leap_year, get_next_leap_year

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why don't write one method by line?, this way if we need add an import, just modify a line and avoid possible erros

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't see the point...

If you check the PEP8 guidelines, this is the normal way of using imports:
imagen
ref: https://www.python.org/dev/peps/pep-0008/#imports

Of course, I can use tuples to do multi-line imports, but that's normally used only when there are long names to be imported or heavy nested structures.

In this case, I think that what I did is totally correct.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@eamanu (comment above)

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.

wrong lead year

3 participants