diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-10-10 10:12:01 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-10-10 10:12:01 +0300 |
commit | 129cc8e6e916533ff51a5d65721cf904542a1c27 (patch) | |
tree | 67c85c362b756ffcc46f509b299319959c1ff2fa /vk/tracking/db | |
parent | fix licensing notices (diff) | |
download | vk-scripts-129cc8e6e916533ff51a5d65721cf904542a1c27.tar.gz vk-scripts-129cc8e6e916533ff51a5d65721cf904542a1c27.zip |
fix Pylint warnings
Diffstat (limited to '')
-rw-r--r-- | vk/tracking/db/record.py | 6 | ||||
-rw-r--r-- | vk/tracking/db/timestamp.py | 30 |
2 files changed, 18 insertions, 18 deletions
diff --git a/vk/tracking/db/record.py b/vk/tracking/db/record.py index c03c3ca..6c000ab 100644 --- a/vk/tracking/db/record.py +++ b/vk/tracking/db/record.py @@ -38,9 +38,9 @@ class Record(MutableMapping): def __setitem__(self, field, value): if field is LastSeenField.TIME: if isinstance(value, str): - value = Timestamp.from_string(value).dt + value = Timestamp.from_string(value).impl elif isinstance(value, Timestamp): - value = value.dt + value = value.impl elif isinstance(value, datetime): pass else: @@ -78,7 +78,7 @@ class Record(MutableMapping): def _update_last_seen_field(self, last_seen, field): if field is LastSeenField.TIME: - last_seen[field] = self[field].dt + last_seen[field] = self[field].impl else: last_seen[field] = self[field] diff --git a/vk/tracking/db/timestamp.py b/vk/tracking/db/timestamp.py index b2219ca..0881fb3 100644 --- a/vk/tracking/db/timestamp.py +++ b/vk/tracking/db/timestamp.py @@ -11,25 +11,25 @@ class Timestamp: return datetime.utcnow() @staticmethod - def _is_timezone_aware(dt): - return dt.tzinfo is not None and dt.tzinfo.utcoffset(dt) is not None + def _is_timezone_aware(impl): + return impl.tzinfo is not None and impl.tzinfo.utcoffset(impl) is not None @staticmethod - def _lose_timezone(dt): - if Timestamp._is_timezone_aware(dt): - return dt.astimezone(timezone.utc).replace(tzinfo=None) - return dt + def _lose_timezone(impl): + if Timestamp._is_timezone_aware(impl): + return impl.astimezone(timezone.utc).replace(tzinfo=None) + return impl - def __init__(self, dt=None): - if dt is None: - dt = self._new() - dt = dt.replace(microsecond=0) - dt = self._lose_timezone(dt) - self.dt = dt + def __init__(self, impl=None): + if impl is None: + impl = self._new() + impl = impl.replace(microsecond=0) + impl = self._lose_timezone(impl) + self.impl = impl @staticmethod - def from_string(s): - return Timestamp(datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ')) + def from_string(src): + return Timestamp(datetime.strptime(src, '%Y-%m-%dT%H:%M:%SZ')) def __str__(self): - return self.dt.isoformat() + 'Z' + return self.impl.isoformat() + 'Z' |