From 97c10facf7e78f9acb670cf3e3c056cceb764c5e Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Sat, 25 Jul 2020 18:23:18 +0200 Subject: [PATCH] Remove super arguments --- parso/file_io.py | 2 +- parso/grammar.py | 2 +- parso/normalizer.py | 4 ++-- parso/python/errors.py | 10 +++++----- parso/python/parser.py | 8 ++++---- parso/python/pep8.py | 10 +++++----- parso/python/tree.py | 12 ++++++------ parso/tree.py | 6 +++--- parso/utils.py | 4 ++-- test/test_cache.py | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/parso/file_io.py b/parso/file_io.py index 722e7ba..8874466 100644 --- a/parso/file_io.py +++ b/parso/file_io.py @@ -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): diff --git a/parso/grammar.py b/parso/grammar.py index f5ae8aa..f0e6684 100644 --- a/parso/grammar.py +++ b/parso/grammar.py @@ -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, diff --git a/parso/normalizer.py b/parso/normalizer.py index fddb88f..a95f029 100644 --- a/parso/normalizer.py +++ b/parso/normalizer.py @@ -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) diff --git a/parso/python/errors.py b/parso/python/errors.py index 9d28e54..d8343c7 100644 --- a/parso/python/errors.py +++ b/parso/python/errors.py @@ -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) diff --git a/parso/python/parser.py b/parso/python/parser.py index 7e3794d..5cc3ced 100644 --- a/parso/python/parser.py +++ b/parso/python/parser.py @@ -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 diff --git a/parso/python/pep8.py b/parso/python/pep8.py index d3eb345..b472e8b 100644 --- a/parso/python/pep8.py +++ b/parso/python/pep8.py @@ -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) diff --git a/parso/python/tree.py b/parso/python/tree.py index 04fbe71..60696d0 100644 --- a/parso/python/tree.py +++ b/parso/python/tree.py @@ -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] == ',': diff --git a/parso/tree.py b/parso/tree.py index 2c7312d..311f2c0 100644 --- a/parso/tree.py +++ b/parso/tree.py @@ -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): diff --git a/parso/utils.py b/parso/utils.py index 4368f79..e3d9038 100644 --- a/parso/utils.py +++ b/parso/utils.py @@ -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) diff --git a/test/test_cache.py b/test/test_cache.py index 2706827..d5e4397 100644 --- a/test/test_cache.py +++ b/test/test_cache.py @@ -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):