SharedStateDictionaryView¶
-
class
narupatools.state.view.dictionary_view.SharedStateDictionaryView(dictionary: MutableMapping[str, Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping]], /)¶ Represents a view of a shared state dictionary.
Inheritance

Methods
Create a view of a shared state dictionary, exposing the values as references.
Remove all keys in this dictionary.
Get a collection view for all keys with the given prefix.
Get a reference to a specific key.
Get the current value, and apply changes after it is modified.
Insert a value into the shared state.
Return a snapshot of each of the current items in this collection.
Update a value by adding the provided key-value pairs.
-
__init__(dictionary: MutableMapping[str, Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping]], /)¶ Create a view of a shared state dictionary, exposing the values as references.
- Parameters
dictionary – Shared state dictionary that implements getting, updating and removing keys.
-
collection(prefix: str, /) → narupatools.state.view.collection_view.SharedStateCollectionView[Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping]]¶ -
collection(prefix: str, snapshot_type: Type[TSerializableObjectType], /) → narupatools.state.view.collection_view.SharedStateCollectionView[TSerializableObjectType] Get a collection view for all keys with the given prefix.
-
get(key: str, /) → narupatools.state.view.reference.SharedStateReference[Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping]]¶ -
get(key: str, snapshot_type: Type[TSerializableObjectType], /) → narupatools.state.view.reference.SharedStateReference[TSerializableObjectType] Get a reference to a specific key.
-
items() → a set-like object providing a view on D’s items¶
-
keys() → a set-like object providing a view on D’s keys¶
-
modify(key: str, /) → Generator[TValue, None, None]¶ Get the current value, and apply changes after it is modified.
-
set(key: str, snapshot: TValue, /) → narupatools.state.view.reference.SharedStateReference[TValue]¶ Insert a value into the shared state.
-
update(key: str, /, **kwargs: Union[None, str, int, float, bool, narupatools.state.typing.SerializableIterable, narupatools.state.typing.SerializableMapping]) → narupatools.state.view.reference.SharedStateReference[TValue]¶ Update a value by adding the provided key-value pairs.
This only works if the value supports keyword assignment.
- Parameters
key – Key to modify.
kwargs – Values to add to the value.
-
values() → an object providing a view on D’s values¶
-