aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk/tracking/db/format.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2019-12-23 07:20:36 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2019-12-23 07:20:36 +0300
commit7b8cc8a9f455eda41b9c7d70f4561a84fcda941e (patch)
treeb9e262e9a1dbb663c3b9f704a9fe4daf54be0ce9 /vk/tracking/db/format.py
parentTravis: online_sessions.sh: refactoring (diff)
downloadvk-scripts-7b8cc8a9f455eda41b9c7d70f4561a84fcda941e.tar.gz
vk-scripts-7b8cc8a9f455eda41b9c7d70f4561a84fcda941e.zip
pylint/pep8 fixes
Diffstat (limited to '')
-rw-r--r--vk/tracking/db/format.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/vk/tracking/db/format.py b/vk/tracking/db/format.py
index f9a670c..028d403 100644
--- a/vk/tracking/db/format.py
+++ b/vk/tracking/db/format.py
@@ -8,6 +8,7 @@ import sys
from . import backend, io
+
class Format(Enum):
CSV = 'csv'
LOG = 'log'
@@ -19,22 +20,20 @@ class Format(Enum):
def create_writer(self, fd=sys.stdout):
if self is Format.CSV:
return backend.csv.Writer(fd)
- elif self is Format.LOG:
+ if self is Format.LOG:
return backend.log.Writer(fd)
- elif self is Format.NULL:
+ if self is Format.NULL:
return backend.null.Writer()
- else:
- raise NotImplementedError('unsupported database format: ' + str(self))
+ raise NotImplementedError('unsupported database format: ' + str(self))
def open_output_file(self, path=None):
if self is Format.CSV:
return self._open_output_database_file(path)
- elif self is Format.LOG:
+ if self is Format.LOG:
return self._open_output_log_file(path)
- elif self is Format.NULL:
+ if self is Format.NULL:
return self._open_output_database_file(None)
- else:
- raise NotImplementedError('unsupported database format: ' + str(self))
+ raise NotImplementedError('unsupported database format: ' + str(self))
@staticmethod
def _open_output_log_file(path):
@@ -47,19 +46,17 @@ class Format(Enum):
def create_reader(self, fd=sys.stdin):
if self is Format.CSV:
return backend.csv.Reader(fd)
- elif self is Format.LOG:
+ if self is Format.LOG:
return NotImplementedError('cannot read from a log file')
- elif self is Format.NULL:
+ if self is Format.NULL:
return backend.null.Reader()
- else:
- 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)
- elif self is Format.LOG:
+ if self is Format.LOG:
raise NotImplementedError('cannot read from a log file')
- elif self is Format.NULL:
+ if self is Format.NULL:
return io.open_input_text_file(None)
- else:
- raise NotImplementedError('unsupported database format: ' + str(self))
+ raise NotImplementedError('unsupported database format: ' + str(self))