-
Notifications
You must be signed in to change notification settings - Fork 104
Fix - deprecated warning for datetime.utcnow() with Python >= 3.12 #792
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
base: main
Are you sure you want to change the base?
Fix - deprecated warning for datetime.utcnow() with Python >= 3.12 #792
Conversation
bumble/snoop.py
Outdated
| The keyword args that may be referenced by the string pattern are: | ||
| now: the value of `datetime.now()` | ||
| utcnow: the value of `datetime.utcnow()` | ||
| utcnow: the value of 'datetime.now(tz=datetime.timezone.utc)' |
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.
It would be best to keep the backquotes here instead of regular quotes.
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.
updated
| int( | ||
| ( | ||
| datetime.datetime.now(tz=datetime.timezone.utc) | ||
| - self.TIMESTAMP_ANCHOR |
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 TIMESTAMP_ANCHOR would need to be updated as well, to be a timestamp with an explicit UTC timezone.
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.
update
I think that
TIMESTAMP_ANCHORwould need to be updated as well, to be a timestamp with an explicit UTC timezone.
updated
Replaced
datetime.utcnow()withdatetime.now(tz=datetime.timezone.utc)to fix following deprecated warning:Use timezone-aware objects to represent datetimes in UTC; e.g. by calling .now(datetime.timezone.utc)This warning can be very annoying when running pytest tests with enabled HCI snooping.