scrapinghub / scrapinghub/dateparser
Improve the `parsers` API
@noviluni is already working on this.
Since Sep 21, 2020.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 520
- Avg merge
- 22h 56m
- Merged PRs (30d)
- 6
Description
Since this was merged: https://github.com/scrapinghub/dateparser/pull/603, the "parsers" API has been improving.
I think that we should define better what's a parser and define the same API for all of them, refactoring the code.
This would allow a clearer code, to ensure that all the rules (settings, etc) are applied in all the parsers, and it would also allow building some new fancy public functions to use the parsers directly like: parse_timestamp() or parse_absolute_time().
For that, we would move parts of the _DateLocaleParser logic inside each parser.
My idea is:
A "parser" is a function that receives a
date_stringand thesettingsand it returns the parseddatetime,None, or raises an error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.