diff options
Diffstat (limited to '')
-rw-r--r-- | vk/tracking/db/backend/log.py | 3 | ||||
-rw-r--r-- | vk/tracking/db/record.py | 5 | ||||
-rw-r--r-- | vk/tracking/status_tracker.py | 3 |
3 files changed, 6 insertions, 5 deletions
diff --git a/vk/tracking/db/backend/log.py b/vk/tracking/db/backend/log.py index 1ea009b..814cabc 100644 --- a/vk/tracking/db/backend/log.py +++ b/vk/tracking/db/backend/log.py @@ -70,8 +70,7 @@ class Writer(meta.Writer): def _format_user(user): if user.has_last_name(): return '{} {}'.format(user.get_first_name(), user.get_last_name()) - else: - return '{}'.format(user.get_first_name()) + return '{}'.format(user.get_first_name()) @staticmethod def _format_user_is_online(user): diff --git a/vk/tracking/db/record.py b/vk/tracking/db/record.py index c03c3ca..dfd47c6 100644 --- a/vk/tracking/db/record.py +++ b/vk/tracking/db/record.py @@ -7,10 +7,11 @@ from collections import OrderedDict from collections.abc import MutableMapping from datetime import datetime -from .timestamp import Timestamp from vk.last_seen import LastSeen, LastSeenField from vk.user import User, UserField +from .timestamp import Timestamp + class Record(MutableMapping): FIELDS = ( UserField.UID, @@ -95,6 +96,6 @@ class Record(MutableMapping): self._update_user_field(user, field) else: assert False - if len(last_seen): + if last_seen: user.set_last_seen(last_seen) return user diff --git a/vk/tracking/status_tracker.py b/vk/tracking/status_tracker.py index 0dba0f9..e1a3216 100644 --- a/vk/tracking/status_tracker.py +++ b/vk/tracking/status_tracker.py @@ -47,7 +47,8 @@ class StatusTracker: _USER_FIELDS = UserField.DOMAIN, UserField.ONLINE, UserField.LAST_SEEN, def _query_status(self, uids): - return {user.get_uid(): user for user in self._api.users_get(uids, self._USER_FIELDS, deactivated_users=False)} + user_list = self._api.users_get(uids, self._USER_FIELDS, deactivated_users=False) + return {user.get_uid(): user for user in user_list} def _notify_status(self, user): for fn in self._on_initial_status: |