Remove super arguments

This commit is contained in:
Dave Halter
2020-07-25 18:23:18 +02:00
parent dcc756a373
commit 97c10facf7
10 changed files with 30 additions and 30 deletions

View File

@@ -38,7 +38,7 @@ class FileIO:
class KnownContentFileIO(FileIO):
def __init__(self, path, content):
super(KnownContentFileIO, self).__init__(path)
super().__init__(path)
self._content = content
def read(self):

View File

@@ -209,7 +209,7 @@ class PythonGrammar(Grammar):
_start_nonterminal = 'file_input'
def __init__(self, version_info: PythonVersionInfo, bnf_text: str):
super(PythonGrammar, self).__init__(
super().__init__(
bnf_text,
tokenizer=self._tokenize_lines,
parser=PythonParser,

View File

@@ -189,10 +189,10 @@ class RefactoringNormalizer(Normalizer):
try:
return self._node_to_str_map[node]
except KeyError:
return super(RefactoringNormalizer, self).visit(node)
return super().visit(node)
def visit_leaf(self, leaf):
try:
return self._node_to_str_map[leaf]
except KeyError:
return super(RefactoringNormalizer, self).visit_leaf(leaf)
return super().visit_leaf(leaf)

View File

@@ -350,7 +350,7 @@ class ErrorFinder(Normalizer):
Searches for errors in the syntax tree.
"""
def __init__(self, *args, **kwargs):
super(ErrorFinder, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._error_dict = {}
self.version = self.grammar.version_info
@@ -374,7 +374,7 @@ class ErrorFinder(Normalizer):
# might find errors in there that should be ignored, because
# the error node itself already shows that there's an issue.
return ''
return super(ErrorFinder, self).visit(node)
return super().visit(node)
@contextmanager
def visit_node(self, node):
@@ -439,7 +439,7 @@ class ErrorFinder(Normalizer):
self.context = self.context.add_context(parent)
# The rest is rule based.
return super(ErrorFinder, self).visit_leaf(leaf)
return super().visit_leaf(leaf)
def _add_indentation_error(self, spacing, message):
self.add_issue(spacing, 903, "IndentationError: " + message)
@@ -465,7 +465,7 @@ class IndentationRule(Rule):
code = 903
def _get_message(self, message, node):
message = super(IndentationRule, self)._get_message(message, node)
message = super()._get_message(message, node)
return "IndentationError: " + message
@@ -490,7 +490,7 @@ class SyntaxRule(Rule):
code = 901
def _get_message(self, message, node):
message = super(SyntaxRule, self)._get_message(message, node)
message = super()._get_message(message, node)
if (
"f-string" not in message
and _any_fstring_error(self._normalizer.version, node)

View File

@@ -61,8 +61,8 @@ class Parser(BaseParser):
}
def __init__(self, pgen_grammar, error_recovery=True, start_nonterminal='file_input'):
super(Parser, self).__init__(pgen_grammar, start_nonterminal,
error_recovery=error_recovery)
super().__init__(pgen_grammar, start_nonterminal,
error_recovery=error_recovery)
self.syntax_errors = []
self._omit_dedent_list = []
@@ -75,7 +75,7 @@ class Parser(BaseParser):
tokens = self._recovery_tokenize(tokens)
return super(Parser, self).parse(tokens)
return super().parse(tokens)
def convert_node(self, nonterminal, children):
"""
@@ -138,7 +138,7 @@ class Parser(BaseParser):
return
if not self._error_recovery:
return super(Parser, self).error_recovery(token)
return super().error_recovery(token)
def current_suite(stack):
# For now just discard everything that is not a suite or

View File

@@ -112,7 +112,7 @@ class ImplicitNode(BracketNode):
annotations and dict values.
"""
def __init__(self, config, leaf, parent):
super(ImplicitNode, self).__init__(config, leaf, parent)
super().__init__(config, leaf, parent)
self.type = IndentationTypes.IMPLICIT
next_leaf = leaf.get_next_leaf()
@@ -151,7 +151,7 @@ def _is_magic_name(name):
class PEP8Normalizer(ErrorFinder):
def __init__(self, *args, **kwargs):
super(PEP8Normalizer, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._previous_part = None
self._previous_leaf = None
self._on_newline = True
@@ -174,7 +174,7 @@ class PEP8Normalizer(ErrorFinder):
@contextmanager
def visit_node(self, node):
with super(PEP8Normalizer, self).visit_node(node):
with super().visit_node(node):
with self._visit_node(node):
yield
@@ -342,7 +342,7 @@ class PEP8Normalizer(ErrorFinder):
self._newline_count = 0
def visit_leaf(self, leaf):
super(PEP8Normalizer, self).visit_leaf(leaf)
super().visit_leaf(leaf)
for part in leaf._split_prefix():
if part.type == 'spacing':
# This part is used for the part call after for.
@@ -732,7 +732,7 @@ class PEP8Normalizer(ErrorFinder):
return
if code in (901, 903):
# 901 and 903 are raised by the ErrorFinder.
super(PEP8Normalizer, self).add_issue(node, code, message)
super().add_issue(node, code, message)
else:
# Skip ErrorFinder here, because it has custom behavior.
super(ErrorFinder, self).add_issue(node, code, message)

View File

@@ -330,7 +330,7 @@ class Scope(PythonBaseNode, DocstringMixin):
__slots__ = ()
def __init__(self, children):
super(Scope, self).__init__(children)
super().__init__(children)
def iter_funcdefs(self):
"""
@@ -386,7 +386,7 @@ class Module(Scope):
type = 'file_input'
def __init__(self, children):
super(Module, self).__init__(children)
super().__init__(children)
self._used_names = None
def _iter_future_import_names(self):
@@ -470,7 +470,7 @@ class Class(ClassOrFunc):
__slots__ = ()
def __init__(self, children):
super(Class, self).__init__(children)
super().__init__(children)
def get_super_arglist(self):
"""
@@ -548,7 +548,7 @@ class Function(ClassOrFunc):
type = 'funcdef'
def __init__(self, children):
super(Function, self).__init__(children)
super().__init__(children)
parameters = self.children[2] # After `def foo`
parameters.children[1:-1] = _create_params(parameters, parameters.children[1:-1])
@@ -1075,7 +1075,7 @@ class Param(PythonBaseNode):
type = 'param'
def __init__(self, children, parent):
super(Param, self).__init__(children)
super().__init__(children)
self.parent = parent
for child in children:
child.parent = self
@@ -1175,7 +1175,7 @@ class Param(PythonBaseNode):
:param include_comma bool: If enabled includes the comma in the string output.
"""
if include_comma:
return super(Param, self).get_code(include_prefix)
return super().get_code(include_prefix)
children = self.children
if children[-1] == ',':

View File

@@ -247,7 +247,7 @@ class TypedLeaf(Leaf):
__slots__ = ('type',)
def __init__(self, type, value, start_pos, prefix=''):
super(TypedLeaf, self).__init__(value, start_pos, prefix)
super().__init__(value, start_pos, prefix)
self.type = type
@@ -339,7 +339,7 @@ class Node(BaseNode):
__slots__ = ('type',)
def __init__(self, type, children):
super(Node, self).__init__(children)
super().__init__(children)
self.type = type
def __repr__(self):
@@ -365,7 +365,7 @@ class ErrorLeaf(Leaf):
type = 'error_leaf'
def __init__(self, token_type, value, start_pos, prefix=''):
super(ErrorLeaf, self).__init__(value, start_pos, prefix)
super().__init__(value, start_pos, prefix)
self.token_type = token_type
def __repr__(self):

View File

@@ -144,7 +144,7 @@ class PythonVersionInfo(_PythonVersionInfo):
if len(other) != 2:
raise ValueError("Can only compare to tuples of length 2.")
return (self.major, self.minor) > other
super(PythonVersionInfo, self).__gt__(other)
super().__gt__(other)
return (self.major, self.minor)
@@ -153,7 +153,7 @@ class PythonVersionInfo(_PythonVersionInfo):
if len(other) != 2:
raise ValueError("Can only compare to tuples of length 2.")
return (self.major, self.minor) == other
super(PythonVersionInfo, self).__eq__(other)
super().__eq__(other)
def __ne__(self, other):
return not self.__eq__(other)

View File

@@ -124,7 +124,7 @@ def test_cache_limit():
class _FixedTimeFileIO(file_io.KnownContentFileIO):
def __init__(self, path, content, last_modified):
super(_FixedTimeFileIO, self).__init__(path, content)
super().__init__(path, content)
self._last_modified = last_modified
def get_last_modified(self):