components.storage
Module Contents
Classes
This class is an abstracted for all other classes, providing initialization function with a name |
- class components.storage.Storage(name)
This class is an abstracted for all other classes, providing initialization function with a name and store function to generate an HDF5 file
- Parameters
name (str) – the name of the instant
- set_storage_path(self, path)
set the storage path where you want to store the HDF5 file
Attention
please always use “/” in path string instead of “”
- Parameters
path (str) – _description_
- is_overwritable(self)
- store_HDF5(self, root=None)
- store_json(self, root=None)
- store(self, format=None, root=None)
- __str__(self)
rewrite the built-in method to modify the behaviors of print() for this instance to make the print result more readable
before:
>>>print(run1)
<run.Run object at 0x0000022AA45715A0>
after:
>>>print(run1)
‘run1’
here, the string ‘run1’ is the name of this instance
- __repr__(self)
rewrite the built-in method to modify the behaviors of print() for a list of instances to make the print result more readable
before:
>>>print(run1.pipelines)
[<pipeline.Pipeline object at 0x0000022AA45715A0>, <pipeline.Pipeline object at 0x0000022AA4gd1s0>]
after:
>>>print(run1.pipelines)
[‘pipe1’, ‘pipe2’]
here, the strings ‘pipe1’ and ‘pipe2’ are the names of this instance
- show(self)
use the method to show the detailed information about this instance, for example all attributes and names. It should return a string like this:
Examples
>> msmtrun.show()
#### pipelines ####
[‘aa’, ‘bb’, ‘cc’]
#### parameters ####
[‘dd’, ‘ee’, ‘ff’]
#### attributes ####
‘author’ : ‘who’
‘author’ : ‘derGeraet’
‘pmanager’ : ‘tcorneli’
‘targettmp’ : 70
‘targetrps’ : 2
‘oil’ : ‘PA06’
- add_attrs_dict(self, dict)
Add a flat Dictionary of key values as a set of attributes.
- dictstr
The Dictionary consists of Key Value pairs, with the keys being the names of the attribute and the value being the value assigned to the attribute
- encode(self, object)
encode anything as a string Parameters: ———- object: Any
an object which can be an instance of any class
- object_string: str
an encoded string, maybe very long if the original object is large
- Parameters
object (Any) –
- Return type
str
- decode(self, object_string)
decode a string as its original form Parameters: ———– object_string: str
an encoded string
- object: object
this is a instance of its original class, you can check its type with type()
- Parameters
object_string (str) –
- Return type
Storage.decode.object