forked from VimPlug/jedi
Remove py__class__ evaluator param from representation objects.
This commit is contained in:
@@ -60,8 +60,8 @@ class CompiledObject(Base):
|
||||
return actual
|
||||
|
||||
@CheckAttribute
|
||||
def py__class__(self, evaluator):
|
||||
return create(evaluator, self.obj.__class__, parent=self.parent)
|
||||
def py__class__(self):
|
||||
return create(self._evaluator, self.obj.__class__, parent=self.parent)
|
||||
|
||||
@CheckAttribute
|
||||
def py__mro__(self):
|
||||
|
||||
@@ -54,9 +54,9 @@ class GeneratorMixin(object):
|
||||
def py__bool__(self):
|
||||
return True
|
||||
|
||||
def py__class__(self, evaluator):
|
||||
def py__class__(self):
|
||||
gen_obj = compiled.get_special_object(self._evaluator, 'GENERATOR_OBJECT')
|
||||
return gen_obj.py__class__(evaluator)
|
||||
return gen_obj.py__class__()
|
||||
|
||||
|
||||
class Generator(use_metaclass(CachedMetaClass, IterableWrapper, GeneratorMixin)):
|
||||
@@ -171,8 +171,8 @@ class ArrayMixin(object):
|
||||
def py__bool__(self):
|
||||
return None # We don't know the length, because of appends.
|
||||
|
||||
def py__class__(self, evaluator):
|
||||
return compiled.builtin_from_name(evaluator, self.type)
|
||||
def py__class__(self):
|
||||
return compiled.builtin_from_name(self._evaluator, self.type)
|
||||
|
||||
|
||||
class ListComprehension(Comprehension, ArrayMixin):
|
||||
|
||||
@@ -23,6 +23,7 @@ py__bool__() Returns True/False/None; None means that
|
||||
py__bases__() Returns a list of base classes.
|
||||
py__mro__() Returns a list of classes (the mro).
|
||||
py__iter__() Returns a generator of a set of types.
|
||||
py__class__() Returns the class of an instance.
|
||||
py__getitem__(index: int/str) Returns a a set of types of the index.
|
||||
Can raise an IndexError/KeyError.
|
||||
====================================== ========================================
|
||||
@@ -110,7 +111,7 @@ class Instance(use_metaclass(CachedMetaClass, Executed)):
|
||||
|
||||
return actual
|
||||
|
||||
def py__class__(self, evaluator):
|
||||
def py__class__(self):
|
||||
return self.base
|
||||
|
||||
def py__bool__(self):
|
||||
@@ -458,8 +459,8 @@ class Class(use_metaclass(CachedMetaClass, Wrapper)):
|
||||
def py__call__(self, params):
|
||||
return set([Instance(self._evaluator, self, params)])
|
||||
|
||||
def py__class__(self, evaluator):
|
||||
return compiled.create(evaluator, type)
|
||||
def py__class__(self):
|
||||
return compiled.create(self._evaluator, type)
|
||||
|
||||
@property
|
||||
def params(self):
|
||||
@@ -576,8 +577,8 @@ class Function(use_metaclass(CachedMetaClass, Wrapper)):
|
||||
else:
|
||||
return FunctionExecution(self._evaluator, self, params).get_return_types()
|
||||
|
||||
def py__class__(self, evaluator):
|
||||
return compiled.get_special_object(evaluator, 'FUNCTION_CLASS')
|
||||
def py__class__(self):
|
||||
return compiled.get_special_object(self._evaluator, 'FUNCTION_CLASS')
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self.base_func, name)
|
||||
@@ -916,8 +917,8 @@ class ModuleWrapper(use_metaclass(CachedMetaClass, tree.Module, Wrapper)):
|
||||
|
||||
return names
|
||||
|
||||
def py__class__(self, evaluator):
|
||||
return compiled.get_special_object(evaluator, 'MODULE_CLASS')
|
||||
def py__class__(self):
|
||||
return compiled.get_special_object(self._evaluator, 'MODULE_CLASS')
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._module, name)
|
||||
|
||||
@@ -125,7 +125,7 @@ def builtins_type(evaluator, objects, bases, dicts):
|
||||
# It's a type creation... maybe someday...
|
||||
return set()
|
||||
else:
|
||||
return set([o.py__class__(evaluator) for o in objects])
|
||||
return set([o.py__class__() for o in objects])
|
||||
|
||||
|
||||
class SuperInstance(er.Instance):
|
||||
@@ -178,7 +178,7 @@ def builtins_isinstance(evaluator, objects, types, arguments):
|
||||
bool_results = set([])
|
||||
for o in objects:
|
||||
try:
|
||||
mro_func = o.py__class__(evaluator).py__mro__
|
||||
mro_func = o.py__class__().py__mro__
|
||||
except AttributeError:
|
||||
# This is temporary. Everything should have a class attribute in
|
||||
# Python?! Maybe we'll leave it here, because some numpy objects or
|
||||
|
||||
Reference in New Issue
Block a user