-
Notifications
You must be signed in to change notification settings - Fork 291
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
Replace deprecated datetime.utcnow() calls #1977
Conversation
@@ -275,7 +275,7 @@ def unlock_targets(job_config): | |||
|
|||
|
|||
def run_with_watchdog(process, job_config): | |||
job_start_time = datetime.utcnow() | |||
job_start_time = datetime.datetime.now(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.
looks gut, I know it must be the same to use shorter form datetime.UTC
, but why did you prefer longer variant, for the reference:
DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.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.
Because they didn't make it available as datetime.UTC
until 3.11 🙃
https://docs.python.org/3/library/datetime.html#datetime.UTC
@@ -19,6 +19,8 @@ jobs: | |||
python: "3.10" | |||
- os: ubuntu-22.04 | |||
python: "3.11" | |||
- os: ubuntu-24.04 | |||
python: "3.12" |
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.
Love it
Signed-off-by: Zack Cerza <[email protected]>
692c49d
to
80fb908
Compare
No description provided.