From d1fd32fd5be004a81225a0496382e03d2a19eef6 Mon Sep 17 00:00:00 2001 From: Nikita Karamov Date: Mon, 23 Jan 2023 06:45:59 +0100 Subject: [PATCH] Do not explicitly extend object --- scour/scour.py | 4 ++-- scour/stats.py | 2 +- scour/svg_regex.py | 6 +++--- scour/svg_transform.py | 6 +++--- test_scour.py | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scour/scour.py b/scour/scour.py index 5bb4ee1..479f6c8 100644 --- a/scour/scour.py +++ b/scour/scour.py @@ -421,7 +421,7 @@ sciExponent = re.compile(r"[eE]([-+]?\d+)") unit = re.compile("(em|ex|px|pt|pc|cm|mm|in|%){1,1}$") -class Unit(object): +class Unit: # Integer constants for units. INVALID = -1 NONE = 0 @@ -483,7 +483,7 @@ class Unit(object): str = staticmethod(str) -class SVGLength(object): +class SVGLength: def __init__(self, str): try: # simple unitless and no scientific notation diff --git a/scour/stats.py b/scour/stats.py index 2762b92..5a1e59e 100644 --- a/scour/stats.py +++ b/scour/stats.py @@ -1,4 +1,4 @@ -class ScourStats(object): +class ScourStats: __slots__ = ( 'num_elements_removed', diff --git a/scour/svg_regex.py b/scour/svg_regex.py index f91063c..abba621 100644 --- a/scour/svg_regex.py +++ b/scour/svg_regex.py @@ -50,7 +50,7 @@ from functools import partial # Sentinel. -class _EOF(object): +class _EOF: def __repr__(self): return 'EOF' @@ -65,7 +65,7 @@ lexicon = [ ] -class Lexer(object): +class Lexer: """ Break SVG path data into tokens. The SVG spec requires that tokens are greedy. This lexer relies on Python's @@ -102,7 +102,7 @@ class Lexer(object): svg_lexer = Lexer(lexicon) -class SVGPathParser(object): +class SVGPathParser: """ Parse SVG data into a list of commands. Each distinct command will take the form of a tuple (command, data). The diff --git a/scour/svg_transform.py b/scour/svg_transform.py index 769c48c..25aaec4 100644 --- a/scour/svg_transform.py +++ b/scour/svg_transform.py @@ -64,7 +64,7 @@ from six.moves import range # Sentinel. -class _EOF(object): +class _EOF: def __repr__(self): return 'EOF' @@ -81,7 +81,7 @@ lexicon = [ ] -class Lexer(object): +class Lexer: """ Break SVG path data into tokens. The SVG spec requires that tokens are greedy. This lexer relies on Python's @@ -118,7 +118,7 @@ class Lexer(object): svg_lexer = Lexer(lexicon) -class SVGTransformationParser(object): +class SVGTransformationParser: """ Parse SVG transform="" data into a list of commands. Each distinct command will take the form of a tuple (type, data). The diff --git a/test_scour.py b/test_scour.py index f4f3bda..ba28815 100755 --- a/test_scour.py +++ b/test_scour.py @@ -2550,7 +2550,7 @@ class CommandLineUsage(unittest.TestCase): # stdout: a string representing the combined output to 'stdout' # stderr: a string representing the combined output to 'stderr' def _run_scour(self): - class Result(object): + class Result: pass result = Result() @@ -2578,7 +2578,7 @@ class CommandLineUsage(unittest.TestCase): # TODO: can we create file objects that behave *exactly* like the original? # this is a mess since we have to ensure compatibility across Python 2 and 3 and it seems impossible # to replicate all the details of 'stdin', 'stdout' and 'stderr' - class InOutBuffer(six.StringIO, object): + class InOutBuffer(six.StringIO): def write(self, string): try: return super(InOutBuffer, self).write(string)