mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-16 10:37:52 +08:00
Remove evaluator param from py__mro__.
This commit is contained in:
@@ -64,8 +64,8 @@ class CompiledObject(Base):
|
|||||||
return create(evaluator, self.obj.__class__, parent=self.parent)
|
return create(evaluator, self.obj.__class__, parent=self.parent)
|
||||||
|
|
||||||
@CheckAttribute
|
@CheckAttribute
|
||||||
def py__mro__(self, evaluator):
|
def py__mro__(self):
|
||||||
return tuple(create(evaluator, cls, self.parent) for cls in self.obj.__mro__)
|
return tuple(create(self._evaluator, cls, self.parent) for cls in self.obj.__mro__)
|
||||||
|
|
||||||
@CheckAttribute
|
@CheckAttribute
|
||||||
def py__bases__(self, evaluator):
|
def py__bases__(self, evaluator):
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ py__call__(evaluator, params: Array) On callable objects, returns types.
|
|||||||
py__bool__() Returns True/False/None; None means that
|
py__bool__() Returns True/False/None; None means that
|
||||||
there's no certainty.
|
there's no certainty.
|
||||||
py__bases__(evaluator) Returns a list of base classes.
|
py__bases__(evaluator) Returns a list of base classes.
|
||||||
py__mro__(evaluator) Returns a list of classes (the mro).
|
py__mro__() Returns a list of classes (the mro).
|
||||||
py__iter__() Returns a generator of a set of types.
|
py__iter__() Returns a generator of a set of types.
|
||||||
py__getitem__(index: int/str) Returns a a set of types of the index.
|
py__getitem__(index: int/str) Returns a a set of types of the index.
|
||||||
Can raise an IndexError/KeyError.
|
Can raise an IndexError/KeyError.
|
||||||
@@ -188,7 +188,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
|||||||
def names_dicts(self, search_global):
|
def names_dicts(self, search_global):
|
||||||
yield self._self_names_dict()
|
yield self._self_names_dict()
|
||||||
|
|
||||||
for s in self.base.py__mro__(self._evaluator)[1:]:
|
for s in self.base.py__mro__()[1:]:
|
||||||
if not isinstance(s, compiled.CompiledObject):
|
if not isinstance(s, compiled.CompiledObject):
|
||||||
# Compiled objects don't have `self.` names.
|
# Compiled objects don't have `self.` names.
|
||||||
for inst in self._evaluator.execute(s):
|
for inst in self._evaluator.execute(s):
|
||||||
@@ -414,7 +414,7 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
self.base = base
|
self.base = base
|
||||||
|
|
||||||
@memoize_default(default=())
|
@memoize_default(default=())
|
||||||
def py__mro__(self, evaluator):
|
def py__mro__(self):
|
||||||
def add(cls):
|
def add(cls):
|
||||||
if cls not in mro:
|
if cls not in mro:
|
||||||
mro.append(cls)
|
mro.append(cls)
|
||||||
@@ -442,7 +442,7 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
add(cls)
|
add(cls)
|
||||||
for cls_new in mro_method(evaluator):
|
for cls_new in mro_method():
|
||||||
add(cls_new)
|
add(cls_new)
|
||||||
return tuple(mro)
|
return tuple(mro)
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
|||||||
if search_global:
|
if search_global:
|
||||||
yield self.names_dict
|
yield self.names_dict
|
||||||
else:
|
else:
|
||||||
for scope in self.py__mro__(self._evaluator):
|
for scope in self.py__mro__():
|
||||||
if isinstance(scope, compiled.CompiledObject):
|
if isinstance(scope, compiled.CompiledObject):
|
||||||
yield scope.names_dicts(False, is_instance)[0]
|
yield scope.names_dicts(False, is_instance)[0]
|
||||||
else:
|
else:
|
||||||
@@ -479,7 +479,7 @@ 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.py__mro__(self._evaluator):
|
for s in self.py__mro__():
|
||||||
for sub in reversed(s.subscopes):
|
for sub in reversed(s.subscopes):
|
||||||
if sub.name.value == name:
|
if sub.name.value == name:
|
||||||
return sub
|
return sub
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ def builtins_isinstance(evaluator, objects, types, arguments):
|
|||||||
# whatever might not.
|
# whatever might not.
|
||||||
return set([compiled.create(True), compiled.create(False)])
|
return set([compiled.create(True), compiled.create(False)])
|
||||||
|
|
||||||
mro = mro_func(evaluator)
|
mro = mro_func()
|
||||||
|
|
||||||
for cls_or_tup in types:
|
for cls_or_tup in types:
|
||||||
if cls_or_tup.is_class():
|
if cls_or_tup.is_class():
|
||||||
|
|||||||
@@ -32,5 +32,5 @@ def test_class_mro():
|
|||||||
pass
|
pass
|
||||||
X"""
|
X"""
|
||||||
cls, evaluator = get_definition_and_evaluator(s)
|
cls, evaluator = get_definition_and_evaluator(s)
|
||||||
mro = cls.py__mro__(evaluator)
|
mro = cls.py__mro__()
|
||||||
assert [str(c.name) for c in mro] == ['X', 'object']
|
assert [str(c.name) for c in mro] == ['X', 'object']
|
||||||
|
|||||||
Reference in New Issue
Block a user