hpcflow.sdk.core.utils.JSONLikeDirSnapShot#
- class hpcflow.sdk.core.utils.JSONLikeDirSnapShot(root_path=None, data=None)#
Bases:
DirectorySnapshot
Overridden DirectorySnapshot from watchdog to allow saving and loading from JSON.
- Parameters:
root_path (str) – Where to take the snapshot based at.
data (dict[str, list]) – Serialised snapshot to reload from. See
to_json_like()
.
Methods
Returns an id for path.
Returns path for id.
Returns a stat information object for the specified path from the snapshot.
Take the snapshot.
Export to a dict that is JSON-compatible and can be later reloaded.
Attributes
Set of file/directory paths in the snapshot.
Where to take the snapshot based at.
- inode(path)#
Returns an id for path.
- isdir(path)#
- mtime(path)#
- path(id)#
Returns path for id. None if id is unknown to this snapshot.
- property paths#
Set of file/directory paths in the snapshot.
- root_path#
Where to take the snapshot based at.
- size(path)#
- stat_info(path)#
Returns a stat information object for the specified path from the snapshot.
Attached information is subject to change. Do not use unless you specify stat in constructor. Use
inode()
,mtime()
,isdir()
instead.- Parameters:
path – The path for which stat information should be obtained from a snapshot.
- take(*args, **kwargs)#
Take the snapshot.
- Return type:
None
- to_json_like()#
Export to a dict that is JSON-compatible and can be later reloaded.
The last two integers in data for each path are the keys in self._inode_to_path.
- walk(root)#