adaptivemd.JSONFile¶
-
class
adaptivemd.JSONFile(location)[source]¶ A special file which as assumed JSON readable content
Methods
__init__(location)x.__init__(…) initializes x; see help(type(x)) for signature args()Return a list of args of the __init__ function of a class base()Return the most parent class actually derived from StorableMixin clone()create a cloned object with equal attributes copy([target])copy file to a target create(scheduler)Mark file as being existent on a specific scheduler. descendants()Return a list of all subclassed objects from_dict(dct)Reconstruct an object from a dictionary representation get([scheduler])Read data from the JSON file at the files location without storing get_file()Return the file content it has been loaded get_uuid()Create a new unique ID :returns: the unique number for an object in the project :rtype: long idx(store)Return the index which is used for the object in the given store. link([target])link file to a target load([scheduler])Load a local file into memory modified()Mark a file as being altered and not existent anymore move([target])move file to a target named(name)Attach a .name property to an object objects()Returns a dictionary of all storable objects remove()remove file set_file(content)Set the file content. to_dict()Convert object into a dictionary representation touch()touch file transfer([target])transfer file to a target Attributes
ACTIVE_LONGCREATION_COUNTINSTANCE_UUIDallowed_drivesbase_clsReturn the base class base_cls_nameReturn the name of the base class basenamereturns: the file basename basename_shortreturns: the basename without extension clsReturn the class name as a string createddatareturns: the parsed JSON content default_drivedirnamereturns: the path of the directory, like os.path.dirname drivereturn the prefix name existsextensionreturns: the filename extension or ‘’ of non exists generatorhas_fileis_folderreturns: True if location is a folder is_tempreturns: True when the location is a temporary folder that might be pathreturns: the complete path without prefix shortreturns: a shortened form of the path splitreturns: split_drivereturns: - str – the drive (prefix with ://)
taskurlreturns: return the full form always with a prefix use_absolute_local_paths-
to_dict()[source]¶ Convert object into a dictionary representation
Used to convert the dictionary into JSON string for serialization
Returns: the dictionary representing the (immutable) state of the object Return type: dict
-
classmethod
from_dict(dct)[source]¶ Reconstruct an object from a dictionary representation
Parameters: dct (dict) – the dictionary containing a state representation of the class. Returns: the reconstructed storable object Return type: StorableMixin
-
data¶ Returns: the parsed JSON content Return type: dict
-
get_file()[source]¶ Return the file content it has been loaded
Returns: the file content, if it exists None else Return type: str or None
-
load(scheduler=None)[source]¶ Load a local file into memory
If you later store the file its content will be stored as well
Parameters: scheduler (Scheduler or None) – if specifiied the scheduler can alter the filelocation with its usual rules. Normally you should not have to use it Returns: Return type: self