Skip to content

Commit

Permalink
Fix the new violations of super-without-arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
PCManticore committed May 12, 2020
1 parent 54b7a11 commit 8a961d2
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 48 deletions.
2 changes: 1 addition & 1 deletion astroid/bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ def infer_call_result(self, caller, context=None):
if new_cls:
return iter((new_cls,))

return super(BoundMethod, self).infer_call_result(caller, context)
return super().infer_call_result(caller, context)

def bool_value(self, context=None):
return True
Expand Down
2 changes: 1 addition & 1 deletion astroid/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class AstroidBuilder(raw_building.InspectBuilder):

# pylint: disable=redefined-outer-name
def __init__(self, manager=None, apply_transforms=True):
super(AstroidBuilder, self).__init__()
super().__init__()
self._manager = manager or MANAGER
self._apply_transforms = apply_transforms

Expand Down
14 changes: 7 additions & 7 deletions astroid/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class AstroidError(Exception):
"""

def __init__(self, message="", **kws):
super(AstroidError, self).__init__(message)
super().__init__(message)
self.message = message
for key, value in kws.items():
setattr(self, key, value)
Expand All @@ -46,7 +46,7 @@ class AstroidBuildingError(AstroidError):
"""

def __init__(self, message="Failed to import module {modname}.", **kws):
super(AstroidBuildingError, self).__init__(message, **kws)
super().__init__(message, **kws)


class AstroidImportError(AstroidBuildingError):
Expand All @@ -69,7 +69,7 @@ def __init__(
message="Relative import with too many levels " "({level}) for module {name!r}",
**kws
):
super(TooManyLevelsError, self).__init__(message, **kws)
super().__init__(message, **kws)


class AstroidSyntaxError(AstroidBuildingError):
Expand All @@ -89,7 +89,7 @@ class NoDefault(AstroidError):
name = None

def __init__(self, message="{func!r} has no default for {name!r}.", **kws):
super(NoDefault, self).__init__(message, **kws)
super().__init__(message, **kws)


class ResolveError(AstroidError):
Expand Down Expand Up @@ -157,7 +157,7 @@ class InferenceError(ResolveError):
context = None

def __init__(self, message="Inference failed for {node!r}.", **kws):
super(InferenceError, self).__init__(message, **kws)
super().__init__(message, **kws)


# Why does this inherit from InferenceError rather than ResolveError?
Expand All @@ -175,7 +175,7 @@ class NameInferenceError(InferenceError):
scope = None

def __init__(self, message="{name!r} not found in {scope!r}.", **kws):
super(NameInferenceError, self).__init__(message, **kws)
super().__init__(message, **kws)


class AttributeInferenceError(ResolveError):
Expand All @@ -191,7 +191,7 @@ class AttributeInferenceError(ResolveError):
attribute = None

def __init__(self, message="{attribute!r} not found on {target!r}.", **kws):
super(AttributeInferenceError, self).__init__(message, **kws)
super().__init__(message, **kws)


class UseInferenceDefault(Exception):
Expand Down
2 changes: 1 addition & 1 deletion astroid/interpreter/_import/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ class ZipFinder(Finder):
"""Finder that knows how to find a module inside zip files."""

def __init__(self, path):
super(ZipFinder, self).__init__(path)
super().__init__(path)
self._zipimporters = _precache_zipimporters(path)

def find_module(self, modname, module_parts, processed, submodule_path):
Expand Down
58 changes: 27 additions & 31 deletions astroid/node_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: list(NodeNG)
"""

super(_BaseContainer, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, elts):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -1286,7 +1286,7 @@ def __init__(self, name=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(AssignName, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)


class DelName(
Expand Down Expand Up @@ -1326,7 +1326,7 @@ def __init__(self, name=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(DelName, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)


class Name(mixins.NoChildrenMixin, LookupMixIn, NodeNG):
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def __init__(self, name=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(Name, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def _get_name_nodes(self):
yield self
Expand Down Expand Up @@ -1439,7 +1439,7 @@ def __init__(self, vararg=None, kwarg=None, parent=None):
:param parent: The parent node in the syntax tree.
:type parent: NodeNG or None
"""
super(Arguments, self).__init__(parent=parent)
super().__init__(parent=parent)
self.vararg = vararg
"""The name of the variable length arguments.
Expand Down Expand Up @@ -1626,7 +1626,7 @@ def fromlineno(self):
:type: int or None
"""
lineno = super(Arguments, self).fromlineno
lineno = super().fromlineno
return max(lineno, self.parent.fromlineno or 0)

