forked from VimPlug/jedi
Fix the whole test suite of descriptors.
This commit is contained in:
@@ -65,7 +65,7 @@ class CompiledObject(Context):
|
|||||||
|
|
||||||
@CheckAttribute
|
@CheckAttribute
|
||||||
def py__mro__(self):
|
def py__mro__(self):
|
||||||
return tuple(create(self.evaluator, cls) for cls in self.obj.__mro__)
|
return (self,) + tuple(create(self.evaluator, cls) for cls in self.obj.__mro__[1:])
|
||||||
|
|
||||||
@CheckAttribute
|
@CheckAttribute
|
||||||
def py__bases__(self):
|
def py__bases__(self):
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ class AbstractInstanceContext(Context):
|
|||||||
if include_self_names:
|
if include_self_names:
|
||||||
for cls in self.class_context.py__mro__():
|
for cls in self.class_context.py__mro__():
|
||||||
if isinstance(cls, compiled.CompiledObject):
|
if isinstance(cls, compiled.CompiledObject):
|
||||||
yield SelfNameFilter(self.evaluator, self, cls, origin_scope)
|
yield CompiledSelfNameFilter(self.evaluator, self, cls, origin_scope)
|
||||||
else:
|
else:
|
||||||
yield SelfNameFilter(self.evaluator, self, cls, origin_scope)
|
yield SelfNameFilter(self.evaluator, self, cls, origin_scope)
|
||||||
|
|
||||||
@@ -273,20 +273,6 @@ class LazyInstanceName(filters.TreeNameDefinition):
|
|||||||
return self._instance.create_instance_context(self._class_context, self.tree_name)
|
return self._instance.create_instance_context(self._class_context, self.tree_name)
|
||||||
|
|
||||||
|
|
||||||
class LazyInstanceName(filters.TreeNameDefinition):
|
|
||||||
"""
|
|
||||||
This name calculates the parent_context lazily.
|
|
||||||
"""
|
|
||||||
def __init__(self, instance, class_context, tree_name):
|
|
||||||
self._instance = instance
|
|
||||||
self._class_context = class_context
|
|
||||||
self.tree_name = tree_name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def parent_context(self):
|
|
||||||
return self._instance.create_instance_context(self._class_context, self.tree_name)
|
|
||||||
|
|
||||||
|
|
||||||
class LazyInstanceClassName(LazyInstanceName):
|
class LazyInstanceClassName(LazyInstanceName):
|
||||||
def infer(self):
|
def infer(self):
|
||||||
for v in super(LazyInstanceClassName, self).infer():
|
for v in super(LazyInstanceClassName, self).infer():
|
||||||
@@ -360,6 +346,14 @@ class SelfNameFilter(InstanceClassFilter):
|
|||||||
return names
|
return names
|
||||||
|
|
||||||
|
|
||||||
|
class CompiledSelfNameFilter(SelfNameFilter):
|
||||||
|
"""
|
||||||
|
This filter is a bit special and exists only because of `compiled/fake/*`.
|
||||||
|
"""
|
||||||
|
def _access_possible(self, name):
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ParamArguments(object):
|
class ParamArguments(object):
|
||||||
"""
|
"""
|
||||||
TODO This seems like a strange class, clean up?
|
TODO This seems like a strange class, clean up?
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ def py__iter__(evaluator, types, node=None):
|
|||||||
else:
|
else:
|
||||||
type_iters.append(iter_method())
|
type_iters.append(iter_method())
|
||||||
|
|
||||||
for lazy_contexts in zip_longest(*type_iters, fillvalue=None):
|
for lazy_contexts in zip_longest(*type_iters):
|
||||||
yield context.get_merged_lazy_context(
|
yield context.get_merged_lazy_context(
|
||||||
[l for l in lazy_contexts if l is not None]
|
[l for l in lazy_contexts if l is not None]
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -120,7 +120,9 @@ class TreeArguments(AbstractArguments):
|
|||||||
for values in list(zip_longest(*iterators)):
|
for values in list(zip_longest(*iterators)):
|
||||||
# TODO zip_longest yields None, that means this would raise
|
# TODO zip_longest yields None, that means this would raise
|
||||||
# an exception?
|
# an exception?
|
||||||
yield None, context.get_merged_lazy_context(values)
|
yield None, context.get_merged_lazy_context(
|
||||||
|
[v for v in values if v is not None]
|
||||||
|
)
|
||||||
elif stars == 2:
|
elif stars == 2:
|
||||||
arrays = self._evaluator.eval_element(self.context, el)
|
arrays = self._evaluator.eval_element(self.context, el)
|
||||||
for dct in arrays:
|
for dct in arrays:
|
||||||
|
|||||||
@@ -140,6 +140,8 @@ class E(object):
|
|||||||
def f(x):
|
def f(x):
|
||||||
return x
|
return x
|
||||||
f = staticmethod(f)
|
f = staticmethod(f)
|
||||||
|
#?
|
||||||
|
f.__func
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def g(x):
|
def g(x):
|
||||||
|
|||||||
Reference in New Issue
Block a user