planemo.autopygen.source_file_parsing package
Submodules
planemo.autopygen.source_file_parsing.constants module
planemo.autopygen.source_file_parsing.decoy_parser module
Bases:
Exception
- class planemo.autopygen.source_file_parsing.decoy_parser.DecoyParser(name='default')[source]
Bases:
ArgumentParserDecoy class that is injected into code that initializes parser It removes dependency on the internal representation of actions
planemo.autopygen.source_file_parsing.local_module_parsing module
Module responsible for resolving assignments and constant list comprehensives used in argument parser
- class planemo.autopygen.source_file_parsing.local_module_parsing.UnknownNamesRemoval(unknown: Set[str])[source]
Bases:
NodeVisitorRemoves unknown names that can’t be resolved and replaces them with a constant string that can be detected by linter
Attributes —
- unknown: Set[str]
set of names that represent variables used in parser initialization, that have not been resolved yet
- planemo.autopygen.source_file_parsing.local_module_parsing.handle_local_module_names(actions: List[stmt], unknown_names: Set[str]) Module[source]
Function used to remove assignments and list comprehensions which can’t be resolved
Parameters
- actions: List[ast.stmt]
list of actions extracted so far
- unknown_names:
set of unknown names that have to be extracted
Returns
Python module containing assignments and list comprehensions whose values are based on constants.py
planemo.autopygen.source_file_parsing.parser_discovery_and_init module
Module responsible for discovery of import statements importing Argument parser and discovery of the statements initializing the parser itself
- class planemo.autopygen.source_file_parsing.parser_discovery_and_init.ArgumentCreationDiscovery(actions: List[stmt], main_name: str)[source]
Bases:
DiscoveryClass responsible for extraction of statements which initialize the input arguments. It is able to extract function calls on the original parser, and on the argument groups extracted by GroupDiscovery
- class planemo.autopygen.source_file_parsing.parser_discovery_and_init.GroupAndSubparsersDiscovery(actions: List[stmt], known_names: Set[str], main_name: str)[source]
Bases:
DiscoveryClass responsible for discovery of statements that initialize argument groups and subparsers
- class planemo.autopygen.source_file_parsing.parser_discovery_and_init.ImportDiscovery(actions: List[stmt])[source]
Bases:
DiscoveryClass responsible for discovery and extraction of import statements
- class planemo.autopygen.source_file_parsing.parser_discovery_and_init.SimpleParserDiscoveryAndReplacement(actions: List[stmt], argparse_alias: str, argument_parser_alias: str, custom_parser_def: ClassDef)[source]
Bases:
DiscoveryClass responsible for discovery of ArgumentParser creation and assignment, and replacement of the class definition by the one supplied through constructor
- planemo.autopygen.source_file_parsing.parser_discovery_and_init.get_parser_init_and_actions(source: Module) Tuple[List[stmt], str, Set[str]][source]
- Function used to extract necessary imports, parser and argument creation
function calls
Parameters
- sourceast.Module
source file parsed into ATT
Returns
List of extracted AST nodes, the main name of the parser and a set of section names
planemo.autopygen.source_file_parsing.parsing_commons module
Module containing the parent class of Dicovery classes
- class planemo.autopygen.source_file_parsing.parsing_commons.CustomAST(*args: Any, **kwargs: Any)[source]
Bases:
stmt
- class planemo.autopygen.source_file_parsing.parsing_commons.CustomVisitor[source]
Bases:
NodeVisitor,ABC
- class planemo.autopygen.source_file_parsing.parsing_commons.Discovery(actions: List[stmt])[source]
Bases:
CustomVisitor,ABC
planemo.autopygen.source_file_parsing.parsing_exceptions module
Module containing Exceptions that can be raised during param discovery
- exception planemo.autopygen.source_file_parsing.parsing_exceptions.ArgParseImportNotFound[source]
Bases:
ArgumentParsingDiscoveryErrorException raised in case ArgParser was not imported
- exception planemo.autopygen.source_file_parsing.parsing_exceptions.ArgParserNotUsed[source]
Bases:
ArgumentParsingDiscoveryErrorException raised in case no uses of argument parser were found
- exception planemo.autopygen.source_file_parsing.parsing_exceptions.ArgumentParsingDiscoveryError[source]
Bases:
ExceptionException for general error encountered during param extraction
planemo.autopygen.source_file_parsing.unknown_names_discovery module
Module containing discovery classes used to find names (assignments to variables) that have not been extracted yet
- class planemo.autopygen.source_file_parsing.unknown_names_discovery.UnknownNameInit(unknown_names: Set[str])[source]
Bases:
CustomVisitorClass used to initialize unknown names
- class planemo.autopygen.source_file_parsing.unknown_names_discovery.UnknownNamesDiscovery(known_names: Set[str])[source]
Bases:
CustomVisitorDiscovery class used to find names that have not been initialized yet but are necessary for correct argument parser init
- planemo.autopygen.source_file_parsing.unknown_names_discovery.initialize_variables_in_module(original_module: Module, parser_name: str, actions: List[stmt], imported_names: Set[str]) Tuple[List[stmt], Set[str]][source]
Function used to initialize variables that have constant values
Parameters
- original_moduleast.Module
AST of the original source file
- parser_namestr
default name of the parser
- actionsList[ast.stmt]
list of actions extracted so far
- imported_namesSet[str]
list of names imported from modules
Returns
List containing newly extracted actions and new unknown names
Module contents
Subpackage containing functions used for parameter extraction from source files