graphcast.util.misc
¶
Miscellaneous utility functions.
This module provides various utility functions for data manipulation and processing.
Key Functions
- sorted_dicts: Recursively sort dictionaries and lists for consistent ordering
sorted_dicts(d)
¶
Recursively sort dictionaries and lists for consistent ordering.
This function recursively sorts dictionaries and lists to ensure consistent ordering of data structures. It handles nested structures and preserves non-collection values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
d
|
Data structure to sort (dict, list, tuple, or other) |
required |
Returns:
Type | Description |
---|---|
The sorted data structure with consistent ordering |
Example
data = {"b": 2, "a": 1, "c": [3, 1, 2]} sorted_dicts(data)