unienv_interface.utils.dict_util¶
flatten_keys_in_mapping
¶
flatten_keys_in_mapping(d: Union[Mapping[str, Any], DictSpace], nested_separator: str = '/') -> Union[Mapping[str, Any], DictSpace]
Flattens the keys of a nested dictionary or DictSpace. For example, {'a': {'b': 1}} will be flattened to {'a.b': 1}. Input: d : Union[Mapping[str, Any], DictSpace] Output: Union[Mapping[str, Any], DictSpace]
unflatten_keys_in_mapping
¶
unflatten_keys_in_mapping(d: Union[Mapping[str, Any], DictSpace], nested_separator: str = '/') -> Union[Mapping[str, Any], DictSpace]
Unflattens the keys of a dictionary or DictSpace that were flattened using the flatten_keys function. For example, {'a.b': 1} will be unflattened to {'a': {'b': 1}}. Input: d : Union[Mapping[str, Any], DictSpace] Output: Union[Mapping[str, Any], DictSpace]