diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-01-28 03:11:23 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-01-28 03:11:23 +0300 |
commit | 7112abbe5dd8aebf44c097043f413a0542c05e5c (patch) | |
tree | 468bc272e40f6a960481290e2d16b84d08813f2b /vk/tracking/db/backend/csv.py | |
parent | vk: move file i/o to a separate module (diff) | |
download | vk-scripts-7112abbe5dd8aebf44c097043f413a0542c05e5c.tar.gz vk-scripts-7112abbe5dd8aebf44c097043f413a0542c05e5c.zip |
add abstract classes for db readers/writers
Diffstat (limited to 'vk/tracking/db/backend/csv.py')
-rw-r--r-- | vk/tracking/db/backend/csv.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/vk/tracking/db/backend/csv.py b/vk/tracking/db/backend/csv.py index 5b2cc7d..6176018 100644 --- a/vk/tracking/db/backend/csv.py +++ b/vk/tracking/db/backend/csv.py @@ -3,13 +3,12 @@ # For details, see https://github.com/egor-tensin/vk-scripts. # Distributed under the MIT License. -from collections.abc import Iterable - +from .. import meta from ..io import InputReaderCSV, OutputWriterCSV from ..record import Record from ..timestamp import Timestamp -class Writer: +class Writer(meta.Writer): def __init__(self, fd): self._writer = OutputWriterCSV(fd) @@ -31,7 +30,7 @@ class Writer: def _record_to_row(record): return [str(record.get_timestamp())] + [str(record[field]) for field in record] -class Reader(Iterable): +class Reader(meta.Reader): def __init__(self, fd): self._reader = InputReaderCSV(fd) |