mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 06:24:27 +08:00
Removed various 3.3/3.4/3.5 references
This commit is contained in:
@@ -14,7 +14,6 @@ These classes are the much biggest part of the API, because they contain
|
|||||||
the interesting information about all operations.
|
the interesting information about all operations.
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
from parso.python.tree import search_ancestor
|
from parso.python.tree import search_ancestor
|
||||||
@@ -918,8 +917,4 @@ class ParamName(Name):
|
|||||||
|
|
||||||
:rtype: :py:attr:`inspect.Parameter.kind`
|
:rtype: :py:attr:`inspect.Parameter.kind`
|
||||||
"""
|
"""
|
||||||
if sys.version_info < (3, 5):
|
|
||||||
raise NotImplementedError(
|
|
||||||
'Python 2 is end-of-life, the new feature is not available for it'
|
|
||||||
)
|
|
||||||
return self._name.get_kind()
|
return self._name.get_kind()
|
||||||
|
|||||||
@@ -464,9 +464,6 @@ class DirectObjectAccess(object):
|
|||||||
"""
|
"""
|
||||||
Returns Tuple[Optional[str], Tuple[AccessPath, ...]]
|
Returns Tuple[Optional[str], Tuple[AccessPath, ...]]
|
||||||
"""
|
"""
|
||||||
if sys.version_info < (3, 5):
|
|
||||||
return None, ()
|
|
||||||
|
|
||||||
name = None
|
name = None
|
||||||
args = ()
|
args = ()
|
||||||
if safe_getattr(self._obj, '__module__', default='') == 'typing':
|
if safe_getattr(self._obj, '__module__', default='') == 'typing':
|
||||||
@@ -505,8 +502,6 @@ class DirectObjectAccess(object):
|
|||||||
|
|
||||||
def _get_signature(self):
|
def _get_signature(self):
|
||||||
obj = self._obj
|
obj = self._obj
|
||||||
if py_version < 33:
|
|
||||||
raise ValueError("inspect.signature was introduced in 3.3")
|
|
||||||
try:
|
try:
|
||||||
return inspect.signature(obj)
|
return inspect.signature(obj)
|
||||||
except (RuntimeError, TypeError):
|
except (RuntimeError, TypeError):
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ not any actual importing done. This module is about finding modules in the
|
|||||||
filesystem. This can be quite tricky sometimes, because Python imports are not
|
filesystem. This can be quite tricky sometimes, because Python imports are not
|
||||||
always that simple.
|
always that simple.
|
||||||
|
|
||||||
This module uses imp for python up to 3.2 and importlib for python 3.3 on; the
|
|
||||||
correct implementation is delegated to _compatibility.
|
|
||||||
|
|
||||||
This module also supports import autocompletion, which means to complete
|
This module also supports import autocompletion, which means to complete
|
||||||
statements like ``from datetim`` (cursor at the end would return ``datetime``).
|
statements like ``from datetim`` (cursor at the end would return ``datetime``).
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -330,8 +330,6 @@ class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
|
|||||||
|
|
||||||
if is_coroutine:
|
if is_coroutine:
|
||||||
if self.is_generator():
|
if self.is_generator():
|
||||||
if inference_state.environment.version_info < (3, 6):
|
|
||||||
return NO_VALUES
|
|
||||||
async_generator_classes = inference_state.typing_module \
|
async_generator_classes = inference_state.typing_module \
|
||||||
.py__getattribute__('AsyncGenerator')
|
.py__getattribute__('AsyncGenerator')
|
||||||
|
|
||||||
@@ -339,13 +337,10 @@ class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
|
|||||||
# The contravariant doesn't seem to be defined.
|
# The contravariant doesn't seem to be defined.
|
||||||
generics = (yield_values.py__class__(), NO_VALUES)
|
generics = (yield_values.py__class__(), NO_VALUES)
|
||||||
return ValueSet(
|
return ValueSet(
|
||||||
# In Python 3.6 AsyncGenerator is still a class.
|
|
||||||
GenericClass(c, TupleGenericManager(generics))
|
GenericClass(c, TupleGenericManager(generics))
|
||||||
for c in async_generator_classes
|
for c in async_generator_classes
|
||||||
).execute_annotation()
|
).execute_annotation()
|
||||||
else:
|
else:
|
||||||
if inference_state.environment.version_info < (3, 5):
|
|
||||||
return NO_VALUES
|
|
||||||
async_classes = inference_state.typing_module.py__getattribute__('Coroutine')
|
async_classes = inference_state.typing_module.py__getattribute__('Coroutine')
|
||||||
return_values = self.get_return_values()
|
return_values = self.get_return_values()
|
||||||
# Only the first generic is relevant.
|
# Only the first generic is relevant.
|
||||||
|
|||||||
@@ -131,15 +131,7 @@ def safe_literal_eval(value):
|
|||||||
# manually, but that's right now not implemented.
|
# manually, but that's right now not implemented.
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
try:
|
|
||||||
return literal_eval(value)
|
return literal_eval(value)
|
||||||
except SyntaxError:
|
|
||||||
# It's possible to create syntax errors with literals like rb'' in
|
|
||||||
# Python 2. This should not be possible and in that case just return an
|
|
||||||
# empty string.
|
|
||||||
# Before Python 3.3 there was a more strict definition in which order
|
|
||||||
# you could define literals.
|
|
||||||
return ''
|
|
||||||
|
|
||||||
|
|
||||||
def get_signature(funcdef, width=72, call_string=None,
|
def get_signature(funcdef, width=72, call_string=None,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# python >= 3.4
|
|
||||||
import typing
|
import typing
|
||||||
from typing import (
|
from typing import (
|
||||||
Callable,
|
Callable,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# python >= 3.4
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Callable,
|
Callable,
|
||||||
Dict,
|
Dict,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
# python >= 3.4
|
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Callable,
|
Callable,
|
||||||
|
|||||||
Reference in New Issue
Block a user