From 47c879764a85395b75b7b46f22c9c70380dd180d Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Thu, 21 Jul 2022 17:21:49 -0700 Subject: [PATCH] Rename timestamp_to_datetime to utcfromtimestamp. It is what it is. --- etiquette/helpers.py | 2 +- etiquette/objects.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/etiquette/helpers.py b/etiquette/helpers.py index e99e745..1eae8b0 100644 --- a/etiquette/helpers.py +++ b/etiquette/helpers.py @@ -456,7 +456,7 @@ def split_easybake_string(ebstring) -> tuple[str, str, str]: tagname = tagname.strip('.') return (tagname, synonym, rename_to) -def timestamp_to_datetime(unix): +def utcfromtimestamp(unix): return datetime.datetime.utcfromtimestamp(unix).replace(tzinfo=datetime.timezone.utc) def zip_album(album, recursive=True) -> zipstream.ZipFile: diff --git a/etiquette/objects.py b/etiquette/objects.py index 42a0efa..1604d21 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -81,7 +81,7 @@ class ObjectBase(worms.Object): def created(self) -> datetime.datetime: if self._created_dt is not None: return self._created_dt - self._created_dt = helpers.timestamp_to_datetime(self.created_unix) + self._created_dt = helpers.utcfromtimestamp(self.created_unix) return self._created_dt class GroupableMixin(metaclass=abc.ABCMeta): @@ -1512,7 +1512,7 @@ class Photo(ObjectBase): def tagged_at(self) -> datetime.datetime: if self._tagged_at_dt is not None: return self._tagged_at_dt - self._tagged_at_dt = helpers.timestamp_to_datetime(self.tagged_at_unix) + self._tagged_at_dt = helpers.utcfromtimestamp(self.tagged_at_unix) return self._tagged_at_dt class Tag(ObjectBase, GroupableMixin):