Stop changing the global recursion limit on import (#2113)
This commit is contained in:
1 parent
f37a9f9feb
commit
558135e8f3
6 files changed
+165
-8
No files matched your search
+14
-1
@@ -28,7 +28,7 @@ from jedi.inference.gradual.conversion import convert_names, convert_values
|
||||
from jedi.inference.base_value import ValueSet, HasNoContext
|
||||
from jedi.api.keywords import KeywordName
|
||||
from jedi.api import completion_cache
|
||||
from jedi.api.helpers import filter_follow_imports
|
||||
from jedi.api.helpers import filter_follow_imports, recursion_limit
|
||||
|
||||
|
||||
def _sort_names_by_start_pos(names):
|
||||
@@ -262,6 +262,7 @@ class BaseName:
|
||||
return last_leaf.end_pos
|
||||
return definition.end_pos
|
||||
|
||||
@recursion_limit
|
||||
def docstring(self, raw=False, fast=True):
|
||||
r"""
|
||||
Return a document string for this completion object.
|
||||
@@ -422,6 +423,7 @@ class BaseName:
|
||||
return tree_name.is_definition() and tree_name.parent.type == 'trailer'
|
||||
|
||||
@debug.increase_indent_cm('goto on name')
|
||||
@recursion_limit
|
||||
def goto(self, *, follow_imports=False, follow_builtin_imports=False,
|
||||
only_stubs=False, prefer_stubs=False):
|
||||
|
||||
@@ -452,6 +454,7 @@ class BaseName:
|
||||
for n in names]
|
||||
|
||||
@debug.increase_indent_cm('infer on name')
|
||||
@recursion_limit
|
||||
def infer(self, *, only_stubs=False, prefer_stubs=False):
|
||||
"""
|
||||
Like :meth:`.Script.infer`, it can be useful to understand which type
|
||||
@@ -567,6 +570,7 @@ class BaseName:
|
||||
names = convert_names([self._name], prefer_stubs=True)
|
||||
return [sig for name in names for sig in name.infer().get_signatures()]
|
||||
|
||||
@recursion_limit
|
||||
def get_signatures(self):
|
||||
"""
|
||||
Returns all potential signatures for a function or a class. Multiple
|
||||
@@ -579,6 +583,7 @@ class BaseName:
|
||||
for s in self._get_signatures()
|
||||
]
|
||||
|
||||
@recursion_limit
|
||||
def execute(self):
|
||||
"""
|
||||
Uses type inference to "execute" this identifier and returns the
|
||||
@@ -588,6 +593,7 @@ class BaseName:
|
||||
"""
|
||||
return _values_to_definitions(self._name.infer().execute_with_values())
|
||||
|
||||
@recursion_limit
|
||||
def get_type_hint(self):
|
||||
"""
|
||||
Returns type hints like ``Iterable[int]`` or ``Union[int, str]``.
|
||||
@@ -670,6 +676,7 @@ class Completion(BaseName):
|
||||
"""
|
||||
return self._complete(False)
|
||||
|
||||
@recursion_limit
|
||||
def docstring(self, raw=False, fast=True):
|
||||
"""
|
||||
Documented under :meth:`BaseName.docstring`.
|
||||
@@ -752,6 +759,7 @@ class Name(BaseName):
|
||||
super().__init__(inference_state, definition)
|
||||
|
||||
@memoize_method
|
||||
@recursion_limit
|
||||
def defined_names(self):
|
||||
"""
|
||||
List sub-definitions (e.g., methods in class).
|
||||
@@ -797,6 +805,7 @@ class BaseSignature(Name):
|
||||
self._signature = signature
|
||||
|
||||
@property
|
||||
@recursion_limit
|
||||
def params(self):
|
||||
"""
|
||||
Returns definitions for all parameters that a signature defines.
|
||||
@@ -807,6 +816,7 @@ class BaseSignature(Name):
|
||||
return [ParamName(self._inference_state, n)
|
||||
for n in self._signature.get_param_names(resolve_stars=True)]
|
||||
|
||||
@recursion_limit
|
||||
def to_string(self):
|
||||
"""
|
||||
Returns a text representation of the signature. This could for example
|
||||
@@ -858,6 +868,7 @@ class Signature(BaseSignature):
|
||||
|
||||
|
||||
class ParamName(Name):
|
||||
@recursion_limit
|
||||
def infer_default(self):
|
||||
"""
|
||||
Returns default values like the ``1`` of ``def foo(x=1):``.
|
||||
@@ -866,6 +877,7 @@ class ParamName(Name):
|
||||
"""
|
||||
return _values_to_definitions(self._name.infer_default())
|
||||
|
||||
@recursion_limit
|
||||
def infer_annotation(self, **kwargs):
|
||||
"""
|
||||
:param execute_annotation: Default True; If False, values are not
|
||||
@@ -874,6 +886,7 @@ class ParamName(Name):
|
||||
"""
|
||||
return _values_to_definitions(self._name.infer_annotation(ignore_stars=True, **kwargs))
|
||||
|
||||
@recursion_limit
|
||||
def to_string(self):
|
||||
"""
|
||||
Returns a simple representation of a param, like
|
||||
|
||||
Reference in new issue
Block a user