1
0
forked from VimPlug/jedi

Some code cleanups

This commit is contained in:
Dave Halter
2020-04-11 02:11:52 +02:00
parent 9d55194b92
commit bdd4deedc1
11 changed files with 26 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ from jedi.inference.base_value import ValueWrapper
class Decoratee(ValueWrapper):
def __init__(self, wrapped_value, original_value):
self._wrapped_value = wrapped_value
super(Decoratee, self).__init__(wrapped_value)
self._original_value = original_value
def py__doc__(self):

View File

@@ -241,7 +241,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
def py__getitem__(self, index_value_set, contextualized_node):
names = self.get_function_slot_names(u'__getitem__')
if not names:
return super(AbstractInstanceValue, self).py__getitem__(
return super(_BaseTreeInstance, self).py__getitem__(
index_value_set,
contextualized_node,
)
@@ -252,7 +252,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
def py__iter__(self, contextualized_node=None):
iter_slot_names = self.get_function_slot_names(u'__iter__')
if not iter_slot_names:
return super(AbstractInstanceValue, self).py__iter__(contextualized_node)
return super(_BaseTreeInstance, self).py__iter__(contextualized_node)
def iterate():
for generator in self.execute_function_slots(iter_slot_names):
@@ -278,7 +278,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
names = self.get_function_slot_names(u'__call__')
if not names:
# Means the Instance is not callable.
return super(AbstractInstanceValue, self).py__call__(arguments)
return super(_BaseTreeInstance, self).py__call__(arguments)
return ValueSet.from_sets(name.infer().execute(arguments) for name in names)
@@ -317,8 +317,7 @@ class TreeInstance(_BaseTreeInstance):
if settings.dynamic_array_additions:
arguments = get_dynamic_array_instance(self, arguments)
super(_BaseTreeInstance, self).__init__(inference_state, parent_context,
class_value)
super(TreeInstance, self).__init__(inference_state, parent_context, class_value)
self._arguments = arguments
self.tree_node = class_value.tree_node

View File

@@ -214,9 +214,11 @@ class ClassMixin(object):
for instance in type_.py__call__(args):
instance_filters = instance.get_filters()
# Filter out self filters
next(instance_filters)
next(instance_filters)
yield next(instance_filters)
next(instance_filters, None)
next(instance_filters, None)
x = next(instance_filters, None)
assert x is not None
yield x
def get_signatures(self):
# Since calling staticmethod without a function is illegal, the Jedi

View File

@@ -99,7 +99,9 @@ class ModuleMixin(SubModuleDictMixin):
def iter_star_filters(self):
for star_module in self.star_imports():
yield next(star_module.get_filters())
f = next(star_module.get_filters(), None)
assert f is not None
yield f
# I'm not sure if the star import cache is really that effective anymore
# with all the other really fast import caches. Recheck. Also we would need