MCPcopy Index your code
hub / github.com/python/mypy / mypy_options

Function mypy_options

mypy/stubgen.py:1714–1733  ·  view source on GitHub ↗

Generate mypy options using the flag passed by user.

(stubgen_options: Options)

Source from the content-addressed store, hash-verified

1712
1713
1714def mypy_options(stubgen_options: Options) -> MypyOptions:
1715 """Generate mypy options using the flag passed by user."""
1716 options = MypyOptions()
1717 options.follow_imports = "skip"
1718 options.incremental = False
1719 options.ignore_errors = True
1720 options.semantic_analysis_only = True
1721 options.python_version = stubgen_options.pyversion
1722 options.show_traceback = True
1723 options.transform_source = remove_misplaced_type_comments
1724 options.preserve_asts = True
1725 options.include_docstrings = stubgen_options.include_docstrings
1726
1727 # Override cache_dir if provided in the environment
1728 environ_cache_dir = os.getenv("MYPY_CACHE_DIR", "")
1729 if environ_cache_dir.strip():
1730 options.cache_dir = environ_cache_dir
1731 options.cache_dir = os.path.expanduser(options.cache_dir)
1732
1733 return options
1734
1735
1736def parse_source_file(mod: StubSource, mypy_options: MypyOptions) -> None:

Callers 4

test_files_foundMethod · 0.90
test_packages_foundMethod · 0.90
test_module_not_foundMethod · 0.90
generate_stubsFunction · 0.85

Calls 1

stripMethod · 0.80

Tested by 3

test_files_foundMethod · 0.72
test_packages_foundMethod · 0.72
test_module_not_foundMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…