Skip to content
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

[chore] switch to timezone.utc instead of utcnow() since the last one is deprecated in Python 12 #3539

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions integration/helpers/deployer/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import sys
import time
from collections import OrderedDict
from datetime import datetime
from datetime import datetime, timezone

import botocore

Expand Down Expand Up @@ -140,7 +140,7 @@ def create_changeset(
"ChangeSetType": changeset_type,
"Parameters": parameter_values,
"Capabilities": capabilities,
"Description": f"Created by SAM CLI at {datetime.utcnow().isoformat()} UTC",
"Description": f"Created by SAM CLI at {datetime.now(timezone.utc).isoformat()} UTC",
"Tags": tags,
}

Expand Down
2 changes: 1 addition & 1 deletion integration/helpers/deployer/utils/time_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def parse_date(date_string):
# will use current local time as the base for subtraction, but falsely assume it is a UTC time. Therefore
# the time that dateparser returns will be a `datetime` object that did not have any timezone information.
# So be explicit to set the time to UTC.
"RELATIVE_BASE": datetime.datetime.utcnow()
"RELATIVE_BASE": datetime.datetime.now(datetime.timezone.utc)
}

return dateparser.parse(date_string, settings=parser_settings)