aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk/tracking/db
diff options
context:
space:
mode:
Diffstat (limited to 'vk/tracking/db')
-rw-r--r--vk/tracking/db/backend/log.py30
-rw-r--r--vk/tracking/db/format.py2
-rw-r--r--vk/tracking/db/timestamp.py2
3 files changed, 17 insertions, 17 deletions
diff --git a/vk/tracking/db/backend/log.py b/vk/tracking/db/backend/log.py
index dc13a92..0cc8a63 100644
--- a/vk/tracking/db/backend/log.py
+++ b/vk/tracking/db/backend/log.py
@@ -72,36 +72,36 @@ class Writer(meta.Writer):
@staticmethod
def _format_user(user):
if user.has_last_name():
- return '{} {}'.format(user.get_first_name(), user.get_last_name())
- return '{}'.format(user.get_first_name())
+ return f'{user.get_first_name()} {user.get_last_name()}'
+ return f'{user.get_first_name()}'
@staticmethod
def _format_user_is_online(user):
- return '{} is ONLINE.'.format(Writer._format_user(user))
+ user = Writer._format_user(user)
+ return f'{user} is ONLINE.'
@staticmethod
def _format_user_is_offline(user):
- return '{} is OFFLINE.'.format(Writer._format_user(user))
+ user = Writer._format_user(user)
+ return f'{user} is OFFLINE.'
@staticmethod
def _format_user_last_seen(user):
- return '{} was last seen at {} using {}.'.format(
- Writer._format_user(user),
- user.get_last_seen_time_local(),
- user.get_last_seen_platform().get_descr_text(),
- )
+ last_seen = user.get_last_seen_time_local()
+ platform = user.get_last_seen_platform().get_descr_text()
+ user = Writer._format_user(user)
+ return f'{user} was last seen at {last_seen} using {platform}.'
@staticmethod
def _format_user_went_online(user):
- return '{} went ONLINE.'.format(Writer._format_user(user))
+ user = Writer._format_user(user)
+ return f'{user} went ONLINE.'
@staticmethod
def _format_user_went_offline(user):
- return '{} went OFFLINE.'.format(Writer._format_user(user))
+ user = Writer._format_user(user)
+ return f'{user} went OFFLINE.'
@staticmethod
def _format_another_connection_error(e):
- return (
- 'Encountered a connection error which looks like the previous one: '
- + str(e)
- )
+ return f'Encountered a connection error which looks like the previous one: {e}'
diff --git a/vk/tracking/db/format.py b/vk/tracking/db/format.py
index 53762b3..5c88cb7 100644
--- a/vk/tracking/db/format.py
+++ b/vk/tracking/db/format.py
@@ -26,7 +26,7 @@ class Format(Enum):
return backend.log.Writer(fd)
if self is Format.NULL:
return backend.null.Writer()
- raise NotImplementedError('unsupported database format: ' + str(self))
+ raise NotImplementedError(f'unsupported database format: {self}')
def open_output_file(self, path=None):
if self is Format.CSV:
diff --git a/vk/tracking/db/timestamp.py b/vk/tracking/db/timestamp.py
index 2f26445..4a3892f 100644
--- a/vk/tracking/db/timestamp.py
+++ b/vk/tracking/db/timestamp.py
@@ -33,4 +33,4 @@ class Timestamp:
return Timestamp(datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ'))
def __str__(self):
- return self.dt.isoformat() + 'Z'
+ return f'{self.dt.isoformat()}Z'