aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/vk
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--vk/tracking/db/io.py11
1 files changed, 3 insertions, 8 deletions
diff --git a/vk/tracking/db/io.py b/vk/tracking/db/io.py
index d280634..487a136 100644
--- a/vk/tracking/db/io.py
+++ b/vk/tracking/db/io.py
@@ -25,16 +25,11 @@ class FileReaderCSV:
@contextmanager
def _open_file(path=None, default=None, **kwargs):
- fd = default
if path is None:
- pass
+ yield default
else:
- fd = open(path, **kwargs)
- try:
- yield fd
- finally:
- if fd is not default:
- fd.close()
+ with open(path, **kwargs) as fd:
+ yield fd
_DEFAULT_ENCODING = 'utf-8'