coma.config
All config utilities.
Module Attributes
General config utilities.
- default_id(config: Any) str [source]
Returns the default identifier of
config
.The default identifier is derived from
config
’stype
name.- Parameters
config – Any valid
omegaconf
config- Returns
The default identifier of
config
- default_dest(config_id: str) str [source]
Returns the default file path parser argument destination of
config_id
.Returns the default value for the
dest
keyword argument to add_argument() that will define the file path parser argument corresponding toconfig_id
. This will also be the attribute of thenamespace
return object (first return value) of parse_known_args().- Parameters
config_id – A config identifier
- Returns
The default file path parser argument attribute of
config_id
- default_default(config_id: str) str [source]
Returns the default file path parser argument default value for
config_id
.Returns the default value for the
default
keyword argument to add_argument() that will define the file path parser argument corresponding toconfig_id
.- Parameters
config_id – A config identifier
- Returns
The default file path parser argument default value for
config_id
- default_flag(config_id: str) str [source]
Returns the default file path parser argument flag value for
config_id
.Returns the default value for the
names_or_flags
variadic argument to add_argument() that will define the file path parser argument corresponding toconfig_id
.- Parameters
config_id – A config identifier
- Returns
The default file path parser argument flag value for
config_id
- default_help(config_id: str) str [source]
Returns the default file path parser argument help value for
config_id
.Returns the default value for the
help
keyword argument to add_argument() that will define the file path parser argument corresponding toconfig_id
.- Parameters
config_id – A config identifier
- Returns
The default file path parser argument help value for
config_id
- to_dict(*configs: Union[Any, Tuple[str, Any]]) Dict[str, Any] [source]
Converts configs provided in raw format to dictionary format.
configs
should be of the form<conf>
or(<id>, <conf>)
, where<conf>
represents a config and<id>
is any identifier for the config. If<id>
is omitted, an identifier is derived from<conf>
’stype
name usingdefault_id()
. That is, specifying just<conf>
is a shorthand for(default_id(<conf>), <conf>)
.Note
For each
register()
ed command, both global and local config identifiers need to be unique for that command.- Returns
Configs as a dictionary with
<id>
keys and<conf>
values.Note
The dictionary is guaranteed to be insertion-ordered (even in Python < 3.7).
See also