Module the_dictionary_partial
- class ooodev.utils.partial.the_dictionary_partial.TheDict(values=None)[source]
A partial class for implementing dictionary values
- Parameters:
values (Dict[str, Any] | None) –
- get(key, default=<ooodev.utils.gen_util._null_obj object>)[source]
Gets user data from event.
- Parameters:
key (str) – Key used to store data
default (Any, optional) – Default value to return if
key
is not found.
- Returns:
Data for
key
if found; Otherwise, ifdefault
is set thendefault
.- Return type:
Any
- Raises:
KeyError – If
key
is not found anddefault
is not set.
- has(key)[source]
Gets if a key exist in the instance
- Parameters:
key (str) – key
- Returns:
True
if key exist; OtherwiseFalse
- Return type:
bool
- remove(key)[source]
Removes key value pair from instance
- Parameters:
key (str) – key
- Returns:
True
if key was found and removed; Otherwise,False
- Return type:
bool
- set(key, value, allow_overwrite=True)[source]
Sets a key value pair for event instance.
- Parameters:
key (str) – Key
value (Any) – Value
allow_overwrite (bool, optional) – If
True
and akey
already exist then itsvalue
will be over written; Otherwisevalue
will not be over written. Defaults toTrue
.
- Returns:
True
if values is written; Otherwise,False
- Return type:
bool
- class ooodev.utils.partial.the_dictionary_partial.TheDictionaryPartial(values=None)[source]
A partial class for implementing dictionary values
- Parameters:
values (Dict[str, Any] | None) –
- __init__(values=None)[source]
Constructor
- Parameters:
values (Dict[str, Any] | None, optional) – Dictionary Values. Defaults to None.
- Return type:
None
- property extra_data: TheDict
Extra Data Key Value Pair Dictionary.
Properties can be assigned properties and access like a dictionary and with dot notation.
Note
This is a dictionary object that can be used to store key value pairs. Generally speaking this data is not part of the object’s main data structure and is not saved with the object (document).
This property is used to store data that is not part of the object’s main data structure and can be used however the developer sees fit.
- Return type: