module documentation
(source)

Mypy type checker command line tool.
Class ​Augmented​Help​Formatter Undocumented
Class ​Capturable​Argument​Parser Override ArgumentParser methods that use sys.stdout/sys.stderr directly.
Class ​Capturable​Version​Action Supplement CapturableArgumentParser to handle --version.
Class ​Python​Executable​Inference​Error Represents a failure to infer the version or executable while searching.
Function fail Fail with a serious error.
Function infer​_python​_executable Infer the Python executable from the given version.
Function install​_types Install stub packages using pip if some missing stubs were detected.
Function invert​_flag​_name Undocumented
Function main Main entry point to the type checker.
Function maybe​_write​_junit​_xml Undocumented
Function process​_cache​_map Validate cache_map and copy into options.cache_map.
Function process​_options Parse command line arguments.
Function process​_package​_roots Validate and normalize package_root.
Function python​_executable​_prefix Undocumented
Function read​_types​_packages​_to​_install Undocumented
Function run​_build Undocumented
Function show​_messages Undocumented
Function stat​_proxy Undocumented
Constant DESCRIPTION Undocumented
Constant flag​_prefix​_map Undocumented
Constant flag​_prefix​_pairs Undocumented
Constant FOOTER Undocumented
Constant HEADER Undocumented
Constant MEM​_PROFILE Undocumented
Function _python​_executable​_from​_version Undocumented
def fail(msg, stderr, options): (source)
Fail with a serious error.
Parameters
msg:strUndocumented
stderr:TextIOUndocumented
options:OptionsUndocumented
def infer_python_executable(options, special_opts): (source)

Infer the Python executable from the given version.

This function mutates options based on special_opts to infer the correct Python executable to use.

Parameters
options:OptionsUndocumented
special​_opts:argparse.NamespaceUndocumented
def install_types(formatter, options, *, after_run=False, non_interactive=False): (source)
Install stub packages using pip if some missing stubs were detected.
Parameters
formatter:util.FancyFormatterUndocumented
options:OptionsUndocumented
after​_run:boolUndocumented
non​_interactive:boolUndocumented
Returns
boolUndocumented
def invert_flag_name(flag): (source)

Undocumented

Parameters
flag:strUndocumented
Returns
strUndocumented
def main(script_path, stdout, stderr, args=None, clean_exit=False): (source)

Main entry point to the type checker.

Args:

script_path: Path to the 'mypy' script (used for finding data files). args: Custom command-line arguments. If not given, sys.argv[1:] will

be used.
clean_exit: Don't hard kill the process on exit. This allows catching
SystemExit.
Parameters
script​_path:Optional[str]Undocumented
stdout:TextIOUndocumented
stderr:TextIOUndocumented
args:Optional[List[str]]Undocumented
clean​_exit:boolUndocumented
def maybe_write_junit_xml(td, serious, messages, options): (source)

Undocumented

Parameters
td:floatUndocumented
serious:boolUndocumented
messages:List[str]Undocumented
options:OptionsUndocumented
def process_cache_map(parser, special_opts, options): (source)
Validate cache_map and copy into options.cache_map.
Parameters
parser:argparse.ArgumentParserUndocumented
special​_opts:argparse.NamespaceUndocumented
options:OptionsUndocumented
def process_options(args, stdout=None, stderr=None, require_targets=True, server_options=False, fscache=None, program='mypy', header=HEADER): (source)

Parse command line arguments.

If a FileSystemCache is passed in, and package_root options are given, call fscache.set_package_root() to set the cache's package root.

Parameters
args:List[str]Undocumented
stdout:Optional[TextIO]Undocumented
stderr:Optional[TextIO]Undocumented
require​_targets:boolUndocumented
server​_options:boolUndocumented
fscache:Optional[FileSystemCache]Undocumented
program:strUndocumented
header:strUndocumented
Returns
Tuple[List[BuildSource], Options]Undocumented
def process_package_roots(fscache, parser, options): (source)
Validate and normalize package_root.
Parameters
fscache:Optional[FileSystemCache]Undocumented
parser:argparse.ArgumentParserUndocumented
options:OptionsUndocumented
def python_executable_prefix(v): (source)

Undocumented

Parameters
v:strUndocumented
Returns
List[str]Undocumented
def read_types_packages_to_install(cache_dir, after_run): (source)

Undocumented

Parameters
cache​_dir:strUndocumented
after​_run:boolUndocumented
Returns
List[str]Undocumented
def run_build(sources, options, fscache, t0, stdout, stderr): (source)

Undocumented

Parameters
sources:List[BuildSource]Undocumented
options:OptionsUndocumented
fscache:FileSystemCacheUndocumented
t0:floatUndocumented
stdout:TextIOUndocumented
stderr:TextIOUndocumented
Returns
Tuple[Optional[build.BuildResult], List[str], bool]Undocumented
def show_messages(messages, f, formatter, options): (source)

Undocumented

Parameters
messages:List[str]Undocumented
f:TextIOUndocumented
formatter:util.FancyFormatterUndocumented
options:OptionsUndocumented
def stat_proxy(path): (source)

Undocumented

Parameters
path:strUndocumented
Returns
os.stat_resultUndocumented
DESCRIPTION: str = (source)

Undocumented

Value
'''
Mypy is a program that will type check your Python code.

Pass in any files or folders you want to type check. Mypy will
recursively traverse any provided folders to find .py files:

    $ mypy my_program.py my_src_folder
...
flag_prefix_map: Dict[str, str] = (source)

Undocumented

Value
{}
flag_prefix_pairs: list = (source)

Undocumented

Value
[('allow', 'disallow'), ('show', 'hide')]
FOOTER: str = (source)

Undocumented

Value
'''Environment variables:
  Define MYPYPATH for additional module search path entries.
  Define MYPY_CACHE_DIR to override configuration cache_dir path.'''
HEADER: str = (source)

Undocumented

Value
'''%(prog)s [-h] [-v] [-V] [more options; see below]
            [-m MODULE] [-p PACKAGE] [-c PROGRAM_TEXT] [files ...]'''
MEM_PROFILE: bool = (source)

Undocumented

Value
False
def _python_executable_from_version(python_version): (source)

Undocumented

Parameters
python​_version:Tuple[int, int]Undocumented
Returns
strUndocumented