Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)#57
Open
wavebyrd wants to merge 120 commits intocuemacro:masterfrom
Open
Replace deprecated datetime.utcnow() with datetime.now(timezone.utc)#57wavebyrd wants to merge 120 commits intocuemacro:masterfrom
wavebyrd wants to merge 120 commits intocuemacro:masterfrom
Conversation
* testing df returns in correct format without nulls * added finish date within range * first tick -> last in finish date test
Python 3.12+ deprecates datetime.utcnow() in favor of timezone-aware datetime.now(timezone.utc). This change ensures compatibility with future Python versions and eliminates DeprecationWarning messages. Changes: - Updated all occurrences across library code and examples - Added timezone import where needed - Fixed incorrect datetime.datetime.now().utcnow() patterns
8da6c05 to
7645ea7
Compare
Author
|
Ping - this fixes the Python 3.12+ deprecation warning for datetime.utcnow(). Ready for review when you have a chance! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55
Summary
This PR replaces all occurrences of the deprecated
datetime.utcnow()withdatetime.now(timezone.utc)to ensure compatibility with Python 3.12+ and eliminate DeprecationWarning messages.Changes
findatapy/market/marketdatarequest.py- Fixed default parameter and date_parser methodfindatapy/timeseries/filter.py- Fixed filter_time_series_by_days methodfindatapy/market/marketdatagenerator.py- Fixed fetch_single_time_series methodfindatapy/market/datavendorbbg.py- Fixed get_reference_data methodtests/test_fetchmd_crypto.py- Fixed test_huobi functionfindatapy_examples/arcticdb_example.py- Fixed timestamp recordingfindatapy_examples/arcticdb_md_example.py- Fixed timestamp recordingfindatapy_examples/eikondata_example.py- Fixed all datetime calculationsTesting
All modifications maintain the same behavior, just using the recommended timezone-aware approach instead of the deprecated naive UTC method.