diff options
Diffstat (limited to 'vk/tracking/db')
| -rw-r--r-- | vk/tracking/db/__init__.py | 2 | ||||
| -rw-r--r-- | vk/tracking/db/backend/__init__.py | 6 | ||||
| -rw-r--r-- | vk/tracking/db/backend/log.py | 14 | ||||
| -rw-r--r-- | vk/tracking/db/format.py | 22 | ||||
| -rw-r--r-- | vk/tracking/db/timestamp.py | 4 |
5 files changed, 24 insertions, 24 deletions
diff --git a/vk/tracking/db/__init__.py b/vk/tracking/db/__init__.py index 51b1a7c..7095cf3 100644 --- a/vk/tracking/db/__init__.py +++ b/vk/tracking/db/__init__.py @@ -5,4 +5,4 @@ from .format import Format -__all__ = ('format',) +__all__ = ("format",) diff --git a/vk/tracking/db/backend/__init__.py b/vk/tracking/db/backend/__init__.py index 0d3153f..8a1a7d7 100644 --- a/vk/tracking/db/backend/__init__.py +++ b/vk/tracking/db/backend/__init__.py @@ -6,7 +6,7 @@ from . import csv, log, null __all__ = ( - 'csv', - 'log', - 'null', + "csv", + "log", + "null", ) diff --git a/vk/tracking/db/backend/log.py b/vk/tracking/db/backend/log.py index 0ffee5c..6f3ebaa 100644 --- a/vk/tracking/db/backend/log.py +++ b/vk/tracking/db/backend/log.py @@ -15,7 +15,7 @@ class Writer(meta.Writer): handler = logging.StreamHandler(fd) handler.setFormatter( logging.Formatter( - fmt='[%(asctime)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S%z' + fmt="[%(asctime)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S%z" ) ) self._logger.addHandler(handler) @@ -71,24 +71,24 @@ class Writer(meta.Writer): @staticmethod def _format_user_is_online(user): - return f'{user.full_name} is ONLINE.' + return f"{user.full_name} is ONLINE." @staticmethod def _format_user_is_offline(user): - return f'{user.full_name} is OFFLINE.' + return f"{user.full_name} is OFFLINE." @staticmethod def _format_user_last_seen(user): - return f'{user.full_name} was last seen at {user.last_seen.time_local} using {user.last_seen.platform.descr}.' + return f"{user.full_name} was last seen at {user.last_seen.time_local} using {user.last_seen.platform.descr}." @staticmethod def _format_user_went_online(user): - return f'{user.full_name} went ONLINE.' + return f"{user.full_name} went ONLINE." @staticmethod def _format_user_went_offline(user): - return f'{user.full_name} went OFFLINE.' + return f"{user.full_name} went OFFLINE." @staticmethod def _format_another_connection_error(e): - return f'Encountered a connection error which looks like the previous one: {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 5c88cb7..66d9132 100644 --- a/vk/tracking/db/format.py +++ b/vk/tracking/db/format.py @@ -12,9 +12,9 @@ from . import backend class Format(Enum): - CSV = 'csv' - LOG = 'log' - NULL = 'null' + CSV = "csv" + LOG = "log" + NULL = "null" def __str__(self): return self.value @@ -26,7 +26,7 @@ class Format(Enum): return backend.log.Writer(fd) if self is Format.NULL: return backend.null.Writer() - raise NotImplementedError(f'unsupported database format: {self}') + raise NotImplementedError(f"unsupported database format: {self}") def open_output_file(self, path=None): if self is Format.CSV: @@ -35,30 +35,30 @@ class Format(Enum): return self._open_output_log_file(path) if self is Format.NULL: return self._open_output_database_file(None) - raise NotImplementedError('unsupported database format: ' + str(self)) + raise NotImplementedError("unsupported database format: " + str(self)) @staticmethod def _open_output_log_file(path): - return io.open_output_text_file(path, mode='a') + return io.open_output_text_file(path, mode="a") @staticmethod def _open_output_database_file(path): - return io.open_output_text_file(path, mode='x') + return io.open_output_text_file(path, mode="x") def create_reader(self, fd=sys.stdin): if self is Format.CSV: return backend.csv.Reader(fd) if self is Format.LOG: - return NotImplementedError('cannot read from a log file') + return NotImplementedError("cannot read from a log file") if self is Format.NULL: return backend.null.Reader() - raise NotImplementedError('unsupported database format: ' + str(self)) + raise NotImplementedError("unsupported database format: " + str(self)) def open_input_file(self, path=None): if self is Format.CSV: return io.open_input_text_file(path) if self is Format.LOG: - raise NotImplementedError('cannot read from a log file') + raise NotImplementedError("cannot read from a log file") if self is Format.NULL: return io.open_input_text_file(None) - raise NotImplementedError('unsupported database format: ' + str(self)) + raise NotImplementedError("unsupported database format: " + str(self)) diff --git a/vk/tracking/db/timestamp.py b/vk/tracking/db/timestamp.py index 4a3892f..c9ed293 100644 --- a/vk/tracking/db/timestamp.py +++ b/vk/tracking/db/timestamp.py @@ -30,7 +30,7 @@ class Timestamp: @staticmethod def from_string(s): - return Timestamp(datetime.strptime(s, '%Y-%m-%dT%H:%M:%SZ')) + return Timestamp(datetime.strptime(s, "%Y-%m-%dT%H:%M:%SZ")) def __str__(self): - return f'{self.dt.isoformat()}Z' + return f"{self.dt.isoformat()}Z" |
