From 95441dafd4819c5f1dde3f4a4eeeba288e4901c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= <6774676+eumiro@users.noreply.github.com> Date: Fri, 22 Jan 2021 13:27:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20Use=20Python3=20default=20for=20?= =?UTF-8?q?class=20inheriting=20from=20object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/sphinxext/codeblockext.py | 6 +++--- src/octoprint/access/permissions.py | 2 +- src/octoprint_client/__init__.py | 4 ++-- tests/filemanager/test_localstorage.py | 2 +- tests/manual_tests/always_update.py | 2 +- tests/plugin/test_core.py | 8 ++++---- tests/slicing/test_slicingmanager.py | 2 +- tests/util/test_repeated_timer.py | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/sphinxext/codeblockext.py b/docs/sphinxext/codeblockext.py index 93ed7c988..645a88d55 100644 --- a/docs/sphinxext/codeblockext.py +++ b/docs/sphinxext/codeblockext.py @@ -107,7 +107,7 @@ class CodeBlockExt(CodeBlock): return literal -class PygmentsBridgeExt(object): +class PygmentsBridgeExt: """ Wrapper for :class:`PygmentsBridge`, delegates everything to the wrapped ``bridge`` but :method:`highlight_block`, which calls the parent implementation for lexer selection, then @@ -133,7 +133,7 @@ class PygmentsBridgeExt(object): # For this we define a context manager that will allow us to wrap a lexer and modify its filters on the fly to # include the whitespace filter. - class whitespace(object): + class whitespace: def __init__(self, lexer): self._lexer = lexer self._orig_filters = lexer.filters @@ -229,7 +229,7 @@ class PygmentsBridgeExt(object): return hlsource -class whitespace_highlighter(object): +class whitespace_highlighter: """ Context manager for adapting the used highlighter on a translator for a given node's whitespace properties. """ diff --git a/src/octoprint/access/permissions.py b/src/octoprint/access/permissions.py index 16b645818..d766b4b30 100644 --- a/src/octoprint/access/permissions.py +++ b/src/octoprint/access/permissions.py @@ -267,7 +267,7 @@ class PermissionsMetaClass(type): return None -class Permissions(object, metaclass=PermissionsMetaClass): +class Permissions(metaclass=PermissionsMetaClass): # Special permission ADMIN = OctoPrintPermission( diff --git a/src/octoprint_client/__init__.py b/src/octoprint_client/__init__.py index 7b3f09cd1..6b5fafb73 100644 --- a/src/octoprint_client/__init__.py +++ b/src/octoprint_client/__init__.py @@ -25,7 +25,7 @@ class SocketTimeout(BaseException): pass -class SocketClient(object): +class SocketClient: def __init__(self, url, use_ssl=False, daemon=True, **kwargs): self._url = url self._use_ssl = use_ssl @@ -219,7 +219,7 @@ class SocketClient(object): return False -class Client(object): +class Client: def __init__(self, baseurl, apikey): self.baseurl = baseurl self.apikey = apikey diff --git a/tests/filemanager/test_localstorage.py b/tests/filemanager/test_localstorage.py index b2732dc8d..4fd944d44 100644 --- a/tests/filemanager/test_localstorage.py +++ b/tests/filemanager/test_localstorage.py @@ -13,7 +13,7 @@ from ddt import data, ddt, unpack from octoprint.filemanager.storage import LocalFileStorage, StorageError -class FileWrapper(object): +class FileWrapper: def __init__(self, filename): self.path = os.path.join( os.path.dirname(os.path.realpath(__file__)), "_files", filename diff --git a/tests/manual_tests/always_update.py b/tests/manual_tests/always_update.py index cbcc63b16..539d15089 100644 --- a/tests/manual_tests/always_update.py +++ b/tests/manual_tests/always_update.py @@ -17,7 +17,7 @@ OLD_VERSION = "1.0.0" NEW_VERSION = "2.0.0" -class Foo(object): +class Foo: def get_latest(self, target, check, full_data=None): information = { "local": {"name": OLD_VERSION, "value": OLD_VERSION}, diff --git a/tests/plugin/test_core.py b/tests/plugin/test_core.py index 4089b72cb..6a780d01c 100644 --- a/tests/plugin/test_core.py +++ b/tests/plugin/test_core.py @@ -9,7 +9,7 @@ import octoprint.plugin.core ##~~ Helpers for testing mixin type extraction -class A(object): +class A: pass @@ -29,7 +29,7 @@ class A1_1(A_1): pass -class B(object): +class B: pass @@ -37,7 +37,7 @@ class B_1(B): pass -class C(object): +class C: pass @@ -45,7 +45,7 @@ class C_1(C): pass -class D(object): +class D: pass diff --git a/tests/slicing/test_slicingmanager.py b/tests/slicing/test_slicingmanager.py index fe0af1541..2f15bdec8 100644 --- a/tests/slicing/test_slicingmanager.py +++ b/tests/slicing/test_slicingmanager.py @@ -116,7 +116,7 @@ class TestSlicingManager(unittest.TestCase): self.slicer_plugin.get_slicer_default_profile.return_value = default_profile # mock threading - class MockThread(object): + class MockThread: def __init__(self): self.target = None self.args = None diff --git a/tests/util/test_repeated_timer.py b/tests/util/test_repeated_timer.py index d75cbfac3..7e4bf5a30 100644 --- a/tests/util/test_repeated_timer.py +++ b/tests/util/test_repeated_timer.py @@ -9,7 +9,7 @@ import unittest.mock as mock from octoprint.util import RepeatedTimer -class Countdown(object): +class Countdown: def __init__(self, start): self._counter = start