brain_pipe.parser.base.Parser¶
- class Parser¶
Bases:
ABC
Base parser class to convert information into pipelines, loaders and runners.
- __init__()¶
Methods
__init__
()get_additional_kwargs
(input_, info)Find the additional arguments that should be passed to the parser.
link_loader_to_pipeline
(pipelines, loaders)Pair pipelines with their corresponding dataloaders.
set_additional_kwargs
(args)Set additional arguments for the parser.
- get_additional_kwargs(input_: Any, info: Dict[str, Any]) Dict[str, Any] ¶
Find the additional arguments that should be passed to the parser.
This function identifies additional arguments that should be passed to the parser by e.g. a CLI.
- Parameters:
input (Any) – The input that should be parsed.
info (Dict[str, Any]) – A dictionary containing available info, such as e.g. parsed CLI arguments. This information can be used to determine the additional arguments.
- Returns:
A dictionary containing the names of the arguments as keys and the options (kwargs) for a (CLI) argument parser as values.
- Return type:
Dict[str, Any]
- link_loader_to_pipeline(pipelines: Sequence[Tuple[str, Pipeline]], loaders: Dict[str, DataLoader])¶
Pair pipelines with their corresponding dataloaders.
- Parameters:
pipelines (Sequence[Tuple[str, Pipeline]]) – A dictionary containing a mapping between the name of a loader and the Pipeline object
loaders (Dict[str, DataLoader]) – A dictionary containing a mapping between the name of a loader and the DataLoader object
- Returns:
A list of tuples containing a DataLoader and its corresponding Pipeline.
- Return type:
List[Tuple[DataLoader, Pipeline]]