brain_pipe.cli.base.CLI¶
- class CLI¶
Bases:
ABC
Abstract base class for command line interfaces.
- __init__()¶
Methods
__init__
()get_parser
(cli_info)Find an appropriate parser based on the command line information.
get_run_options
(parser, cli_info)Extract a runner and Pipelines with their DataLoaders using the parser.
parse_cli_arguments
([args])Parse the command line arguments.
parse_cli_arguments_for_parser
(parser, cli_info)Parse the command line arguments.
run
([args])Run the command line interface.
- abstract get_parser(cli_info: Dict[str, Any]) Parser ¶
Find an appropriate parser based on the command line information.
- abstract get_run_options(parser: Parser, cli_info: Dict[str, Any])¶
Extract a runner and Pipelines with their DataLoaders using the parser.
- Parameters:
- Returns:
A runner and a list of tuples containing a Pipeline and its DataLoader.
- Return type:
Tuple[Runner, List[Tuple[Pipeline, DataLoader]]]
- abstract parse_cli_arguments(args: Any | None = None) Dict[str, Any] ¶
Parse the command line arguments.
- Parameters:
args (Any) – Arguments received from the command line. If None, the arguments should be parsed from sys.argv directly
- Returns:
A dictionary containing the parsed arguments.
- Return type:
Dict[str, Any]
- abstract parse_cli_arguments_for_parser(parser: Parser, cli_info: Dict[str, Any], args: Any | None = None) Dict[str, Any] ¶
Parse the command line arguments.
- Parameters:
- Returns:
A dictionary containing the parsed arguments.
- Return type:
Dict[str, Any]
- run(args: Any | None = None) List[List[Dict[str, Any]]] ¶
Run the command line interface.
- Parameters:
args (Any) – Arguments received from the command line. If None, the arguments should be parsed from sys.argv directly
- Returns:
A list of lists of data_dicts containing the results of the Pipelines.
- Return type:
List[List[Dict[str, Any]]]