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.

property data_proxy: DataProxy | None#
property data_uri: DataUri | None#
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

fix_uhash()[source]#

Fix the uhash when it is derived from the uhash data.

force_non_existing()[source]#
get(k[, d]) D[k] if k in D, else d.  d defaults to None.#
get_named_variable_values()[source]#
get_positional_variable_values()[source]#
get_uhash_init(serialize=False)#
get_variable_data_proxies()[source]#
get_variable_transfer_data()[source]#

Transfer data by variable or URI

get_variable_uhashes()[source]#
get_variable_uris()[source]#
get_variable_values()[source]#
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#

DEPRECATED

property positional_variable_values#

DEPRECATED

reset()[source]#

Reset all variables to ‘MISSING_DATA’

Return type:

None

serialize()[source]#

Serialize data before persistent storage

set_uhash_init(pre_uhash=None, instance_nonce=None)#
Parameters:
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#

DEPRECATED

property variable_transfer_data#

DEPRECATED

property variable_uhashes#

DEPRECATED

property variable_uris#

DEPRECATED

property variable_values#

DEPRECATED