Upgrade Mypy

This commit is contained in:
Dave Halter
2025-06-16 16:49:46 +02:00
parent 7c27da8d68
commit d411290dff
7 changed files with 13 additions and 12 deletions

View File

@@ -21,7 +21,7 @@ try:
raise ImportError
else:
# Use colorama for nicer console output.
from colorama import Fore, init # type: ignore[import]
from colorama import Fore, init # type: ignore[import, unused-ignore]
from colorama import initialise
def _lazy_colorama_init(): # noqa: F811

View File

@@ -122,14 +122,14 @@ class InferenceState:
return value_set
# mypy doesn't suppport decorated propeties (https://github.com/python/mypy/issues/1362)
@property # type: ignore[misc]
@property
@inference_state_function_cache()
def builtins_module(self):
module_name = 'builtins'
builtins_module, = self.import_module((module_name,), sys_path=[])
return builtins_module
@property # type: ignore[misc]
@property
@inference_state_function_cache()
def typing_module(self):
typing_module, = self.import_module(('typing',))

View File

@@ -48,7 +48,7 @@ def _get_numpy_doc_string_cls():
global _numpy_doc_string_cache
if isinstance(_numpy_doc_string_cache, (ImportError, SyntaxError)):
raise _numpy_doc_string_cache
from numpydoc.docscrape import NumpyDocString # type: ignore[import]
from numpydoc.docscrape import NumpyDocString # type: ignore[import, unused-ignore]
_numpy_doc_string_cache = NumpyDocString
return _numpy_doc_string_cache

View File

@@ -80,7 +80,7 @@ class ModuleMixin(SubModuleDictMixin):
def is_stub(self):
return False
@property # type: ignore[misc]
@property
@inference_state_method_cache()
def name(self):
return self._module_name_class(self, self.string_names[-1])
@@ -138,7 +138,7 @@ class ModuleValue(ModuleMixin, TreeValue):
api_type = 'module'
def __init__(self, inference_state, module_node, code_lines, file_io=None,
string_names=None, is_package=False):
string_names=None, is_package=False) -> None:
super().__init__(
inference_state,
parent_context=None,
@@ -149,7 +149,7 @@ class ModuleValue(ModuleMixin, TreeValue):
self._path: Optional[Path] = None
else:
self._path = file_io.path
self.string_names = string_names # Optional[Tuple[str, ...]]
self.string_names: Optional[tuple[str, ...]] = string_names
self.code_lines = code_lines
self._is_package = is_package

View File

@@ -38,7 +38,7 @@ class ImplicitNamespaceValue(Value, SubModuleDictMixin):
def get_qualified_names(self):
return ()
@property # type: ignore[misc]
@property
@inference_state_method_cache()
def name(self):
string_name = self.py__package__()[-1]

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env python
from typing import cast
from setuptools import setup, find_packages
from setuptools.depends import get_module_constant
@@ -9,7 +10,7 @@ __AUTHOR__ = 'David Halter'
__AUTHOR_EMAIL__ = 'davidhalter88@gmail.com'
# Get the version from within jedi. It's defined in exactly one place now.
version = get_module_constant("jedi", "__version__")
version = cast(str, get_module_constant("jedi", "__version__"))
readme = open('README.rst').read() + '\n\n' + open('CHANGELOG.rst').read()
@@ -51,9 +52,9 @@ setup(name='jedi',
# latest version on 2025-06-16
'flake8==7.2.0',
# latest version supporting Python 3.6
'mypy==0.971',
'mypy==1.16',
# Arbitrary pins, latest at the time of pinning
'types-setuptools==67.2.0.1',
'types-setuptools==80.9.0.20250529',
],
'docs': [
# Just pin all of these.

View File

@@ -44,7 +44,7 @@ Options:
--pudb Launch pudb when error is raised.
"""
from docopt import docopt # type: ignore[import]
from docopt import docopt # type: ignore[import, unused-ignore]
import json
import os