sshmitm.moduleparser.parser module

BaseModule parsing library

This module is an extension to the standard Argparse module, which offers the possibility to load to load classes as BaseModule.

This module contains the following public classes:

  • ModuleParser – entry point to parse command line parameters.

    This class provides the same functionality as the ArgumentParser from the argparse module. However, it is possible to specify BaseModules and Plugins, which extend the functionality of the parser and the application respectively.

  • BaseModule – base class for BaseModules that can be used in the application.

    All BaseModules must be derived from this class. If a module does not originate from this class, a ModuleError occurs.

  • ModuleError – Exception thrown when errors occur when initializing modules or plugins.

    This exception is thrown when an error has occurred. Details can be found in the exception.

All other classes and functions in this module are either legacy or are implementation specific and should not be used in production applications.

class sshmitm.moduleparser.parser.ModuleParser(*args, config=None, **kwargs)

Bases: BaseModuleArgumentParser

Parameters:
  • args (Any) –

  • config (Optional[ConfigParser], default: None) –

  • kwargs (Any) –

CONFIG_LOADED = False
add_config_arg()
Return type:

None

add_module(*args, **kwargs)
Parameters:
  • args (Any) –

  • kwargs (Any) –

Return type:

None

execute_subcommand(name, args)
Parameters:
  • name (str) –

  • args (Namespace) –

Return type:

None

load_subcommands()
Return type:

None

parse_args(args=None, namespace=None)
Parameters:
  • args (Optional[Sequence[str]], default: None) –

  • namespace (Optional[Namespace], default: None) –

Return type:

Namespace

parse_known_args(args=None, namespace=None)
Parameters:
  • args (Optional[Sequence[str]], default: None) –

  • namespace (Optional[Namespace], default: None) –

Return type:

Tuple[Namespace, List[str]]

subcommand: Optional['argparse._SubParsersAction[ModuleParser]']