Remove object inheritance

This commit is contained in:
Dave Halter
2020-07-25 18:20:56 +02:00
parent 3c3c0b54dc
commit dcc756a373
16 changed files with 24 additions and 24 deletions
+3 -3
View File
@@ -247,7 +247,7 @@ def _update_positions(nodes, line_offset, last_leaf):
_update_positions(children, line_offset, last_leaf)
class DiffParser(object):
class DiffParser:
"""
An advanced form of parsing a file faster. Unfortunately comes with huge
side effects. It changes the given module.
@@ -514,7 +514,7 @@ class DiffParser(object):
yield token
class _NodesTreeNode(object):
class _NodesTreeNode:
_ChildrenGroup = namedtuple(
'_ChildrenGroup',
'prefix children line_offset last_line_offset_leaf')
@@ -589,7 +589,7 @@ class _NodesTreeNode(object):
return '<%s: %s>' % (self.__class__.__name__, self.tree_node)
class _NodesTree(object):
class _NodesTree:
def __init__(self, module):
self._base_node = _NodesTreeNode(module)
self._working_stack = [self._base_node]
+1 -1
View File
@@ -222,7 +222,7 @@ def _any_fstring_error(version, node):
return search_ancestor(node, "fstring")
class _Context(object):
class _Context:
def __init__(self, node, add_syntax_error, parent_context=None):
self.node = node
self.blocks = []
+1 -1
View File
@@ -26,7 +26,7 @@ _IMPLICIT_INDENTATION_TYPES = ('dictorsetmaker', 'argument')
_POSSIBLE_SLICE_PARENTS = ('subscript', 'subscriptlist', 'sliceop')
class IndentationTypes(object):
class IndentationTypes:
VERTICAL_BRACKET = object()
HANGING_BRACKET = object()
BACKSLASH = object()
+1 -1
View File
@@ -6,7 +6,7 @@ from parso.python.tokenize import group
unicode_bom = BOM_UTF8.decode('utf-8')
class PrefixPart(object):
class PrefixPart:
def __init__(self, leaf, typ, value, spacing='', start_pos=None):
assert start_pos is not None
self.parent = leaf
+1 -1
View File
@@ -3,7 +3,7 @@ from __future__ import absolute_import
from enum import Enum
class TokenType(object):
class TokenType:
name: str
contains_syntax: bool
+1 -1
View File
@@ -246,7 +246,7 @@ class PythonToken(Token):
self._replace(type=self.type.name))
class FStringNode(object):
class FStringNode:
def __init__(self, quote):
self.quote = quote
self.parentheses_count = 0
+3 -3
View File
@@ -68,7 +68,7 @@ _GET_DEFINITION_TYPES = set([
_IMPORTS = set(['import_name', 'import_from'])
class DocstringMixin(object):
class DocstringMixin:
__slots__ = ()
def get_doc_node(self):
@@ -96,7 +96,7 @@ class DocstringMixin(object):
return None
class PythonMixin(object):
class PythonMixin:
"""
Some Python specific utilities.
"""
@@ -296,7 +296,7 @@ class FStringEnd(PythonLeaf):
__slots__ = ()
class _StringComparisonMixin(object):
class _StringComparisonMixin:
def __eq__(self, other):
"""
Make comparisons with strings easy.