From 2067a554fb19980caebbb9f0ea6e9f28ca1d0b08 Mon Sep 17 00:00:00 2001 From: Kevin Date: Fri, 24 Jul 2020 14:41:59 -0500 Subject: [PATCH] Do not flush on exit if there is no file specified --- CHANGELOG.md | 20 ++++++++++++-------- deadsimplekv/__init__.py | 4 ++-- setup.py | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 335f465..08e1469 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,15 @@ This project uses Semantic Versioning +## 0.3.1 + +* Do not register exit flush if there is no storage file specified + ## 0.3.0 -Added get_raw_json -Improved code formatting -Switched to setuptools +* Added get_raw_json +* Improved code formatting +* Switched to setuptools ## 0.2.0 @@ -14,14 +18,14 @@ Added automatic creation of path for file writing ## 0.1.1 -Added: +### Added: -flush_on_exit: default argument to write to file on python close -changelog file +* flush_on_exit: default argument to write to file on python close +* changelog file -Changed: +### Changed: -Readme to correctly reflect public function count +* Readme to correctly reflect public function count ## 0.0.1 diff --git a/deadsimplekv/__init__.py b/deadsimplekv/__init__.py index 5373749..b209154 100644 --- a/deadsimplekv/__init__.py +++ b/deadsimplekv/__init__.py @@ -47,7 +47,7 @@ class DeadSimpleKV: self._last_refresh = temp_time # time last refreshed from disk self._last_flush = temp_time # time last flushed to disk - if not file_path is None: + if file_path is not None: abs_path = os.path.dirname(os.path.abspath(file_path)) if not os.path.exists(abs_path): os.makedirs(abs_path) @@ -58,7 +58,7 @@ class DeadSimpleKV: except TypeError: pass - if flush_on_exit: + if flush_on_exit and file_path: atexit.register(self.flush) def get(self, key): diff --git a/setup.py b/setup.py index d74d4ab..4e68cdb 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup, find_packages setup(name='deadsimplekv', - version='0.3.0', + version='0.3.1', description='Very simple key-value store for Python', author='Kevin Froman', author_email='beardog@mailbox.org',