diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2018-03-03 15:40:10 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2018-03-03 15:40:10 +0300 |
commit | 96f1356aeafbdc026846cdbe1bcfcbbbd0ab3a7c (patch) | |
tree | 271e85f93792247725cd19f8064b65c7346acb68 /vk/last_seen.py | |
parent | new platform, "VK Mobile" (diff) | |
download | vk-scripts-96f1356aeafbdc026846cdbe1bcfcbbbd0ab3a7c.tar.gz vk-scripts-96f1356aeafbdc026846cdbe1bcfcbbbd0ab3a7c.zip |
fix Pylint warnings
Diffstat (limited to 'vk/last_seen.py')
-rw-r--r-- | vk/last_seen.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/vk/last_seen.py b/vk/last_seen.py index 5266940..25975f2 100644 --- a/vk/last_seen.py +++ b/vk/last_seen.py @@ -16,18 +16,16 @@ def _parse_time(x): if x.tzinfo is None or x.tzinfo.utcoffset(x) is None: x = x.replace(tzinfo=timezone.utc) return x - elif isinstance(x, Real) or isinstance(x, Integral): + if isinstance(x, (Integral, Real)): return datetime.fromtimestamp(x, tz=timezone.utc) - else: - raise TypeError() + raise TypeError() def _parse_platform(x): if x in Platform: return x if isinstance(x, str): return Platform.from_string(x) - else: - return Platform(x) + return Platform(x) class LastSeenField(Enum): TIME = 'time' @@ -69,8 +67,7 @@ class LastSeen(MutableMapping): def parse(field, value): if field in LastSeen._FIELD_PARSERS: return LastSeen._FIELD_PARSERS[field](value) - else: - return LastSeen._DEFAULT_FIELD_PARSER(value) + return LastSeen._DEFAULT_FIELD_PARSER(value) _FIELD_PARSERS = { LastSeenField.TIME: _parse_time, |