Generate mypy options using the flag passed by user.
(stubgen_options: Options)
| 1712 | |
| 1713 | |
| 1714 | def 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 | |
| 1736 | def parse_source_file(mod: StubSource, mypy_options: MypyOptions) -> None: |
searching dependent graphs…