module documentation

Configuration for pytype (mostly derived from the commandline args). Various parts of pytype use these options. This module packages the options into an Options class.

Class Options Encapsulation of the configuration options.
Class Postprocessor Postprocesses configuration options.
Exception PostprocessingError Exception raised if Postprocessor.process() fails.
Function add_all_pytype_options Add all pytype options to the given parser.
Function add_basic_options Add basic options to the given parser.
Function add_debug_options Add debug options to the given parser.
Function add_feature_flags Add flags for experimental and temporarily gated features.
Function add_infrastructure_options Add infrastructure options to the given parser.
Function add_modes Add operation modes to the given parser.
Function add_options Undocumented
Function add_pickle_options Add options for using pickled pyi files to the given parser.
Function add_subtools Add subtools to the given parser.
Function args_map Return a map of {destination: _Arg} for all config options.
Function base_parser Use argparse to make a parser for configuration options.
Function make_parser Use argparse to make a parser for configuration options.
Function verbosity_from Sets the logging level to options.verbosity and restores it afterwards.
Constant ALL_OPTIONS Undocumented
Constant BASIC_OPTIONS Undocumented
Constant DEBUG_OPTIONS Undocumented
Constant EXPERIMENTAL_FLAGS Undocumented
Constant FEATURE_FLAGS Undocumented
Constant INFRASTRUCTURE_OPTIONS Undocumented
Constant LOG_LEVELS Undocumented
Constant MODES Undocumented
Constant PICKLE_OPTIONS Undocumented
Constant SUBTOOLS Undocumented
Variable uses Undocumented
Class _Arg Hold args for argparse.ArgumentParser.add_argument.
Function _flag Undocumented
Function _set_verbosity Set the logging verbosity.
Constant _LIBRARY_ONLY_OPTIONS Undocumented
Constant _OPT_IN_FEATURES Undocumented
def add_all_pytype_options(o): (source)

Add all pytype options to the given parser.

def add_basic_options(o): (source)

Add basic options to the given parser.

def add_debug_options(o): (source)

Add debug options to the given parser.

def add_feature_flags(o): (source)

Add flags for experimental and temporarily gated features.

def add_infrastructure_options(o): (source)

Add infrastructure options to the given parser.

def add_modes(o): (source)

Add operation modes to the given parser.

def add_options(o, arglist): (source)

Undocumented

def add_pickle_options(o): (source)

Add options for using pickled pyi files to the given parser.

def add_subtools(o): (source)

Add subtools to the given parser.

def args_map(): (source)

Return a map of {destination: _Arg} for all config options.

def base_parser(): (source)

Use argparse to make a parser for configuration options.

def make_parser(): (source)

Use argparse to make a parser for configuration options.

@contextlib.contextmanager
def verbosity_from(options): (source)

Sets the logging level to options.verbosity and restores it afterwards. If you directly call any of pytype's internal methods, like analyze.infer_types, use this contextmanager to set the logging verbosity. Consider using one of the top-level methods in pytype.io instead, which take care of this detail for you. Arguments: options: A config.Options object. Yields: Nothing.

BASIC_OPTIONS = (source)

Undocumented

Value
[_Arg('-d', '--disable',
      action='store',
      dest='disable',
      default=None,
      help='Comma-separated list of error names to ignore.'),
 _Arg('--no-report-errors',
      action='store_false', dest='report_errors', default=True, help='Don\'t rep
...
DEBUG_OPTIONS = (source)

Undocumented

Value
[_Arg('--check_preconditions',
      action='store_true',
      dest='check_preconditions',
      default=False,
      help='Enable checking of preconditions.'),
 _Arg('-m', '--main',
      action='store_true', dest='main_only', default=False, help='Only analyze t
...
EXPERIMENTAL_FLAGS = (source)

Undocumented

Value
[_flag('--enable-cached-property', False, 'Support pyglib\'s @cached.property.')
,
 _flag('--precise-return',
       False,
       'Infer precise return types even for invalid function calls.'),
 _flag('--protocols',
       False,
...
FEATURE_FLAGS = (source)

Undocumented

Value
[_flag('--always-use-return-annotations',
       False,
       'Always use function return type annotations.'),
 _flag('--overriding-parameter-count-checks',
       False,
       'Enable parameter count checks for overriding methods.'),
 _flag('--use-enum-overlay', False, 'Use the enum overlay for more precise enum 
...
INFRASTRUCTURE_OPTIONS = (source)

Undocumented

Value
[_Arg('--imports_info',
      type=str,
      action='store',
      dest='imports_map',
      default=None,
      help='Information for mapping import .pyi to files. This options is incomp
atible with --pythonpath.'),
...
LOG_LEVELS = (source)

Undocumented

Value
[logging.CRITICAL, logging.ERROR, logging.WARNING, logging.INFO, logging.DEBUG]

Undocumented

Value
[_Arg('-C', '--check',
      action='store_true',
      dest='check',
      default=None,
      help='Don\'t do type inference. Only check for type errors.'),
 _Arg('-o', '--output',
      type=str, action='store', dest='output', default=None, help='Output file. 
...
PICKLE_OPTIONS = (source)

Undocumented

Value
[_Arg('--pickle-output',
      action='store_true',
      default=False,
      dest='pickle_output',
      help='Save the ast representation of the inferred pyi as a pickled file to
 the destination filename in the --output parameter.'),
 _Arg('--use-pickled-files',
...
SUBTOOLS = (source)

Undocumented

Value
[_Arg('--generate-builtins',
      action='store',
      dest='generate_builtins',
      default=None,
      help='Precompile builtins pyi and write to the given file.'),
 _Arg('--parse-pyi',
      action='store_true', dest='parse_pyi', default=False, help='Try parsing a 
...

Undocumented

def _flag(opt, default, help_text): (source)

Undocumented

def _set_verbosity(verbosity, timestamp_logs, debug_logs): (source)

Set the logging verbosity.

_LIBRARY_ONLY_OPTIONS = (source)

Undocumented

Value
{'open_function': open, 'imports_map_items': None}
_OPT_IN_FEATURES = (source)

Undocumented

Value
[_flag('--no-return-any', False, 'Do not allow Any as a return type.')]