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
add settings validation #797
add settings validation #797
Conversation
Codecov Report
@@ Coverage Diff @@
## master #797 +/- ##
==========================================
+ Coverage 98.22% 98.24% +0.02%
==========================================
Files 231 231
Lines 2533 2569 +36
==========================================
+ Hits 2488 2524 +36
Misses 45 45
Continue to review full report at Codecov.
|
dateparser/conf.py
Outdated
|
||
def _check_require_part(provided_list): | ||
"""Returns `True` if the provided list of parts is valid""" | ||
return not set(provided_list) - {'day', 'month', 'year'} |
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.
should I check the length to avoid duplicated values?
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.
I think that would be great.
8f71476
to
aa916b5
Compare
dateparser/conf.py
Outdated
|
||
def _check_require_part(provided_list): | ||
"""Returns `True` if the provided list of parts is valid""" | ||
return not set(provided_list) - {'day', 'month', 'year'} |
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.
I think that would be great.
Hi @Gallaecio , I addressed all of your feedback, could you review it again? Thank you! |
Note that this new behaviour will be documented in this PR: #722 |
Adding settings validation in one single place. In that way, we can raise an error if there is misconfigurations and we ensure that the submitted settings are valid.
for: #796
It's not fully finished, as we need a way to get a list of the existing parsers.I would prefer to get the "existing parsers" from another place (#798), but I think this can be refactored in the future.