recap package¶
The recap package. The most important classes, CfgNode and URI are available as top-level exports.
Submodules¶
recap.config module¶
Configuration management by extending yacs.config.CfgNode.
- class recap.config.CfgNode(init_dict=None, key_list=None, new_allowed=False)¶
Bases:
CfgNodeA subclass of yacs’ CfgNode that additionally implements inheritance of configuration files and is compatible with recap URIs.
- dump(**kwargs)¶
Dump to a string.
- classmethod load_yaml_with_base(filename: PathLike) CfgNode¶
Load a YAML configuration file that may inherit from other YAML files.
- Parameters:
filename (os.PathLike) – the path to the YAML file (can be a recap URI)
- Returns:
the loaded configuration
- Return type:
- merge_with_dict(overrides: Dict[str, Any])¶
Merge a dict of configurations into this configuration object.
The dict must contain string keys. The configuration hierarchy is accessed using the “.” delimiter.
- Parameters:
overrides (Dict[str, Any]) – the dict of configurations to merge (overwrite)
- params_dict() Dict[str, Any]¶
Obtain a key-value map representing the configuration settings.
The keys use the “.” delimiter to denote going down a level in the configuration hierarchy.
- Returns:
the map
- Return type:
Dict[str, Any]
recap.path_manager module¶
Module for conveniently managing paths through the URI class which is fully compatible with pathlib.Path.
- recap.path_manager.PathManager: PathManagerBase = <ObjectProxy at 0x7f1cffd47940 for PathManagerBase>¶
The public path manager instance.
- class recap.path_manager.PathManagerBase¶
Bases:
objectBase class for a path manager.
This class simultaneously acts as a context manager for the currently active path manager of the
URIclass.- register_handler(scheme: str) Callable[[PathTranslator], PathTranslator]¶
Decorator to register a path handler for a given URI scheme.
- Parameters:
scheme (str) – the scheme
- Returns:
the decorated function
- Return type:
callable
- resolve(path: PathLike) Path¶
Resolve a path (which might be a
pathlib.Path) to a local path.- Parameters:
path (os.PathLike) – the path
- Returns:
the corresponding local path
- Return type:
Path
- class recap.path_manager.PathTranslator¶
Bases:
ABCAbstract class representing a path translator that can translate a specific type of URIs to local paths.
- class recap.path_manager.URI(*args, **kwargs)¶
Bases:
_URIBaseA class representing a recap URI that is lazily evaluated to a local path when it is used.
It is fully compatible with
pathlib.Path.- is_absolute() bool¶
True if the path is absolute (has both a root and, if applicable, a drive).
- recap.path_manager.register_translator(scheme: str, path: Path)¶
Convenience method to register a path translator that forwards a URI scheme to a local path.
- Parameters:
scheme (str) – the URI scheme
path (Path) – the local path