mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-23 05:41:27 +08:00
completions should also have the parent attribute -> move parent to BaseDefinition
This commit is contained in:
@@ -339,6 +339,11 @@ class BaseDefinition(object):
|
|||||||
return []
|
return []
|
||||||
return [_Param(self._evaluator, p) for p in params]
|
return [_Param(self._evaluator, p) for p in params]
|
||||||
|
|
||||||
|
def parent(self):
|
||||||
|
scope = self._definition.get_parent_until(pr.IsScope, include_current=False)
|
||||||
|
non_flow = scope.get_parent_until(pr.Flow, reverse=True)
|
||||||
|
return Definition(self._evaluator, non_flow)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s %s>" % (type(self).__name__, self.description)
|
return "<%s %s>" % (type(self).__name__, self.description)
|
||||||
|
|
||||||
@@ -632,11 +637,6 @@ class Definition(use_metaclass(CachedMetaClass, BaseDefinition)):
|
|||||||
iterable = list(iterable)
|
iterable = list(iterable)
|
||||||
return list(chain.from_iterable(iterable))
|
return list(chain.from_iterable(iterable))
|
||||||
|
|
||||||
def parent(self):
|
|
||||||
scope = self._definition.get_parent_until(pr.IsScope, include_current=False)
|
|
||||||
non_flow = scope.get_parent_until(pr.Flow, reverse=True)
|
|
||||||
return Definition(self._evaluator, non_flow)
|
|
||||||
|
|
||||||
|
|
||||||
class CallSignature(Definition):
|
class CallSignature(Definition):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user