@decorators.cachedproperty
Expand Down Expand Up @@ -1846,7 +1846,7 @@ def __init__(self, attrname=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(AssignAttr, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, expr=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -2065,7 +2065,7 @@ def __init__(self, op=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(AugAssign, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, target=None, value=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -2178,7 +2178,7 @@ def __init__(self, op=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(BinOp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, left=None, right=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -2266,7 +2266,7 @@ def __init__(self, op=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(BoolOp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, values=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -2464,7 +2464,7 @@ def __init__(self, parent=None):
:param parent: The parent node in the syntax tree.
:type parent: NodeNG or None
"""
super(Comprehension, self).__init__()
super().__init__()
self.parent = parent

# pylint: disable=redefined-builtin; same name as builtin ast module.
Expand Down Expand Up @@ -2561,7 +2561,7 @@ def __init__(self, value, lineno=None, col_offset=None, parent=None):
:type: object
"""

super(Const, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def __getattr__(self, name):
# This is needed because of Proxy's __getattr__ method.
Expand Down Expand Up @@ -2742,7 +2742,7 @@ def __init__(self, attrname=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(DelAttr, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, expr=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -2815,7 +2815,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: list(tuple(NodeNG, NodeNG))
"""

super(Dict, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, items):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -3347,7 +3347,7 @@ def __init__(
:type: int
"""

super(ImportFrom, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)


class Attribute(NodeNG):
Expand Down Expand Up @@ -3382,7 +3382,7 @@ def __init__(self, attrname=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(Attribute, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, expr=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -3427,7 +3427,7 @@ def __init__(self, names, lineno=None, col_offset=None, parent=None):
:type: list(str)
"""

super(Global, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def _infer_name(self, frame, name):
return name
Expand Down Expand Up @@ -3595,7 +3595,7 @@ def __init__(self, names=None, lineno=None, col_offset=None, parent=None):
:type: list(tuple(str, str or None)) or None
"""

super(Import, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)


class Index(NodeNG):
Expand Down Expand Up @@ -3668,7 +3668,7 @@ def __init__(self, arg=None, lineno=None, col_offset=None, parent=None):
:type: Name or None
"""

super(Keyword, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, value=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -3713,7 +3713,7 @@ def __init__(self, ctx=None, lineno=None, col_offset=None, parent=None):
:type: Context or None
"""

super(List, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def pytype(self):
"""Get the name of the type that this node represents.
Expand Down Expand Up @@ -3768,7 +3768,7 @@ def __init__(self, names, lineno=None, col_offset=None, parent=None):
:type: list(str)
"""

super(Nonlocal, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def _infer_name(self, frame, name):
return name
Expand Down Expand Up @@ -3824,7 +3824,7 @@ def __init__(self, nl=None, lineno=None, col_offset=None, parent=None):
:type: bool or None
"""

super(Print, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, dest=None, values=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -4077,9 +4077,7 @@ def __init__(self, ctx=None, lineno=None, col_offset=None, parent=None):
:type: Context or None
"""

super(Starred, self).__init__(
lineno=lineno, col_offset=col_offset, parent=parent
)
super().__init__(lineno=lineno, col_offset=col_offset, parent=parent)

def postinit(self, value=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -4135,9 +4133,7 @@ def __init__(self, ctx=None, lineno=None, col_offset=None, parent=None):
:type: Context or None
"""

super(Subscript, self).__init__(
lineno=lineno, col_offset=col_offset, parent=parent
)
super().__init__(lineno=lineno, col_offset=col_offset, parent=parent)

# pylint: disable=redefined-builtin; had to use the same name as builtin ast module.
def postinit(self, value=None, slice=None):
Expand Down Expand Up @@ -4330,7 +4326,7 @@ def __init__(self, ctx=None, lineno=None, col_offset=None, parent=None):
:type: Context or None
"""

super(Tuple, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def pytype(self):
"""Get the name of the type that this node represents.
Expand Down Expand Up @@ -4386,7 +4382,7 @@ def __init__(self, op=None, lineno=None, col_offset=None, parent=None):
:type: str or None
"""

super(UnaryOp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, operand=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -4773,7 +4769,7 @@ class EvaluatedObject(NodeNG):
def __init__(self, original, value):
self.original = original
self.value = value
super(EvaluatedObject, self).__init__(
super().__init__(
lineno=self.original.lineno,
col_offset=self.original.col_offset,
parent=self.original.parent,
Expand Down
14 changes: 7 additions & 7 deletions astroid/scoped_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: dict(str, NodeNG)
"""

super(GeneratorExp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, elt=None, generators=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -890,7 +890,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: dict(str, NodeNG)
"""

super(DictComp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, key=None, value=None, generators=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -966,7 +966,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: dict(str, NodeNG)
"""

super(SetComp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, elt=None, generators=None):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -1062,7 +1062,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: dict(str, NodeNG)
"""

super(ListComp, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)


def _infer_decorator_callchain(node):
Expand Down Expand Up @@ -1162,7 +1162,7 @@ def __init__(self, lineno=None, col_offset=None, parent=None):
:type: list(NodeNG)
"""

super(Lambda, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)

def postinit(self, args, body):
"""Do some setup after initialisation.
Expand Down Expand Up @@ -1367,7 +1367,7 @@ def __init__(self, name=None, doc=None, lineno=None, col_offset=None, parent=Non
"""

self.instance_attrs = {}
super(FunctionDef, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)
if parent:
frame = parent.frame()
frame.set_local(name, self)
Expand Down Expand Up @@ -1974,7 +1974,7 @@ def __init__(self, name=None, doc=None, lineno=None, col_offset=None, parent=Non
:type doc: str or None
"""

super(ClassDef, self).__init__(lineno, col_offset, parent)
super().__init__(lineno, col_offset, parent)
if parent is not None:
parent.frame().set_local(name, self)

Expand Down

0 comments on commit 8a961d2

Please sign in to comment.