Ejemplo n.º 1
0
    def start_analysis(self, main_file_path,
                       imported_file_paths: Iterable[str]) -> None:
        self.interesting_files = [main_file_path] + list(imported_file_paths)

        args = [
            get_interpreter_for_subprocess(),
            "-m",
            "mypy",
            "--ignore-missing-imports",
            "--check-untyped-defs",
            "--warn-redundant-casts",
            "--warn-unused-ignores",
            "--show-column-numbers",
            main_file_path,
        ] + list(imported_file_paths)

        logger.debug("Running mypy: %s", " ".join(args))

        # TODO: ignore "... need type annotation" messages

        from mypy.version import __version__

        try:
            ver = tuple(map(int, __version__.split(".")))
        except Exception:
            ver = (0, 470)  # minimum required version

        if ver >= (0, 520):
            args.insert(3, "--no-implicit-optional")

        if ver >= (0, 590):
            args.insert(3, "--python-executable")
            args.insert(4, get_runner().get_local_executable())

        if ver >= (0, 730):
            args.insert(3, "--warn-unreachable")
            args.insert(3, "--allow-redefinition")
            args.insert(3, "--strict-equality")
            args.insert(3, "--no-color-output")
            args.insert(3, "--no-error-summary")

        env = os.environ.copy()
        mypypath = get_workbench().get_option("assistance.mypypath")
        if mypypath:
            env["MYPYPATH"] = mypypath

        self._proc = ui_utils.popen_with_ui_thread_callback(
            args,
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True,
            env=env,
            on_completion=self._parse_and_output_warnings,
            # Specify a cwd which is not ancestor of user files.
            # This gives absolute filenames in the output.
            # Note that mypy doesn't accept when cwd is sys.prefix
            # or dirname(sys.executable)
            cwd=os.path.dirname(__file__),
        )
Ejemplo n.º 2
0
Archivo: conf.py Proyecto: srittau/mypy
# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'mypy'
copyright = u'2012-2022 Jukka Lehtosalo and mypy contributors'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = mypy_version.split('-')[0]
# The full version, including alpha/beta/rc tags.
release = mypy_version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Ejemplo n.º 3
0
Archivo: conf.py Proyecto: Diggsey/mypy
# The encoding of source files.
#source_encoding = 'utf-8-sig'

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'Mypy'
copyright = u'2016, Jukka Lehtosalo'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = mypy_version.split('-')[0]
# The full version, including alpha/beta/rc tags.
release = mypy_version

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#language = None

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
#today = ''
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.