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:
Takashi Kajinami
2025-06-18 18:15:01 +09:00
parent f4c4a7343c
commit ea85c7aa4d

View File

@@ -37,14 +37,18 @@ def _format_image_cache(cached_images):
image_obj = copy.deepcopy(image)
image_obj['state'] = 'cached'
image_obj['last_accessed'] = (
datetime.datetime.utcfromtimestamp(
image['last_accessed']
).isoformat()
datetime.datetime.fromtimestamp(
image['last_accessed'], tz=datetime.timezone.utc
)
.replace(tzinfo=None)
.isoformat()
)
image_obj['last_modified'] = (
datetime.datetime.utcfromtimestamp(
image['last_modified']
).isoformat()
datetime.datetime.fromtimestamp(
image['last_modified'], tz=datetime.timezone.utc
)
.replace(tzinfo=None)
.isoformat()
)
image_list.append(image_obj)
elif item == "queued_images":