mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
Merge branch 'update-mypy'
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -46,7 +46,7 @@ jobs:
|
|||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
python -m flake8 jedi setup.py
|
python -m flake8 jedi setup.py
|
||||||
python -m mypy jedi sith.py
|
python -m mypy jedi sith.py setup.py
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from jedi.inference.compiled.subprocess import CompiledSubprocess, \
|
|||||||
|
|
||||||
import parso
|
import parso
|
||||||
|
|
||||||
_VersionInfo = namedtuple('VersionInfo', 'major minor micro')
|
_VersionInfo = namedtuple('VersionInfo', 'major minor micro') # type: ignore[name-match]
|
||||||
|
|
||||||
_SUPPORTED_PYTHONS = ['3.10', '3.9', '3.8', '3.7', '3.6']
|
_SUPPORTED_PYTHONS = ['3.10', '3.9', '3.8', '3.7', '3.6']
|
||||||
_SAFE_PATHS = ['/usr/bin', '/usr/local/bin']
|
_SAFE_PATHS = ['/usr/bin', '/usr/local/bin']
|
||||||
@@ -384,8 +384,7 @@ def _get_executable_path(path, safe=True):
|
|||||||
|
|
||||||
|
|
||||||
def _get_executables_from_windows_registry(version):
|
def _get_executables_from_windows_registry(version):
|
||||||
# https://github.com/python/typeshed/pull/3794 adds winreg
|
import winreg
|
||||||
import winreg # type: ignore[import]
|
|
||||||
|
|
||||||
# TODO: support Python Anaconda.
|
# TODO: support Python Anaconda.
|
||||||
sub_keys = [
|
sub_keys = [
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ from typing import Dict, Optional
|
|||||||
from jedi.inference.names import AbstractArbitraryName
|
from jedi.inference.names import AbstractArbitraryName
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# https://github.com/python/typeshed/pull/4351 adds pydoc_data
|
from pydoc_data import topics
|
||||||
from pydoc_data import topics # type: ignore[import]
|
|
||||||
pydoc_topics: Optional[Dict[str, str]] = topics.topics
|
pydoc_topics: Optional[Dict[str, str]] = topics.topics
|
||||||
except ImportError:
|
except ImportError:
|
||||||
# Python 3.6.8 embeddable does not have pydoc_data.
|
# Python 3.6.8 embeddable does not have pydoc_data.
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ NOT_CLASS_TYPES = (
|
|||||||
MethodDescriptorType = type(str.replace)
|
MethodDescriptorType = type(str.replace)
|
||||||
WrapperDescriptorType = type(set.__iter__)
|
WrapperDescriptorType = type(set.__iter__)
|
||||||
# `object.__subclasshook__` is an already executed descriptor.
|
# `object.__subclasshook__` is an already executed descriptor.
|
||||||
object_class_dict = type.__dict__["__dict__"].__get__(object)
|
object_class_dict = type.__dict__["__dict__"].__get__(object) # type: ignore[index]
|
||||||
ClassMethodDescriptorType = type(object_class_dict['__subclasshook__'])
|
ClassMethodDescriptorType = type(object_class_dict['__subclasshook__'])
|
||||||
|
|
||||||
_sentinel = object()
|
_sentinel = object()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
Utilities for end-users.
|
Utilities for end-users.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import __main__ # type: ignore[import]
|
import __main__
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import logging
|
import logging
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ max-line-length = 100
|
|||||||
|
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
|
# Exclude our copies of external stubs
|
||||||
|
exclude = ^jedi/third_party
|
||||||
|
|
||||||
|
show_error_codes = true
|
||||||
|
enable_error_code = ignore-without-code
|
||||||
|
|
||||||
# Ensure generics are explicit about what they are (e.g: `List[str]` rather than
|
# Ensure generics are explicit about what they are (e.g: `List[str]` rather than
|
||||||
# just `List`)
|
# just `List`)
|
||||||
disallow_any_generics = True
|
disallow_any_generics = True
|
||||||
|
|||||||
5
setup.py
5
setup.py
@@ -45,7 +45,10 @@ setup(name='jedi',
|
|||||||
],
|
],
|
||||||
'qa': [
|
'qa': [
|
||||||
'flake8==5.0.4',
|
'flake8==5.0.4',
|
||||||
'mypy==0.782',
|
# latest version supporting Python 3.6
|
||||||
|
'mypy==0.971',
|
||||||
|
# Arbitrary pins, latest at the time of pinning
|
||||||
|
'types-setuptools==67.2.0.1',
|
||||||
],
|
],
|
||||||
'docs': [
|
'docs': [
|
||||||
# Just pin all of these.
|
# Just pin all of these.
|
||||||
|
|||||||
Reference in New Issue
Block a user