StateDictManager#

class brainstate.StateDictManager(*args, **kwargs)#

State stack, for collecting all State used in the program.

StateDictManager supports all features of python dict.

assign_values(*args)[source]#

Assign the value for each element according to the given data.

Return type:

None

collect_values()[source]#

Collect the values by the given types.

Return type:

Dict

split(first, *others)[source]#

Split the DictManager into multiple based on value types.

Parameters:

*types (Type) – Types to use for splitting. Each type gets its own DictManager.

Returns:

A tuple of DictManagers, one for each type plus one for unmatched items.

Return type:

Tuple[StateDictManager, ...]

split_values(*filters)[source]#

Split the values into several subsets of stack by the given types.

Return type:

Tuple[Dict, ...]

to_dict_values()[source]#

Convert the values into a dict.

Return type:

Dict