Skip to content

Commit b85b950

Browse files
authored
[chore] switch to timezone.utc instead of utcnow() since the last one is deprecated in Python 12 (#3539)
1 parent c03ad6d commit b85b950

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

integration/helpers/deployer/deployer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
import sys
3030
import time
3131
from collections import OrderedDict
32-
from datetime import datetime
32+
from datetime import datetime, timezone
3333

3434
import botocore
3535

@@ -140,7 +140,7 @@ def create_changeset(
140140
"ChangeSetType": changeset_type,
141141
"Parameters": parameter_values,
142142
"Capabilities": capabilities,
143-
"Description": f"Created by SAM CLI at {datetime.utcnow().isoformat()} UTC",
143+
"Description": f"Created by SAM CLI at {datetime.now(timezone.utc).isoformat()} UTC",
144144
"Tags": tags,
145145
}
146146

integration/helpers/deployer/utils/time_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def parse_date(date_string):
122122
# will use current local time as the base for subtraction, but falsely assume it is a UTC time. Therefore
123123
# the time that dateparser returns will be a `datetime` object that did not have any timezone information.
124124
# So be explicit to set the time to UTC.
125-
"RELATIVE_BASE": datetime.datetime.utcnow()
125+
"RELATIVE_BASE": datetime.datetime.now(datetime.timezone.utc)
126126
}
127127

128128
return dateparser.parse(date_string, settings=parser_settings)

0 commit comments

Comments
 (0)