ml_collections.config_flags.config_flags.GetType¶
-
ml_collections.config_flags.config_flags.
GetType
(config_path: str, config: Any, normalize=True)¶ Gets type of field in config described by a config_path.
- Example usage:
>>> config = {'a': {'b', {'c', 10}}} >>> assert config_path.get_type('a.b.c', config) is int
Parameters: - config_path – Any string that split can process.
- config – A nested datastructure
- normalize – whether to normalize the type (in particular
- Optional annotations on dataclass fields) (strip) –
Returns: The type of last object when walking config with config_path.
Raises: IndexError
– Integer field not found in nested structure.KeyError
– Non-integer field not found in nested structure.ValueError
– Empty/invalid config_path after parsing.TypeError
– Ambiguous type annotation on dataclass field.