1
0
forked from VimPlug/jedi

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

@@ -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]