Replace deprecated datetime.utcfromtimestamp
It was deprecated in Python 3.12 in favor of datetime.fromtimestamp[1]. [1] https://docs.python.org/3/library/datetime.html#datetime.datetime.utcfromtimestamp Change-Id: Ia805157eaecac0c61d4c5f88daa430ec6d69a9d4
This commit is contained in:
@@ -37,14 +37,18 @@ def _format_image_cache(cached_images):
|
|||||||
image_obj = copy.deepcopy(image)
|
image_obj = copy.deepcopy(image)
|
||||||
image_obj['state'] = 'cached'
|
image_obj['state'] = 'cached'
|
||||||
image_obj['last_accessed'] = (
|
image_obj['last_accessed'] = (
|
||||||
datetime.datetime.utcfromtimestamp(
|
datetime.datetime.fromtimestamp(
|
||||||
image['last_accessed']
|
image['last_accessed'], tz=datetime.timezone.utc
|
||||||
).isoformat()
|
)
|
||||||
|
.replace(tzinfo=None)
|
||||||
|
.isoformat()
|
||||||
)
|
)
|
||||||
image_obj['last_modified'] = (
|
image_obj['last_modified'] = (
|
||||||
datetime.datetime.utcfromtimestamp(
|
datetime.datetime.fromtimestamp(
|
||||||
image['last_modified']
|
image['last_modified'], tz=datetime.timezone.utc
|
||||||
).isoformat()
|
)
|
||||||
|
.replace(tzinfo=None)
|
||||||
|
.isoformat()
|
||||||
)
|
)
|
||||||
image_list.append(image_obj)
|
image_list.append(image_obj)
|
||||||
elif item == "queued_images":
|
elif item == "queued_images":
|
||||||
|
Reference in New Issue
Block a user