Fileson module¶
Fileson class to manipulate Fileson databases.
-
class
fileson.Fileson(*args, **kwargs)[source]¶ File database with previous versions support based on LogDict.
The file format is fully compatible so you can use
LogDict.create()to instantiate one. Special keys like :scan:, :checksum: used for metadata and additionalfiles()anddirs()methods expose certain types of contents. Also,set()used to implement “set if changed” functionality.-
classmethod
load(dbfile: str) → fileson.Fileson[source]¶ Overloaded class method to support f.fson~1 history syntax.
-
classmethod
load_or_scan(db_or_dir: str, **kwargs) → fileson.Fileson[source]¶ Load Fileson database or create one by scanning a directory.
This basically calls
load()or creates a new instance and usesscan()after it (passing kwargs).
-
scan(directory: str, **kwargs) → None[source]¶ Scan a directory for objects or changes.
Every invocation creates a new ‘run’, a version to Fileson database. Only changes need to be stored. You can then use for example
genItems()and pick only objects that were changed on a given run.- Parameters
directory (str) – Directory to scan
**kwargs – Booleans ‘verbose’ and ‘strict’ control behaviour
-
classmethod