mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
Even more super deletions
This commit is contained in:
@@ -68,7 +68,7 @@ class AbstractSignature(_SignatureMixin):
|
|||||||
|
|
||||||
class TreeSignature(AbstractSignature):
|
class TreeSignature(AbstractSignature):
|
||||||
def __init__(self, value, function_value=None, is_bound=False):
|
def __init__(self, value, function_value=None, is_bound=False):
|
||||||
super(TreeSignature, self).__init__(value, is_bound)
|
super().__init__(value, is_bound)
|
||||||
self._function_value = function_value or value
|
self._function_value = function_value or value
|
||||||
|
|
||||||
def bind(self, value):
|
def bind(self, value):
|
||||||
@@ -122,7 +122,7 @@ class TreeSignature(AbstractSignature):
|
|||||||
|
|
||||||
class BuiltinSignature(AbstractSignature):
|
class BuiltinSignature(AbstractSignature):
|
||||||
def __init__(self, value, return_string, function_value=None, is_bound=False):
|
def __init__(self, value, return_string, function_value=None, is_bound=False):
|
||||||
super(BuiltinSignature, self).__init__(value, is_bound)
|
super().__init__(value, is_bound)
|
||||||
self._return_string = return_string
|
self._return_string = return_string
|
||||||
self.__function_value = function_value
|
self.__function_value = function_value
|
||||||
|
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ def process_params(param_names, star_count=3): # default means both * and **
|
|||||||
|
|
||||||
class ParamNameFixedKind(ParamNameWrapper):
|
class ParamNameFixedKind(ParamNameWrapper):
|
||||||
def __init__(self, param_name, new_kind):
|
def __init__(self, param_name, new_kind):
|
||||||
super(ParamNameFixedKind, self).__init__(param_name)
|
super().__init__(param_name)
|
||||||
self._new_kind = new_kind
|
self._new_kind = new_kind
|
||||||
|
|
||||||
def get_kind(self):
|
def get_kind(self):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from jedi.inference.base_value import ValueWrapper, ValueSet
|
|||||||
|
|
||||||
class Decoratee(ValueWrapper):
|
class Decoratee(ValueWrapper):
|
||||||
def __init__(self, wrapped_value, original_value):
|
def __init__(self, wrapped_value, original_value):
|
||||||
super(Decoratee, self).__init__(wrapped_value)
|
super().__init__(wrapped_value)
|
||||||
self._original_value = original_value
|
self._original_value = original_value
|
||||||
|
|
||||||
def py__doc__(self):
|
def py__doc__(self):
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ class _DynamicArrayAdditions(HelperValueMixin):
|
|||||||
|
|
||||||
class _Modification(ValueWrapper):
|
class _Modification(ValueWrapper):
|
||||||
def __init__(self, wrapped_value, assigned_values, contextualized_key):
|
def __init__(self, wrapped_value, assigned_values, contextualized_key):
|
||||||
super(_Modification, self).__init__(wrapped_value)
|
super().__init__(wrapped_value)
|
||||||
self._assigned_values = assigned_values
|
self._assigned_values = assigned_values
|
||||||
self._contextualized_key = contextualized_key
|
self._contextualized_key = contextualized_key
|
||||||
|
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ class FunctionValue(FunctionMixin, FunctionAndClassBase, metaclass=CachedMetaCla
|
|||||||
|
|
||||||
class FunctionNameInClass(NameWrapper):
|
class FunctionNameInClass(NameWrapper):
|
||||||
def __init__(self, class_context, name):
|
def __init__(self, class_context, name):
|
||||||
super(FunctionNameInClass, self).__init__(name)
|
super().__init__(name)
|
||||||
self._class_context = class_context
|
self._class_context = class_context
|
||||||
|
|
||||||
def get_defining_qualified_value(self):
|
def get_defining_qualified_value(self):
|
||||||
@@ -181,7 +181,7 @@ class FunctionNameInClass(NameWrapper):
|
|||||||
|
|
||||||
class MethodValue(FunctionValue):
|
class MethodValue(FunctionValue):
|
||||||
def __init__(self, inference_state, class_context, *args, **kwargs):
|
def __init__(self, inference_state, class_context, *args, **kwargs):
|
||||||
super(MethodValue, self).__init__(inference_state, *args, **kwargs)
|
super().__init__(inference_state, *args, **kwargs)
|
||||||
self.class_context = class_context
|
self.class_context = class_context
|
||||||
|
|
||||||
def get_default_param_context(self):
|
def get_default_param_context(self):
|
||||||
@@ -197,7 +197,7 @@ class MethodValue(FunctionValue):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
return FunctionNameInClass(self.class_context, super(MethodValue, self).name)
|
return FunctionNameInClass(self.class_context, super().name)
|
||||||
|
|
||||||
|
|
||||||
class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
|
class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
|
||||||
@@ -356,7 +356,7 @@ class BaseFunctionExecutionContext(ValueContext, TreeContextMixin):
|
|||||||
|
|
||||||
class FunctionExecutionContext(BaseFunctionExecutionContext):
|
class FunctionExecutionContext(BaseFunctionExecutionContext):
|
||||||
def __init__(self, function_value, arguments):
|
def __init__(self, function_value, arguments):
|
||||||
super(FunctionExecutionContext, self).__init__(function_value)
|
super().__init__(function_value)
|
||||||
self._arguments = arguments
|
self._arguments = arguments
|
||||||
|
|
||||||
def get_filters(self, until_position=None, origin_scope=None):
|
def get_filters(self, until_position=None, origin_scope=None):
|
||||||
@@ -397,7 +397,7 @@ class AnonymousFunctionExecution(BaseFunctionExecutionContext):
|
|||||||
|
|
||||||
class OverloadedFunctionValue(FunctionMixin, ValueWrapper):
|
class OverloadedFunctionValue(FunctionMixin, ValueWrapper):
|
||||||
def __init__(self, function, overloaded_functions):
|
def __init__(self, function, overloaded_functions):
|
||||||
super(OverloadedFunctionValue, self).__init__(function)
|
super().__init__(function)
|
||||||
self._overloaded_functions = overloaded_functions
|
self._overloaded_functions = overloaded_functions
|
||||||
|
|
||||||
def py__call__(self, arguments):
|
def py__call__(self, arguments):
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from jedi.parser_utils import function_is_staticmethod, function_is_classmethod
|
|||||||
|
|
||||||
class InstanceExecutedParamName(ParamName):
|
class InstanceExecutedParamName(ParamName):
|
||||||
def __init__(self, instance, function_value, tree_name):
|
def __init__(self, instance, function_value, tree_name):
|
||||||
super(InstanceExecutedParamName, self).__init__(
|
super().__init__(
|
||||||
function_value, tree_name, arguments=None)
|
function_value, tree_name, arguments=None)
|
||||||
self._instance = instance
|
self._instance = instance
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ class InstanceExecutedParamName(ParamName):
|
|||||||
|
|
||||||
class AnonymousMethodExecutionFilter(AnonymousFunctionExecutionFilter):
|
class AnonymousMethodExecutionFilter(AnonymousFunctionExecutionFilter):
|
||||||
def __init__(self, instance, *args, **kwargs):
|
def __init__(self, instance, *args, **kwargs):
|
||||||
super(AnonymousMethodExecutionFilter, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self._instance = instance
|
self._instance = instance
|
||||||
|
|
||||||
def _convert_param(self, param, name):
|
def _convert_param(self, param, name):
|
||||||
@@ -55,12 +55,12 @@ class AnonymousMethodExecutionFilter(AnonymousFunctionExecutionFilter):
|
|||||||
self._function_value,
|
self._function_value,
|
||||||
name
|
name
|
||||||
)
|
)
|
||||||
return super(AnonymousMethodExecutionFilter, self)._convert_param(param, name)
|
return super()._convert_param(param, name)
|
||||||
|
|
||||||
|
|
||||||
class AnonymousMethodExecutionContext(BaseFunctionExecutionContext):
|
class AnonymousMethodExecutionContext(BaseFunctionExecutionContext):
|
||||||
def __init__(self, instance, value):
|
def __init__(self, instance, value):
|
||||||
super(AnonymousMethodExecutionContext, self).__init__(value)
|
super().__init__(value)
|
||||||
self.instance = instance
|
self.instance = instance
|
||||||
|
|
||||||
def get_filters(self, until_position=None, origin_scope=None):
|
def get_filters(self, until_position=None, origin_scope=None):
|
||||||
@@ -83,7 +83,7 @@ class AnonymousMethodExecutionContext(BaseFunctionExecutionContext):
|
|||||||
|
|
||||||
class MethodExecutionContext(FunctionExecutionContext):
|
class MethodExecutionContext(FunctionExecutionContext):
|
||||||
def __init__(self, instance, *args, **kwargs):
|
def __init__(self, instance, *args, **kwargs):
|
||||||
super(MethodExecutionContext, self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.instance = instance
|
self.instance = instance
|
||||||
|
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ class AbstractInstanceValue(Value):
|
|||||||
api_type = 'instance'
|
api_type = 'instance'
|
||||||
|
|
||||||
def __init__(self, inference_state, parent_context, class_value):
|
def __init__(self, inference_state, parent_context, class_value):
|
||||||
super(AbstractInstanceValue, self).__init__(inference_state, parent_context)
|
super().__init__(inference_state, parent_context)
|
||||||
# Generated instances are classes that are just generated by self
|
# Generated instances are classes that are just generated by self
|
||||||
# (No arguments) used.
|
# (No arguments) used.
|
||||||
self.class_value = class_value
|
self.class_value = class_value
|
||||||
@@ -141,8 +141,7 @@ class CompiledInstance(AbstractInstanceValue):
|
|||||||
# This is not really a compiled class, it's just an instance from a
|
# This is not really a compiled class, it's just an instance from a
|
||||||
# compiled class.
|
# compiled class.
|
||||||
def __init__(self, inference_state, parent_context, class_value, arguments):
|
def __init__(self, inference_state, parent_context, class_value, arguments):
|
||||||
super(CompiledInstance, self).__init__(inference_state, parent_context,
|
super().__init__(inference_state, parent_context, class_value)
|
||||||
class_value)
|
|
||||||
self._arguments = arguments
|
self._arguments = arguments
|
||||||
|
|
||||||
def get_filters(self, origin_scope=None, include_self_names=True):
|
def get_filters(self, origin_scope=None, include_self_names=True):
|
||||||
@@ -241,7 +240,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
|
|||||||
def py__getitem__(self, index_value_set, contextualized_node):
|
def py__getitem__(self, index_value_set, contextualized_node):
|
||||||
names = self.get_function_slot_names('__getitem__')
|
names = self.get_function_slot_names('__getitem__')
|
||||||
if not names:
|
if not names:
|
||||||
return super(_BaseTreeInstance, self).py__getitem__(
|
return super().py__getitem__(
|
||||||
index_value_set,
|
index_value_set,
|
||||||
contextualized_node,
|
contextualized_node,
|
||||||
)
|
)
|
||||||
@@ -252,7 +251,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
|
|||||||
def py__iter__(self, contextualized_node=None):
|
def py__iter__(self, contextualized_node=None):
|
||||||
iter_slot_names = self.get_function_slot_names('__iter__')
|
iter_slot_names = self.get_function_slot_names('__iter__')
|
||||||
if not iter_slot_names:
|
if not iter_slot_names:
|
||||||
return super(_BaseTreeInstance, self).py__iter__(contextualized_node)
|
return super().py__iter__(contextualized_node)
|
||||||
|
|
||||||
def iterate():
|
def iterate():
|
||||||
for generator in self.execute_function_slots(iter_slot_names):
|
for generator in self.execute_function_slots(iter_slot_names):
|
||||||
@@ -275,7 +274,7 @@ class _BaseTreeInstance(AbstractInstanceValue):
|
|||||||
names = self.get_function_slot_names('__call__')
|
names = self.get_function_slot_names('__call__')
|
||||||
if not names:
|
if not names:
|
||||||
# Means the Instance is not callable.
|
# Means the Instance is not callable.
|
||||||
return super(_BaseTreeInstance, self).py__call__(arguments)
|
return super().py__call__(arguments)
|
||||||
|
|
||||||
return ValueSet.from_sets(name.infer().execute(arguments) for name in names)
|
return ValueSet.from_sets(name.infer().execute(arguments) for name in names)
|
||||||
|
|
||||||
@@ -319,7 +318,7 @@ class TreeInstance(_BaseTreeInstance):
|
|||||||
if settings.dynamic_array_additions:
|
if settings.dynamic_array_additions:
|
||||||
arguments = get_dynamic_array_instance(self, arguments)
|
arguments = get_dynamic_array_instance(self, arguments)
|
||||||
|
|
||||||
super(TreeInstance, self).__init__(inference_state, parent_context, class_value)
|
super().__init__(inference_state, parent_context, class_value)
|
||||||
self._arguments = arguments
|
self._arguments = arguments
|
||||||
self.tree_node = class_value.tree_node
|
self.tree_node = class_value.tree_node
|
||||||
|
|
||||||
@@ -393,7 +392,7 @@ class TreeInstance(_BaseTreeInstance):
|
|||||||
else:
|
else:
|
||||||
if key == index:
|
if key == index:
|
||||||
return lazy_context.infer()
|
return lazy_context.infer()
|
||||||
return super(TreeInstance, self).py__simple_getitem__(index)
|
return super().py__simple_getitem__(index)
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<%s of %s(%s)>" % (self.__class__.__name__, self.class_value,
|
return "<%s of %s(%s)>" % (self.__class__.__name__, self.class_value,
|
||||||
@@ -408,7 +407,7 @@ class CompiledInstanceName(compiled.CompiledName):
|
|||||||
def __init__(self, inference_state, instance, klass, name):
|
def __init__(self, inference_state, instance, klass, name):
|
||||||
parent_value = klass.parent_context.get_value()
|
parent_value = klass.parent_context.get_value()
|
||||||
assert parent_value is not None, "How? Please reproduce and report"
|
assert parent_value is not None, "How? Please reproduce and report"
|
||||||
super(CompiledInstanceName, self).__init__(
|
super().__init__(
|
||||||
inference_state,
|
inference_state,
|
||||||
parent_value,
|
parent_value,
|
||||||
name.string_name
|
name.string_name
|
||||||
@@ -446,7 +445,7 @@ class CompiledInstanceClassFilter(AbstractFilter):
|
|||||||
|
|
||||||
class BoundMethod(FunctionMixin, ValueWrapper):
|
class BoundMethod(FunctionMixin, ValueWrapper):
|
||||||
def __init__(self, instance, class_context, function):
|
def __init__(self, instance, class_context, function):
|
||||||
super(BoundMethod, self).__init__(function)
|
super().__init__(function)
|
||||||
self.instance = instance
|
self.instance = instance
|
||||||
self._class_context = class_context
|
self._class_context = class_context
|
||||||
|
|
||||||
@@ -457,7 +456,7 @@ class BoundMethod(FunctionMixin, ValueWrapper):
|
|||||||
def name(self):
|
def name(self):
|
||||||
return FunctionNameInClass(
|
return FunctionNameInClass(
|
||||||
self._class_context,
|
self._class_context,
|
||||||
super(BoundMethod, self).name
|
super().name
|
||||||
)
|
)
|
||||||
|
|
||||||
def py__class__(self):
|
def py__class__(self):
|
||||||
@@ -489,7 +488,7 @@ class BoundMethod(FunctionMixin, ValueWrapper):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def get_signatures(self):
|
def get_signatures(self):
|
||||||
return [sig.bind(self) for sig in super(BoundMethod, self).get_signatures()]
|
return [sig.bind(self) for sig in super().get_signatures()]
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '<%s: %s>' % (self.__class__.__name__, self._wrapped_value)
|
return '<%s: %s>' % (self.__class__.__name__, self._wrapped_value)
|
||||||
@@ -522,7 +521,7 @@ class SelfName(TreeNameDefinition):
|
|||||||
|
|
||||||
class LazyInstanceClassName(NameWrapper):
|
class LazyInstanceClassName(NameWrapper):
|
||||||
def __init__(self, instance, class_member_name):
|
def __init__(self, instance, class_member_name):
|
||||||
super(LazyInstanceClassName, self).__init__(class_member_name)
|
super().__init__(class_member_name)
|
||||||
self._instance = instance
|
self._instance = instance
|
||||||
|
|
||||||
@iterator_to_value_set
|
@iterator_to_value_set
|
||||||
@@ -569,7 +568,7 @@ class SelfAttributeFilter(ClassFilter):
|
|||||||
This class basically filters all the use cases where `self.*` was assigned.
|
This class basically filters all the use cases where `self.*` was assigned.
|
||||||
"""
|
"""
|
||||||
def __init__(self, instance, instance_class, node_context, origin_scope):
|
def __init__(self, instance, instance_class, node_context, origin_scope):
|
||||||
super(SelfAttributeFilter, self).__init__(
|
super().__init__(
|
||||||
class_value=instance_class,
|
class_value=instance_class,
|
||||||
node_context=node_context,
|
node_context=node_context,
|
||||||
origin_scope=origin_scope,
|
origin_scope=origin_scope,
|
||||||
@@ -613,7 +612,7 @@ class SelfAttributeFilter(ClassFilter):
|
|||||||
|
|
||||||
class InstanceArguments(TreeArgumentsWrapper):
|
class InstanceArguments(TreeArgumentsWrapper):
|
||||||
def __init__(self, instance, arguments):
|
def __init__(self, instance, arguments):
|
||||||
super(InstanceArguments, self).__init__(arguments)
|
super().__init__(arguments)
|
||||||
self.instance = instance
|
self.instance = instance
|
||||||
|
|
||||||
def unpack(self, func=None):
|
def unpack(self, func=None):
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class GeneratorBase(LazyAttributeOverwrite, IterableMixin):
|
|||||||
class Generator(GeneratorBase):
|
class Generator(GeneratorBase):
|
||||||
"""Handling of `yield` functions."""
|
"""Handling of `yield` functions."""
|
||||||
def __init__(self, inference_state, func_execution_context):
|
def __init__(self, inference_state, func_execution_context):
|
||||||
super(Generator, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self._func_execution_context = func_execution_context
|
self._func_execution_context = func_execution_context
|
||||||
|
|
||||||
def py__iter__(self, contextualized_node=None):
|
def py__iter__(self, contextualized_node=None):
|
||||||
@@ -212,7 +212,7 @@ class Sequence(LazyAttributeOverwrite, IterableMixin):
|
|||||||
class _BaseComprehension(ComprehensionMixin):
|
class _BaseComprehension(ComprehensionMixin):
|
||||||
def __init__(self, inference_state, defining_context, sync_comp_for_node, entry_node):
|
def __init__(self, inference_state, defining_context, sync_comp_for_node, entry_node):
|
||||||
assert sync_comp_for_node.type == 'sync_comp_for'
|
assert sync_comp_for_node.type == 'sync_comp_for'
|
||||||
super(_BaseComprehension, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self._defining_context = defining_context
|
self._defining_context = defining_context
|
||||||
self._sync_comp_for_node = sync_comp_for_node
|
self._sync_comp_for_node = sync_comp_for_node
|
||||||
self._entry_node = entry_node
|
self._entry_node = entry_node
|
||||||
@@ -254,7 +254,7 @@ class DictComprehension(ComprehensionMixin, Sequence, _DictKeyMixin):
|
|||||||
|
|
||||||
def __init__(self, inference_state, defining_context, sync_comp_for_node, key_node, value_node):
|
def __init__(self, inference_state, defining_context, sync_comp_for_node, key_node, value_node):
|
||||||
assert sync_comp_for_node.type == 'sync_comp_for'
|
assert sync_comp_for_node.type == 'sync_comp_for'
|
||||||
super(DictComprehension, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self._defining_context = defining_context
|
self._defining_context = defining_context
|
||||||
self._sync_comp_for_node = sync_comp_for_node
|
self._sync_comp_for_node = sync_comp_for_node
|
||||||
self._entry_node = key_node
|
self._entry_node = key_node
|
||||||
@@ -312,7 +312,7 @@ class SequenceLiteralValue(Sequence):
|
|||||||
'{': 'set'}
|
'{': 'set'}
|
||||||
|
|
||||||
def __init__(self, inference_state, defining_context, atom):
|
def __init__(self, inference_state, defining_context, atom):
|
||||||
super(SequenceLiteralValue, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self.atom = atom
|
self.atom = atom
|
||||||
self._defining_context = defining_context
|
self._defining_context = defining_context
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ class SequenceLiteralValue(Sequence):
|
|||||||
def _get_generics(self):
|
def _get_generics(self):
|
||||||
if self.array_type == 'tuple':
|
if self.array_type == 'tuple':
|
||||||
return tuple(x.infer().py__class__() for x in self.py__iter__())
|
return tuple(x.infer().py__class__() for x in self.py__iter__())
|
||||||
return super(SequenceLiteralValue, self)._get_generics()
|
return super()._get_generics()
|
||||||
|
|
||||||
def py__simple_getitem__(self, index):
|
def py__simple_getitem__(self, index):
|
||||||
"""Here the index is an int/str. Raises IndexError/KeyError."""
|
"""Here the index is an int/str. Raises IndexError/KeyError."""
|
||||||
@@ -481,7 +481,7 @@ class _FakeSequence(Sequence):
|
|||||||
"""
|
"""
|
||||||
type should be one of "tuple", "list"
|
type should be one of "tuple", "list"
|
||||||
"""
|
"""
|
||||||
super(_FakeSequence, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self._lazy_value_list = lazy_value_list
|
self._lazy_value_list = lazy_value_list
|
||||||
|
|
||||||
def py__simple_getitem__(self, index):
|
def py__simple_getitem__(self, index):
|
||||||
@@ -514,7 +514,7 @@ class FakeDict(_DictMixin, Sequence, _DictKeyMixin):
|
|||||||
array_type = 'dict'
|
array_type = 'dict'
|
||||||
|
|
||||||
def __init__(self, inference_state, dct):
|
def __init__(self, inference_state, dct):
|
||||||
super(FakeDict, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self._dct = dct
|
self._dct = dct
|
||||||
|
|
||||||
def py__iter__(self, contextualized_node=None):
|
def py__iter__(self, contextualized_node=None):
|
||||||
@@ -548,7 +548,7 @@ class FakeDict(_DictMixin, Sequence, _DictKeyMixin):
|
|||||||
|
|
||||||
class MergedArray(Sequence):
|
class MergedArray(Sequence):
|
||||||
def __init__(self, inference_state, arrays):
|
def __init__(self, inference_state, arrays):
|
||||||
super(MergedArray, self).__init__(inference_state)
|
super().__init__(inference_state)
|
||||||
self.array_type = arrays[-1].array_type
|
self.array_type = arrays[-1].array_type
|
||||||
self._arrays = arrays
|
self._arrays = arrays
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ from jedi.plugins import plugin_manager
|
|||||||
|
|
||||||
class ClassName(TreeNameDefinition):
|
class ClassName(TreeNameDefinition):
|
||||||
def __init__(self, class_value, tree_name, name_context, apply_decorators):
|
def __init__(self, class_value, tree_name, name_context, apply_decorators):
|
||||||
super(ClassName, self).__init__(name_context, tree_name)
|
super().__init__(name_context, tree_name)
|
||||||
self._apply_decorators = apply_decorators
|
self._apply_decorators = apply_decorators
|
||||||
self._class_value = class_value
|
self._class_value = class_value
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class ClassName(TreeNameDefinition):
|
|||||||
class ClassFilter(ParserTreeFilter):
|
class ClassFilter(ParserTreeFilter):
|
||||||
def __init__(self, class_value, node_context=None, until_position=None,
|
def __init__(self, class_value, node_context=None, until_position=None,
|
||||||
origin_scope=None, is_instance=False):
|
origin_scope=None, is_instance=False):
|
||||||
super(ClassFilter, self).__init__(
|
super().__init__(
|
||||||
class_value.as_context(), node_context,
|
class_value.as_context(), node_context,
|
||||||
until_position=until_position,
|
until_position=until_position,
|
||||||
origin_scope=origin_scope,
|
origin_scope=origin_scope,
|
||||||
@@ -124,7 +124,7 @@ class ClassFilter(ParserTreeFilter):
|
|||||||
or self._equals_origin_scope()
|
or self._equals_origin_scope()
|
||||||
|
|
||||||
def _filter(self, names):
|
def _filter(self, names):
|
||||||
names = super(ClassFilter, self)._filter(names)
|
names = super()._filter(names)
|
||||||
return [name for name in names if self._access_possible(name)]
|
return [name for name in names if self._access_possible(name)]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ class ModuleValue(ModuleMixin, TreeValue):
|
|||||||
|
|
||||||
def __init__(self, inference_state, module_node, code_lines, file_io=None,
|
def __init__(self, inference_state, module_node, code_lines, file_io=None,
|
||||||
string_names=None, is_package=False):
|
string_names=None, is_package=False):
|
||||||
super(ModuleValue, self).__init__(
|
super().__init__(
|
||||||
inference_state,
|
inference_state,
|
||||||
parent_context=None,
|
parent_context=None,
|
||||||
tree_node=module_node
|
tree_node=module_node
|
||||||
@@ -158,7 +158,7 @@ class ModuleValue(ModuleMixin, TreeValue):
|
|||||||
# used in them. This could be changed if stubs would be identified
|
# used in them. This could be changed if stubs would be identified
|
||||||
# sooner and used as StubModuleValue.
|
# sooner and used as StubModuleValue.
|
||||||
return True
|
return True
|
||||||
return super(ModuleValue, self).is_stub()
|
return super().is_stub()
|
||||||
|
|
||||||
def py__name__(self):
|
def py__name__(self):
|
||||||
if self.string_names is None:
|
if self.string_names is None:
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class ImplicitNamespaceValue(Value, SubModuleDictMixin):
|
|||||||
parent_context = None
|
parent_context = None
|
||||||
|
|
||||||
def __init__(self, inference_state, string_names, paths):
|
def __init__(self, inference_state, string_names, paths):
|
||||||
super(ImplicitNamespaceValue, self).__init__(inference_state, parent_context=None)
|
super().__init__(inference_state, parent_context=None)
|
||||||
self.inference_state = inference_state
|
self.inference_state = inference_state
|
||||||
self.string_names = string_names
|
self.string_names = string_names
|
||||||
self._paths = paths
|
self._paths = paths
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ def _infer_field(cls, field_name, is_instance):
|
|||||||
|
|
||||||
class DjangoModelName(NameWrapper):
|
class DjangoModelName(NameWrapper):
|
||||||
def __init__(self, cls, name, is_instance):
|
def __init__(self, cls, name, is_instance):
|
||||||
super(DjangoModelName, self).__init__(name)
|
super().__init__(name)
|
||||||
self._cls = cls
|
self._cls = cls
|
||||||
self._is_instance = is_instance
|
self._is_instance = is_instance
|
||||||
|
|
||||||
@@ -258,7 +258,7 @@ class GenericFieldWrapper(AttributeOverwrite, ClassMixin):
|
|||||||
|
|
||||||
class DjangoModelSignature(AbstractSignature):
|
class DjangoModelSignature(AbstractSignature):
|
||||||
def __init__(self, value, field_names):
|
def __init__(self, value, field_names):
|
||||||
super(DjangoModelSignature, self).__init__(value)
|
super().__init__(value)
|
||||||
self._field_names = field_names
|
self._field_names = field_names
|
||||||
|
|
||||||
def get_param_names(self, resolve_stars=False):
|
def get_param_names(self, resolve_stars=False):
|
||||||
@@ -267,7 +267,7 @@ class DjangoModelSignature(AbstractSignature):
|
|||||||
|
|
||||||
class DjangoParamName(BaseTreeParamName):
|
class DjangoParamName(BaseTreeParamName):
|
||||||
def __init__(self, field_name):
|
def __init__(self, field_name):
|
||||||
super(DjangoParamName, self).__init__(field_name.parent_context, field_name.tree_name)
|
super().__init__(field_name.parent_context, field_name.tree_name)
|
||||||
self._field_name = field_name
|
self._field_name = field_name
|
||||||
|
|
||||||
def get_kind(self):
|
def get_kind(self):
|
||||||
@@ -279,7 +279,7 @@ class DjangoParamName(BaseTreeParamName):
|
|||||||
|
|
||||||
class QuerySetMethodWrapper(ValueWrapper):
|
class QuerySetMethodWrapper(ValueWrapper):
|
||||||
def __init__(self, method, model_cls):
|
def __init__(self, method, model_cls):
|
||||||
super(QuerySetMethodWrapper, self).__init__(method)
|
super().__init__(method)
|
||||||
self._model_cls = model_cls
|
self._model_cls = model_cls
|
||||||
|
|
||||||
def py__get__(self, instance, class_value):
|
def py__get__(self, instance, class_value):
|
||||||
@@ -289,7 +289,7 @@ class QuerySetMethodWrapper(ValueWrapper):
|
|||||||
|
|
||||||
class QuerySetBoundMethodWrapper(ValueWrapper):
|
class QuerySetBoundMethodWrapper(ValueWrapper):
|
||||||
def __init__(self, method, model_cls):
|
def __init__(self, method, model_cls):
|
||||||
super(QuerySetBoundMethodWrapper, self).__init__(method)
|
super().__init__(method)
|
||||||
self._model_cls = model_cls
|
self._model_cls = model_cls
|
||||||
|
|
||||||
def get_signatures(self):
|
def get_signatures(self):
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ def _iter_pytest_modules(module_context, skip_own_module=False):
|
|||||||
|
|
||||||
class FixtureFilter(ParserTreeFilter):
|
class FixtureFilter(ParserTreeFilter):
|
||||||
def _filter(self, names):
|
def _filter(self, names):
|
||||||
for name in super(FixtureFilter, self)._filter(names):
|
for name in super()._filter(names):
|
||||||
funcdef = name.parent
|
funcdef = name.parent
|
||||||
if funcdef.type == 'funcdef':
|
if funcdef.type == 'funcdef':
|
||||||
# Class fixtures are not supported
|
# Class fixtures are not supported
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ def builtins_super(types, objects, context):
|
|||||||
|
|
||||||
class ReversedObject(AttributeOverwrite):
|
class ReversedObject(AttributeOverwrite):
|
||||||
def __init__(self, reversed_obj, iter_list):
|
def __init__(self, reversed_obj, iter_list):
|
||||||
super(ReversedObject, self).__init__(reversed_obj)
|
super().__init__(reversed_obj)
|
||||||
self._iter_list = iter_list
|
self._iter_list = iter_list
|
||||||
|
|
||||||
def py__iter__(self, contextualized_node):
|
def py__iter__(self, contextualized_node):
|
||||||
@@ -341,7 +341,7 @@ def builtins_staticmethod(functions):
|
|||||||
|
|
||||||
class ClassMethodObject(ValueWrapper):
|
class ClassMethodObject(ValueWrapper):
|
||||||
def __init__(self, class_method_obj, function):
|
def __init__(self, class_method_obj, function):
|
||||||
super(ClassMethodObject, self).__init__(class_method_obj)
|
super().__init__(class_method_obj)
|
||||||
self._function = function
|
self._function = function
|
||||||
|
|
||||||
def py__get__(self, instance, class_value):
|
def py__get__(self, instance, class_value):
|
||||||
@@ -353,7 +353,7 @@ class ClassMethodObject(ValueWrapper):
|
|||||||
|
|
||||||
class ClassMethodGet(ValueWrapper):
|
class ClassMethodGet(ValueWrapper):
|
||||||
def __init__(self, get_method, klass, function):
|
def __init__(self, get_method, klass, function):
|
||||||
super(ClassMethodGet, self).__init__(get_method)
|
super().__init__(get_method)
|
||||||
self._class = klass
|
self._class = klass
|
||||||
self._function = function
|
self._function = function
|
||||||
|
|
||||||
@@ -366,7 +366,7 @@ class ClassMethodGet(ValueWrapper):
|
|||||||
|
|
||||||
class ClassMethodArguments(TreeArgumentsWrapper):
|
class ClassMethodArguments(TreeArgumentsWrapper):
|
||||||
def __init__(self, klass, arguments):
|
def __init__(self, klass, arguments):
|
||||||
super(ClassMethodArguments, self).__init__(arguments)
|
super().__init__(arguments)
|
||||||
self._class = klass
|
self._class = klass
|
||||||
|
|
||||||
def unpack(self, func=None):
|
def unpack(self, func=None):
|
||||||
@@ -386,7 +386,7 @@ def builtins_classmethod(functions, value, arguments):
|
|||||||
|
|
||||||
class PropertyObject(AttributeOverwrite, ValueWrapper):
|
class PropertyObject(AttributeOverwrite, ValueWrapper):
|
||||||
def __init__(self, property_obj, function):
|
def __init__(self, property_obj, function):
|
||||||
super(PropertyObject, self).__init__(property_obj)
|
super().__init__(property_obj)
|
||||||
self._function = function
|
self._function = function
|
||||||
|
|
||||||
def py__get__(self, instance, class_value):
|
def py__get__(self, instance, class_value):
|
||||||
@@ -470,7 +470,7 @@ def collections_namedtuple(value, arguments, callback):
|
|||||||
|
|
||||||
class PartialObject(ValueWrapper):
|
class PartialObject(ValueWrapper):
|
||||||
def __init__(self, actual_value, arguments, instance=None):
|
def __init__(self, actual_value, arguments, instance=None):
|
||||||
super(PartialObject, self).__init__(actual_value)
|
super().__init__(actual_value)
|
||||||
self._arguments = arguments
|
self._arguments = arguments
|
||||||
self._instance = instance
|
self._instance = instance
|
||||||
|
|
||||||
@@ -533,7 +533,7 @@ class PartialMethodObject(PartialObject):
|
|||||||
|
|
||||||
class PartialSignature(SignatureWrapper):
|
class PartialSignature(SignatureWrapper):
|
||||||
def __init__(self, wrapped_signature, skipped_arg_count, skipped_arg_set):
|
def __init__(self, wrapped_signature, skipped_arg_count, skipped_arg_set):
|
||||||
super(PartialSignature, self).__init__(wrapped_signature)
|
super().__init__(wrapped_signature)
|
||||||
self._skipped_arg_count = skipped_arg_count
|
self._skipped_arg_count = skipped_arg_count
|
||||||
self._skipped_arg_set = skipped_arg_set
|
self._skipped_arg_set = skipped_arg_set
|
||||||
|
|
||||||
@@ -626,7 +626,7 @@ class DataclassWrapper(ValueWrapper, ClassMixin):
|
|||||||
|
|
||||||
class DataclassSignature(AbstractSignature):
|
class DataclassSignature(AbstractSignature):
|
||||||
def __init__(self, value, param_names):
|
def __init__(self, value, param_names):
|
||||||
super(DataclassSignature, self).__init__(value)
|
super().__init__(value)
|
||||||
self._param_names = param_names
|
self._param_names = param_names
|
||||||
|
|
||||||
def get_param_names(self, resolve_stars=False):
|
def get_param_names(self, resolve_stars=False):
|
||||||
@@ -635,7 +635,7 @@ class DataclassSignature(AbstractSignature):
|
|||||||
|
|
||||||
class DataclassParamName(BaseTreeParamName):
|
class DataclassParamName(BaseTreeParamName):
|
||||||
def __init__(self, parent_context, tree_name, annotation_node, default_node):
|
def __init__(self, parent_context, tree_name, annotation_node, default_node):
|
||||||
super(DataclassParamName, self).__init__(parent_context, tree_name)
|
super().__init__(parent_context, tree_name)
|
||||||
self.annotation_node = annotation_node
|
self.annotation_node = annotation_node
|
||||||
self.default_node = default_node
|
self.default_node = default_node
|
||||||
|
|
||||||
@@ -651,7 +651,7 @@ class DataclassParamName(BaseTreeParamName):
|
|||||||
|
|
||||||
class ItemGetterCallable(ValueWrapper):
|
class ItemGetterCallable(ValueWrapper):
|
||||||
def __init__(self, instance, args_value_set):
|
def __init__(self, instance, args_value_set):
|
||||||
super(ItemGetterCallable, self).__init__(instance)
|
super().__init__(instance)
|
||||||
self._args_value_set = args_value_set
|
self._args_value_set = args_value_set
|
||||||
|
|
||||||
@repack_with_argument_clinic('item, /')
|
@repack_with_argument_clinic('item, /')
|
||||||
@@ -689,7 +689,7 @@ class WrapsCallable(ValueWrapper):
|
|||||||
|
|
||||||
class Wrapped(ValueWrapper, FunctionMixin):
|
class Wrapped(ValueWrapper, FunctionMixin):
|
||||||
def __init__(self, func, original_function):
|
def __init__(self, func, original_function):
|
||||||
super(Wrapped, self).__init__(func)
|
super().__init__(func)
|
||||||
self._original_function = original_function
|
self._original_function = original_function
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class BaseTestCase(object):
|
|||||||
class IntegrationTestCase(BaseTestCase):
|
class IntegrationTestCase(BaseTestCase):
|
||||||
def __init__(self, test_type, correct, line_nr, column, start, line,
|
def __init__(self, test_type, correct, line_nr, column, start, line,
|
||||||
path=None, skip_version_info=None):
|
path=None, skip_version_info=None):
|
||||||
super(IntegrationTestCase, self).__init__(skip_version_info)
|
super().__init__(skip_version_info)
|
||||||
self.test_type = test_type
|
self.test_type = test_type
|
||||||
self.correct = correct
|
self.correct = correct
|
||||||
self.line_nr = line_nr
|
self.line_nr = line_nr
|
||||||
@@ -294,7 +294,7 @@ class StaticAnalysisCase(BaseTestCase):
|
|||||||
for line in self._source.splitlines():
|
for line in self._source.splitlines():
|
||||||
skip_version_info = skip_python_version(line) or skip_version_info
|
skip_version_info = skip_python_version(line) or skip_version_info
|
||||||
|
|
||||||
super(StaticAnalysisCase, self).__init__(skip_version_info)
|
super().__init__(skip_version_info)
|
||||||
|
|
||||||
def collect_comparison(self):
|
def collect_comparison(self):
|
||||||
cases = []
|
cases = []
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class TestSetupReadline(unittest.TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(type(self), self).__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.namespace = self.NameSpace()
|
self.namespace = self.NameSpace()
|
||||||
utils.setup_readline(self.namespace)
|
utils.setup_readline(self.namespace)
|
||||||
|
|||||||
Reference in New Issue
Block a user