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

remove base-formats parser #721

Merged
merged 1 commit into from Jul 15, 2020

Conversation

noviluni
Copy link
Collaborator

I've been playing around with the formats included in the base-formats parser (_try_hardcoded_formats method) and it seems that all of them are now fully supported by the absolute-time parser, so I think it doesn't have any sense to keep this parser, as it adds unnecessary complexity.

In fact, all the date formats with commas were not applied correctly: #720 and that means that only 3 of the past date formats were applied.

Examples:

'%B %d, %Y, %I:%M:%S %p'

>>> dateparser.parse('Diciembre 04, 1999, 11:04:59 PM', settings={'PARSERS': ['absolute-time']})                                                                                       
datetime.datetime(1999, 12, 4, 23, 4, 59)

>>>  dateparser.parse('December 22, 2009, 11:04:59 AM', settings={'PARSERS': ['absolute-time']})                                                                                        
datetime.datetime(2009, 12, 22, 11, 4, 59)

'%b %d, %Y at %I:%M %p'

>>> dateparser.parse('January 22, 2009 at 01:04 PM', settings={'PARSERS': ['absolute-time']})                                                                                          
datetime.datetime(2009, 1, 22, 13, 4)

'%d %B %Y %H:%M:%S'

>>> dateparser.parse('21 February 2009 1:04:05', settings={'PARSERS': ['absolute-time']})                                                                                              
datetime.datetime(2009, 2, 21, 1, 4, 5)

'%A, %B %d, %Y'

>>> dateparser.parse('Sunday, February 20, 2009', settings={'PARSERS': ['absolute-time']})                                                                                             
datetime.datetime(2009, 2, 20, 0, 0)

>>> dateparser.parse('Sunday, June 21, 2020', settings={'PARSERS': ['absolute-time']})                                                                                                 
datetime.datetime(2020, 6, 21, 0, 0)

>>> dateparser.parse('Saturday, June 21, 2020', settings={'PARSERS': ['absolute-time']})                                                                                               
datetime.datetime(2020, 6, 21, 0, 0)

'%Y-%m-%dT%H:%M:%S.%fZ'

>>>  dateparser.parse('1984-02-01T23:02:01.000001', settings={'PARSERS': ['absolute-time']})                                                                               
datetime.datetime(1984, 2, 1, 23, 2, 1, 1)

>>> dateparser.parse('1984-02-01T23:02:01.100001', settings={'PARSERS': ['absolute-time']})                                                                             
datetime.datetime(1984, 2, 1, 23, 2, 1, 100001)

@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #721 into master will increase coverage by 0.18%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #721      +/-   ##
==========================================
+ Coverage   95.23%   95.42%   +0.18%     
==========================================
  Files         302      304       +2     
  Lines        2560     2578      +18     
==========================================
+ Hits         2438     2460      +22     
+ Misses        122      118       -4     
Impacted Files Coverage Δ
dateparser/date.py 98.77% <ø> (+0.76%) ⬆️
dateparser/calendars/__init__.py 95.06% <0.00%> (-0.45%) ⬇️
dateparser/languages/validation.py 93.43% <0.00%> (-0.44%) ⬇️
dateparser/search/detection.py 94.23% <0.00%> (-0.11%) ⬇️
dateparser/parser.py 98.91% <0.00%> (-0.02%) ⬇️
dateparser/search/search.py 99.35% <0.00%> (-0.01%) ⬇️
dateparser/calendars/jalali_parser.py 100.00% <0.00%> (ø)
dateparser/__init__.py 100.00% <0.00%> (ø)
dateparser/conf.py 100.00% <0.00%> (ø)
... and 1 more

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 6dc38bb...46368e0. Read the comment docs.

@noviluni noviluni requested a review from Gallaecio June 24, 2020 11:00
Copy link
Member

@Gallaecio Gallaecio left a comment

Choose a reason for hiding this comment

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

Wow. Tests pass, so +1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants