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

__init__(values=None)[source]
Parameters:

values (Dict[str, Any] | None) –

Return type:

None

clear()[source]

Clears the dictionary

copy()[source]

Returns a shallow copy of the dictionary.

copy_dict()[source]

Returns a shallow copy of the dictionary.

Return type:

dict

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, if default is set then default.

Return type:

Any

Raises:

KeyError – If key is not found and default is not set.

has(key)[source]

Gets if a key exist in the instance

Parameters:

key (str) – key

Returns:

True if key exist; Otherwise False

Return type:

bool

items()[source]

Returns all items in the dictionary in a set like object.

keys()[source]

Returns all keys in the dictionary in a set like object.

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 a key already exist then its value will be over written; Otherwise value will not be over written. Defaults to True.

Returns:

True if values is written; Otherwise, False

Return type:

bool

update(other)[source]

Update dictionary with another dictionary.

Parameters:

other (dict, TheDict, DotDict) – Dictionary to update with.

values()[source]

Returns an object providing a view on the dictionary’s values.

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:

TheDict