mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-15 10:07:06 +08:00
Fix the whole test suite of descriptors.
This commit is contained in:
@@ -65,7 +65,7 @@ class CompiledObject(Context):
|
||||
|
||||
@CheckAttribute
|
||||
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
|
||||
def py__bases__(self):
|
||||
|
||||
@@ -97,7 +97,7 @@ class AbstractInstanceContext(Context):
|
||||
if include_self_names:
|
||||
for cls in self.class_context.py__mro__():
|
||||
if isinstance(cls, compiled.CompiledObject):
|
||||
yield SelfNameFilter(self.evaluator, self, cls, origin_scope)
|
||||
yield CompiledSelfNameFilter(self.evaluator, self, cls, origin_scope)
|
||||
else:
|
||||
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)
|
||||
|
||||
|
||||
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):
|
||||
def infer(self):
|
||||
for v in super(LazyInstanceClassName, self).infer():
|
||||
@@ -360,6 +346,14 @@ class SelfNameFilter(InstanceClassFilter):
|
||||
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):
|
||||
"""
|
||||
TODO This seems like a strange class, clean up?
|
||||
|
||||
@@ -623,7 +623,7 @@ def py__iter__(evaluator, types, node=None):
|
||||
else:
|
||||
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(
|
||||
[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)):
|
||||
# TODO zip_longest yields None, that means this would raise
|
||||
# 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:
|
||||
arrays = self._evaluator.eval_element(self.context, el)
|
||||
for dct in arrays:
|
||||
|
||||
@@ -140,6 +140,8 @@ class E(object):
|
||||
def f(x):
|
||||
return x
|
||||
f = staticmethod(f)
|
||||
#?
|
||||
f.__func
|
||||
|
||||
@staticmethod
|
||||
def g(x):
|
||||
|
||||
Reference in New Issue
Block a user