Skip to content

Commit

Permalink
Removed unneeded object inheritance
Browse files Browse the repository at this point in the history
It was used in Python 2 to specify new class types.
  • Loading branch information
claudep committed May 28, 2022
1 parent 9b1aa55 commit ee429a7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cssselect2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
VERSION = __version__ = '0.6.0'


class Matcher(object):
class Matcher:
"""A CSS selectors storage that can match against HTML elements."""
def __init__(self):
self.id_selectors = {}
Expand Down
2 changes: 1 addition & 1 deletion cssselect2/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def compile_selector_list(input, namespaces=None):
]


class CompiledSelector(object):
class CompiledSelector:
"""Abstract representation of a selector."""
def __init__(self, parsed_selector):
source = _compile_node(parsed_selector.parsed_tree)
Expand Down
22 changes: 11 additions & 11 deletions cssselect2/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class SelectorError(ValueError):
"""A specialized ``ValueError`` for invalid selectors."""


class TokenStream(object):
class TokenStream:
def __init__(self, tokens):
self.tokens = iter(tokens)
self.peeked = [] # In reversed order
Expand Down Expand Up @@ -299,7 +299,7 @@ def skip_whitespace_and_comment(self):
return self.skip(['comment', 'whitespace'])


class Selector(object):
class Selector:
def __init__(self, tree, pseudo_element=None):
self.parsed_tree = tree
if pseudo_element is None:
Expand All @@ -318,7 +318,7 @@ def __repr__(self):
return '%r::%s' % (self.parsed_tree, self.pseudo_element)


class CombinedSelector(object):
class CombinedSelector:
def __init__(self, left, combinator, right):
#: Combined or compound selector
self.left = left
Expand All @@ -337,7 +337,7 @@ def __repr__(self):
return '%r%s%r' % (self.left, self.combinator, self.right)


class CompoundSelector(object):
class CompoundSelector:
"""Aka. sequence of simple selectors, in Level 3."""
def __init__(self, simple_selectors):
self.simple_selectors = simple_selectors
Expand All @@ -356,7 +356,7 @@ def __repr__(self):
return ''.join(map(repr, self.simple_selectors))


class LocalNameSelector(object):
class LocalNameSelector:
specificity = 0, 0, 1

def __init__(self, local_name):
Expand All @@ -366,7 +366,7 @@ def __repr__(self):
return self.local_name


class NamespaceSelector(object):
class NamespaceSelector:
specificity = 0, 0, 0

def __init__(self, namespace):
Expand All @@ -381,7 +381,7 @@ def __repr__(self):
return '{%s}|' % self.namespace


class IDSelector(object):
class IDSelector:
specificity = 1, 0, 0

def __init__(self, ident):
Expand All @@ -391,7 +391,7 @@ def __repr__(self):
return '#' + self.ident


class ClassSelector(object):
class ClassSelector:
specificity = 0, 1, 0

def __init__(self, class_name):
Expand All @@ -401,7 +401,7 @@ def __repr__(self):
return '.' + self.class_name


class AttributeSelector(object):
class AttributeSelector:
specificity = 0, 1, 0

def __init__(self, namespace, name, operator, value):
Expand All @@ -418,7 +418,7 @@ def __repr__(self):
return '[%s%s%s%r]' % (namespace, self.name, self.operator, self.value)


class PseudoClassSelector(object):
class PseudoClassSelector:
specificity = 0, 1, 0

def __init__(self, name):
Expand All @@ -428,7 +428,7 @@ def __repr__(self):
return ':' + self.name


class FunctionalPseudoClassSelector(object):
class FunctionalPseudoClassSelector:
specificity = 0, 1, 0

def __init__(self, name, arguments):
Expand Down
4 changes: 2 additions & 2 deletions cssselect2/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .compiler import compile_selector_list, split_whitespace


class cached_property(object):
class cached_property:
# Borrowed from Werkzeug
# https://github.com/mitsuhiko/werkzeug/blob/master/werkzeug/utils.py

Expand All @@ -25,7 +25,7 @@ def __get__(self, obj, type=None, __missing=object()):
return value


class ElementWrapper(object):
class ElementWrapper:
"""
A wrapper for an ElementTree :class:`xml.etree.ElementTree.Element`
for Selector matching.
Expand Down

0 comments on commit ee429a7

Please sign in to comment.