coma.config
All config utilities.
Sub-Modules
Module Attributes
General config utilities.
- default_id(config: Any) str[source]
Returns the default identifier of
config.The default identifier is derived from
config’stypename.- Parameters:
config – Any valid
omegaconfconfig- 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
destkeyword argument to add_argument() that will define the file path parser argument corresponding toconfig_id. This will also be the attribute of thenamespacereturn 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
defaultkeyword 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_flagsvariadic 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
helpkeyword 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: Any | Tuple[str, Any]) Dict[str, Any][source]
Converts configs provided in raw format to dictionary format.
configsshould 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>’stypename 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