ewokscore.variable.MutableVariableContainer

class ewokscore.variable.MutableVariableContainer(value=<MISSING_DATA>, varinfo=None, data_uri=None, data_proxy=None, pre_uhash=None, instance_nonce=None)[source]

Bases: VariableContainer, MutableMapping

An mutable 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()

Remove all references to other hashables. Side effect: fixes the uhash when it depends on another hashable.

clear() None.  Remove all items from D.
property container_has_persistent_value
property container_has_runtime_value
property container_has_value
copy_without_references()

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)

Deserialize data after loading from persistent storage

Parameters:

data (dict) –

dump()

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()

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

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

Transfer data by variable or URI

get_variable_uhashes()
get_variable_uris()
get_variable_values()
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

pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

property positional_variable_values

DEPRECATED

serialize()

Serialize data before persistent storage

set_uhash_init(pre_uhash=None, instance_nonce=None)
Parameters:
setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
property uhash: UniversalHash | None
uhash_randomize()
undo_fix_uhash()
undo_randomize()
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

update_values(items)[source]
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