mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-19 03:55:57 +08:00
Replace a __bases__ call with an __mro__ call, because the latter is closer to how Python actually works. __bases__ is never used.
This commit is contained in:
@@ -458,15 +458,8 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def get_subscope_by_name(self, name):
|
def get_subscope_by_name(self, name):
|
||||||
for s in [self] + self.py__bases__(self._evaluator):
|
for s in self.py__mro__(self._evaluator):
|
||||||
try:
|
for sub in reversed(s.subscopes):
|
||||||
subscopes = s.subscopes
|
|
||||||
except AttributeError:
|
|
||||||
# TODO look at the __mro__ todo, we should add a TypeError
|
|
||||||
# here.
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
for sub in reversed(subscopes):
|
|
||||||
if sub.name.value == name:
|
if sub.name.value == name:
|
||||||
return sub
|
return sub
|
||||||
raise KeyError("Couldn't find subscope.")
|
raise KeyError("Couldn't find subscope.")
|
||||||
|
|||||||
Reference in New Issue
Block a user