class documentation

class Parser: (source)

View In Hierarchy

Parser with additional functions for config file processing.

Method __init__ Initialize a parser.
Method clean_args Clean None values out of the arg namespace.
Method config_from_defaults Undocumented
Method convert_strings Converts strings in an args namespace to values.
Method create_initial_args Creates the initial set of args.
Method error Undocumented
Method parse_args Parses argv.
Method postprocess Postprocesses the subset of pytype_single_args that appear in args.
Instance Variable pytype_single_args Undocumented
Instance Variable _parser Undocumented
Instance Variable _pytype_arg_map Undocumented
def __init__(self, parser, pytype_single_args): (source)

Initialize a parser. Args: parser: An argparse.ArgumentParser or compatible object pytype_single_args: Iterable of args that will be passed to pytype_single

def clean_args(self, args, keys): (source)

Clean None values out of the arg namespace. This lets us check for a config file arg based on whether the None default was overwritten. Args: args: an argparse.Namespace. keys: Keys to clean if None

def config_from_defaults(self): (source)

Undocumented

def convert_strings(self, args: argparse.Namespace): (source)

Converts strings in an args namespace to values.

def create_initial_args(self, keys): (source)

Creates the initial set of args.

def error(self, message): (source)

Undocumented

def parse_args(self, argv): (source)

Parses argv. Commandline-only args are parsed normally. File-configurable args appear in the parsed args only if explicitly present in argv. Args: argv: sys.argv[1:] Returns: An argparse.Namespace.

def postprocess(self, args: argparse.Namespace): (source)

Postprocesses the subset of pytype_single_args that appear in args. Args: args: an argparse.Namespace.

pytype_single_args = (source)

Undocumented

Undocumented

_pytype_arg_map = (source)

Undocumented