Commit b8838962 authored by Matt Clarkson's avatar Matt Clarkson

Merge branch '5-remove-write-on-shutdown' into 'master'

Issue #5: remove ConfigurationManager::write_on_shutdown as we do not know...

Closes #5

See merge request WEISS/SoftwareRepositories/SNAPPY/scikit-surgerycore!5
parents b4b17d78 92eece1d
Pipeline #1425 passed with stages
in 14 minutes and 14 seconds
......@@ -24,35 +24,24 @@ class ConfigurationManager:
For example, this might be used at the startup of an application.
:param file_name: a json file to read.
:param write_on_shutdown: if True, will write back to the same file when the destructor is called.
:param write_on_setter: if True, will write back to the same file whenever the setter is called.
:raises: All errors raised as various Exceptions.
def __init__(self, file_name,
""" Constructor. """
if write_on_shutdown or write_on_setter:
if write_on_setter:
with open(file_name, "r") as read_file:
self.config_data = json.load(read_file)
self.file_name = file_name
self.write_on_shutdown = write_on_shutdown
self.write_on_setter = write_on_setter
def __del__(self):
""" If the constructor was passed write_on_shutdown=True,
then the destructor will attempt to save back the config into
the file that it was read from.
if self.write_on_shutdown:
def get_copy(self):
""" Returns a copy of the data read from file.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment