Do not flush on exit if there is no file specified
This commit is contained in:
parent
a7f8dd31e2
commit
2067a554fb
20
CHANGELOG.md
20
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
|
||||
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user