Fridge is a subclass of dict and thus fully conforms to its interface.
Fridge keeps an open file until it’s closed, so you have to call close() when you’re done using it.
Fridge implements __enter__() and __exit__() so you can use with statement.
Parameters: |
|
---|
path and file arguments are mutually exclusive.
Arguments that are used if Fridge is called without path or file arguments. Example:
from fridge import Fridge
Fridge.default_args['path'] = '/home/user/.settings.conf'
with Fridge() as settings:
settings['name'] = 'user'
Close the fridge. Calls save() and closes the underlying file object unless an already open file was passed to the constructor. This method has no effect if the object is already closed.
After the fridge is closed save() and load() will raise an exception but you will still be able to use it as an ordinary dictionary.
Force reloading the data from the file. All data in the in-memory dictionary is discarded. This method is called automatically by the constructor, normally you don’t need to call it.
Return an already closed read-only instance of Fridge. Arguments are the same as for the constructor.