ewokscore.variable.VariableContainer¶
- class ewokscore.variable.VariableContainer(value=<MISSING_DATA>, varinfo=None, data_uri=None, data_proxy=None, pre_uhash=None, instance_nonce=None)[source]¶
Bases:
Variable
,Mapping
An immutable mapping of variable identifiers (str or int) to variables (Variable).
- Parameters:
value (
Any
) –varinfo (
Optional
[dict
]) –data_uri (
Optional
[DataUri
]) –data_proxy (
Optional
[DataProxy
]) –pre_uhash (
Union
[str
,bytes
,UniversalHash
,HasUhash
,None
]) –instance_nonce (
Optional
[Any
]) –
- MISSING_DATA = <MISSING_DATA>¶
- classmethod class_nonce()¶
- classmethod class_nonce_data()¶
- cleanup_references()[source]¶
Remove all references to other hashables. Side effect: fixes the uhash when it depends on another hashable.
- property container_has_persistent_value¶
- property container_has_runtime_value¶
- property container_has_value¶
- copy_without_references()[source]¶
The uhash of the copy is fixed thereby remove references to other uhashable objects.
- deserialize(data)[source]¶
Deserialize data after loading from persistent storage
- Parameters:
data (
dict
) –
- dump()[source]¶
From runtime to persistent value (never overwrite). Creating the persistent value needs to be atomic.
This silently returns when: - data persistence is disabled - already persisted - data does not have a runtime value (MISSING_DATA) - non value URI can be constructed
- get(k[, d]) D[k] if k in D, else d. d defaults to None. ¶
- get_uhash_init(serialize=False)¶
- property has_persistent_value¶
- property has_runtime_value¶
- property has_value¶
- property hashing_enabled¶
- instance_nonce()¶
- is_missing()¶
- Return type:
bool
- items() a set-like object providing a view on D's items ¶
- keys() a set-like object providing a view on D's keys ¶
- load(raise_error=True)¶
From persistent to runtime value. This is called when try to get the value (lazy loading).
This silently returns when: - data persistence is disabled - uri is None (i.e. uhash is None) - raise_error=False
- property metadata: dict¶
- property n_positional_variables¶
- property named_variable_values¶
- property positional_variable_values¶
- set_uhash_init(pre_uhash=None, instance_nonce=None)¶
- Parameters:
pre_uhash (
Union
[str
,bytes
,UniversalHash
,HasUhash
,None
]) –instance_nonce (
Optional
[Any
]) –
- property uhash: UniversalHash | None¶
- uhash_randomize()¶
- undo_fix_uhash()¶
- undo_randomize()¶
- property value¶
- values() an object providing a view on D's values ¶
- property variable_data_proxies¶
- property variable_transfer_data¶
Transfer data by variable or URI
- property variable_uhashes¶
- property variable_uris¶
- property variable_values¶