mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Upgrade Mypy
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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',))
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
7
setup.py
7
setup.py
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user