-
Notifications
You must be signed in to change notification settings - Fork 468
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
Fix PytzUsageWarning for Python versions >= 3.6 #1062
Fix PytzUsageWarning for Python versions >= 3.6 #1062
Conversation
* This fix makes the `localize` method to be used only for Python versions that are lower than 3.6, so that the warning doesn't appear for versions 3.6+ * This also allows compatibility with Python 3.5
Codecov Report
@@ Coverage Diff @@
## master #1062 +/- ##
=======================================
Coverage 98.29% 98.29%
=======================================
Files 234 234
Lines 2694 2695 +1
=======================================
+ Hits 2648 2649 +1
Misses 46 46
Continue to review full report at Codecov.
|
Thanks! |
still got the warning: Python 3.10.4 (v3.10.4:9d38120e33, Mar 23 2022, 17:29:05) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dateparser
>>> dateparser.parse("1er juin")
/Users/xxxxx/Documents/xxx/xxxx/.venv/lib/python3.10/site-packages/dateparser/date_parser.py:35: PytzUsageWarning: The localize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html
date_obj = stz.localize(date_obj)
datetime.datetime(2022, 6, 1, 0, 0) |
There is no dateparser release with the fix yet. If you install from the main Git branch, you should not get it. |
|
freshness_date_parser.py:76 also needs the same kind of change. |
This fix makes the
localize
method to be used only for Python versions that are lower than 3.6, so that the warning doesn't appear for versions 3.6+. This also allows compatibility with Python 3.5.Referencing Issue #1013 and implemented suggestions by @DavidMStraub and @bsekiewicz
tox
andtox -e py