mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-06 14:04:26 +08:00
Fix a recursion on imports, fixes #1677
This commit is contained in:
@@ -7,6 +7,7 @@ from parso.tree import search_ancestor
|
|||||||
from jedi.parser_utils import find_statement_documentation, clean_scope_docstring
|
from jedi.parser_utils import find_statement_documentation, clean_scope_docstring
|
||||||
from jedi.inference.utils import unite
|
from jedi.inference.utils import unite
|
||||||
from jedi.inference.base_value import ValueSet, NO_VALUES
|
from jedi.inference.base_value import ValueSet, NO_VALUES
|
||||||
|
from jedi.inference.cache import inference_state_method_cache
|
||||||
from jedi.inference import docstrings
|
from jedi.inference import docstrings
|
||||||
from jedi.cache import memoize_method
|
from jedi.cache import memoize_method
|
||||||
from jedi.inference.helpers import deep_ast_copy, infer_call_of_leaf
|
from jedi.inference.helpers import deep_ast_copy, infer_call_of_leaf
|
||||||
@@ -331,6 +332,12 @@ class TreeNameDefinition(AbstractTreeName):
|
|||||||
node = node.parent
|
node = node.parent
|
||||||
return indexes
|
return indexes
|
||||||
|
|
||||||
|
@property
|
||||||
|
def inference_state(self):
|
||||||
|
# Used by the cache function below
|
||||||
|
return self.parent_context.inference_state
|
||||||
|
|
||||||
|
@inference_state_method_cache(default='')
|
||||||
def py__doc__(self):
|
def py__doc__(self):
|
||||||
api_type = self.api_type
|
api_type = self.api_type
|
||||||
if api_type in ('function', 'class'):
|
if api_type in ('function', 'class'):
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
from .cq import selectors
|
||||||
1
test/examples/import-recursion/cadquery_simple/cq.py
Normal file
1
test/examples/import-recursion/cadquery_simple/cq.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import selectors
|
||||||
3
test/examples/import-recursion/cq_example.py
Normal file
3
test/examples/import-recursion/cq_example.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import cadquery_simple as cq
|
||||||
|
|
||||||
|
cq.
|
||||||
@@ -468,3 +468,9 @@ def test_relative_import_star(Script):
|
|||||||
script = Script(source, path='export.py')
|
script = Script(source, path='export.py')
|
||||||
|
|
||||||
assert script.complete(3, len("furl.c"))
|
assert script.complete(3, len("furl.c"))
|
||||||
|
|
||||||
|
|
||||||
|
def test_import_recursion(Script):
|
||||||
|
path = get_example_dir('import-recursion', "cq_example.py")
|
||||||
|
for c in Script(path=path).complete(3, 3):
|
||||||
|
c.docstring()
|
||||||
|
|||||||
Reference in New Issue
Block a user