Implement is_stub and goto_stubs for the API
This commit is contained in:
1 parent
32d2397e64
commit
8e9a91abf8
4 files changed
+46
-2
No files matched your search
@@ -301,6 +301,18 @@ class BaseDefinition(object):
|
||||
|
||||
return '.'.join(path if path[0] else path[1:])
|
||||
|
||||
def is_stub(self):
|
||||
return all(c.is_stub() for c in self._name.infer())
|
||||
|
||||
def goto_stubs(self):
|
||||
if self.is_stub():
|
||||
return [self]
|
||||
|
||||
return [
|
||||
Definition(self._evaluator, d.stub_context.name)
|
||||
for d in self._name.infer() if d.stub_context is not None
|
||||
]
|
||||
|
||||
def goto_assignments(self):
|
||||
if self._name.tree_name is None:
|
||||
return self
|
||||
|
||||
Reference in new issue
Block a user