main.dict¶
Classes¶
IterateCombineExtendDict ¶
Combine and extend nested dictionaries with list values.
This class processes nested dictionaries where the deepest level contains lists, and combines all lists into a single flat list.
Initialize the dictionary combiner.
Source code in pyadvtools/main/dict.py
Functions¶
data_combine staticmethod ¶
dict_update ¶
Update and combine nested dictionary lists.
Processes a nested dictionary structure and combines all list values from the deepest level into a single flat list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_dict | dict[str, Any] | Nested dictionary with list values at deepest level. | required |
Returns:
| Type | Description |
|---|---|
list[Any] | List[Any]: Combined list of all values from nested structure. |
Source code in pyadvtools/main/dict.py
dict_update_iteration ¶
Recursively process nested dictionary structure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old | dict[str, Any] | Dictionary to process recursively. | required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dict[str, Any]: Processed dictionary structure. |
Source code in pyadvtools/main/dict.py
IterateSortDict ¶
Recursively sort dictionary keys using natural string ordering.
This class provides functionality to recursively sort dictionary keys at all levels of nesting using natural string ordering that handles embedded numbers properly.
Attributes:
| Name | Type | Description |
|---|---|---|
reverse | If True, sorts keys in descending order. |
Initialize the dictionary sorter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
reverse | bool | If True, sorts keys in descending order. | False |
Source code in pyadvtools/main/dict.py
Functions¶
dict_sort ¶
dict_sort_iteration ¶
dict_update ¶
Update and sort a dictionary recursively.
Sorts the dictionary keys at all levels using natural string ordering.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old | dict | Dictionary to sort. | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | dict | Dictionary with all keys sorted recursively. |
Source code in pyadvtools/main/dict.py
IterateUpdateDict ¶
Recursively update nested dictionaries.
This class provides functionality to recursively update nested dictionaries, merging new values into existing structures while preserving nested dictionary hierarchies.
Initialize the dictionary updater.
Source code in pyadvtools/main/dict.py
Functions¶
dict_add staticmethod ¶
Add new keys to dictionary.
Adds keys from new dictionary that don't exist in old dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old | dict | Dictionary to add keys to. | required |
new | dict | Dictionary containing keys to add. | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | dict | Dictionary with added keys. |
Source code in pyadvtools/main/dict.py
dict_update ¶
Update a dictionary with new values recursively.
Merges new dictionary values into the old dictionary, handling nested dictionaries by recursively updating them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old | dict | Original dictionary to update. | required |
new | dict | Dictionary containing new values to merge. | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | dict | Updated dictionary with merged values. |
Source code in pyadvtools/main/dict.py
dict_update_iteration ¶
Recursively update nested dictionary values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
old | dict | Original dictionary to update. | required |
new | dict | Dictionary with new values. | required |
Returns:
| Name | Type | Description |
|---|---|---|
dict | dict | Dictionary with recursively updated values. |