diff options
author | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2024-12-13 15:50:27 +0100 |
---|---|---|
committer | Cristián Maureira-Fredes <Cristian.Maureira-Fredes@qt.io> | 2024-12-18 10:08:10 +0100 |
commit | 382a34586f73896d12063616eb8b31474c03f68a (patch) | |
tree | c33f9c01713fe2083351beade9d9536527712814 /sources | |
parent | 03a3e61b0cce28c44b68b032cff2e6b8fa869477 (diff) |
Remove unnecessary use of 'object' in class constructionremoteobjectsdev
Considering we are not compatible with Python 2 anymore,
we can drop the 'object' explicit inheritance in the class
declaration.
Pick-to: 6.8
Change-Id: Iac3a95aa9721c3ff1a755f457c0936ca157a8470
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
29 files changed, 40 insertions, 38 deletions
diff --git a/sources/pyside6/doc/inheritance_graph.py b/sources/pyside6/doc/inheritance_graph.py index c45791ba5..2796226e1 100644 --- a/sources/pyside6/doc/inheritance_graph.py +++ b/sources/pyside6/doc/inheritance_graph.py @@ -32,7 +32,7 @@ def format_dict(d): return result -class InheritanceGraph(object): +class InheritanceGraph: """ Given a list of classes, determines the set of classes that they inherit from all the way to the root "object", and then is able to generate a diff --git a/sources/pyside6/tests/QtCore/bug_835.py b/sources/pyside6/tests/QtCore/bug_835.py index ffc599ee9..6bf4f261e 100644 --- a/sources/pyside6/tests/QtCore/bug_835.py +++ b/sources/pyside6/tests/QtCore/bug_835.py @@ -18,7 +18,7 @@ get_counter = 0 set_counter = 0 -class Descriptor(object): +class Descriptor: def __get__(self, obj, owner): global get_counter diff --git a/sources/pyside6/tests/QtCore/classinfo_test.py b/sources/pyside6/tests/QtCore/classinfo_test.py index abd1c55b9..03f60db22 100644 --- a/sources/pyside6/tests/QtCore/classinfo_test.py +++ b/sources/pyside6/tests/QtCore/classinfo_test.py @@ -93,7 +93,7 @@ class TestClassInfo(unittest.TestCase): pass self.assertRaises(TypeError, make_info(), test_function) - class NotAQObject(object): + class NotAQObject: pass self.assertRaises(TypeError, make_info(), NotAQObject) diff --git a/sources/pyside6/tests/QtCore/mockclass_test.py b/sources/pyside6/tests/QtCore/mockclass_test.py index 07dca7a6d..b588148d1 100644 --- a/sources/pyside6/tests/QtCore/mockclass_test.py +++ b/sources/pyside6/tests/QtCore/mockclass_test.py @@ -18,7 +18,7 @@ init_test_paths(False) from PySide6.QtCore import QCoreApplication -class Mock(object): +class Mock: def __init__(self): self.called = False self.return_value = None diff --git a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py index cd14941bc..a319d604d 100644 --- a/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py +++ b/sources/pyside6/tests/QtCore/qbytearray_operator_iadd_test.py @@ -15,7 +15,7 @@ from PySide6.QtCore import QByteArray from helper.docmodifier import DocModifier -class BaseQByteArrayOperatorIAdd(object): +class BaseQByteArrayOperatorIAdd: '''Base class for QByteArray += operator tests. Implementing classes should inherit from unittest.TestCase and implement diff --git a/sources/pyside6/tests/QtCore/qobject_inherits_test.py b/sources/pyside6/tests/QtCore/qobject_inherits_test.py index bdd927fe2..e1121abd7 100644 --- a/sources/pyside6/tests/QtCore/qobject_inherits_test.py +++ b/sources/pyside6/tests/QtCore/qobject_inherits_test.py @@ -44,7 +44,7 @@ class InheritsCase(unittest.TestCase): # QObject.inherits(classname) should fail if classname isn't a # QObject subclass - class Parent(object): + class Parent: # Dummy parent pass @@ -71,6 +71,8 @@ class InheritsCase(unittest.TestCase): def testMultipleInheritance(self): def declareClass(): + # Note: 'object' cannot removed from this class declaration + # in order to make it work with QObject. class Foo(object, QObject): pass diff --git a/sources/pyside6/tests/QtQml/bug_825_old.py b/sources/pyside6/tests/QtQml/bug_825_old.py index e27cb14bc..e1a35d3d9 100644 --- a/sources/pyside6/tests/QtQml/bug_825_old.py +++ b/sources/pyside6/tests/QtQml/bug_825_old.py @@ -30,7 +30,7 @@ class MetaA(type): pass -class A(object): +class A: __metaclass__ = MetaA diff --git a/sources/pyside6/tests/QtUiTools/bug_426.py b/sources/pyside6/tests/QtUiTools/bug_426.py index 2f09afb73..d1dc7d9e3 100644 --- a/sources/pyside6/tests/QtUiTools/bug_426.py +++ b/sources/pyside6/tests/QtUiTools/bug_426.py @@ -16,7 +16,7 @@ from PySide6.QtWidgets import QApplication from PySide6.QtUiTools import QUiLoader -class Window(object): +class Window: def __init__(self): loader = QUiLoader() filePath = os.path.join(os.path.dirname(__file__), 'bug_426.ui') diff --git a/sources/pyside6/tests/QtWidgets/bug_836.py b/sources/pyside6/tests/QtWidgets/bug_836.py index b9d39d875..9486233e3 100644 --- a/sources/pyside6/tests/QtWidgets/bug_836.py +++ b/sources/pyside6/tests/QtWidgets/bug_836.py @@ -15,15 +15,15 @@ from PySide6.QtCore import QTimer from PySide6.QtWidgets import QApplication, QFrame -class Mixin1(object): +class Mixin1: pass -class Mixin2(object): +class Mixin2: pass -class Mixin3(object): +class Mixin3: pass diff --git a/sources/pyside6/tests/QtWidgets/bug_921.py b/sources/pyside6/tests/QtWidgets/bug_921.py index 5e9dcd05a..ef84219c4 100644 --- a/sources/pyside6/tests/QtWidgets/bug_921.py +++ b/sources/pyside6/tests/QtWidgets/bug_921.py @@ -24,7 +24,7 @@ class Signaller(QObject): s3 = Signal() -class Window(object): +class Window: def __init__(self, s): self._window = QMainWindow() diff --git a/sources/pyside6/tests/QtWidgets/import_test.py b/sources/pyside6/tests/QtWidgets/import_test.py index 0b60241f0..cb810c025 100644 --- a/sources/pyside6/tests/QtWidgets/import_test.py +++ b/sources/pyside6/tests/QtWidgets/import_test.py @@ -1,2 +1,2 @@ -class PysideImportTest2(object): +class PysideImportTest2: pass diff --git a/sources/pyside6/tests/QtWidgets/qvariant_test.py b/sources/pyside6/tests/QtWidgets/qvariant_test.py index 0e1ecc2c9..74731e914 100644 --- a/sources/pyside6/tests/QtWidgets/qvariant_test.py +++ b/sources/pyside6/tests/QtWidgets/qvariant_test.py @@ -28,7 +28,7 @@ class MyItem(QGraphicsRectItem): return value -class Sequence(object): +class Sequence: # Having the __getitem__ method on a class transform the Python # type to a PySequence. # Before the patch: aa75437f9119d997dd290471ac3e2cc88ca88bf1 diff --git a/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py b/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py index 3209f749f..7e1ddbb17 100644 --- a/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py +++ b/sources/pyside6/tests/pysidetest/mixin_signal_slots_test.py @@ -20,7 +20,7 @@ init_test_paths(False) from PySide6.QtCore import QObject, Signal, Slot -class Mixin(object): +class Mixin: mixinSignal = Signal() def __init__(self, *args, **kwargs): @@ -39,7 +39,7 @@ class MixinTwo(Mixin): self.mixinTwoSlotCalled = True -class MixinThree(object): +class MixinThree: mixinThreeSignal = Signal() def __init__(self, *args, **kwargs): diff --git a/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py b/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py index a9808cfa3..fee2eea8d 100644 --- a/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py +++ b/sources/pyside6/tests/pysidetest/multiple_inheritance_test.py @@ -22,7 +22,7 @@ def xprint(*args, **kw): # This is the original testcase of PYSIDE-1564 -class Age(object): +class Age: def __init__(self, age=0, **kwds): super().__init__(**kwds) @@ -117,7 +117,7 @@ class II(G, H, QtWidgets.QLabel): # PYSIDE-2294: Friedemann's test adapted. # We need to ignore positional args in mixin classes. -class Ui_X_MainWindow(object): # Emulating uic +class Ui_X_MainWindow: # Emulating uic def setupUi(self, MainWindow): MainWindow.resize(400, 300) self.lbl = QLabel(self) @@ -160,7 +160,7 @@ class AdditionalMultipleInheritanceTest(UsesQApplication): # PYSIDE-2654: Additional missing init test. # This must work if no __init__ is defined (Ui_Form) -class Ui_Form(object): +class Ui_Form: pass diff --git a/sources/pyside6/tests/pysidetest/property_python_test.py b/sources/pyside6/tests/pysidetest/property_python_test.py index e26f07bb9..faf509f1f 100644 --- a/sources/pyside6/tests/pysidetest/property_python_test.py +++ b/sources/pyside6/tests/pysidetest/property_python_test.py @@ -89,7 +89,7 @@ class SubClass(BaseClass): raise PropertyDel(self._spam) -class PropertyDocBase(object): +class PropertyDocBase: _spam = 1 def _get_spam(self): @@ -188,7 +188,7 @@ class PropertyTests(unittest.TestCase): @unittest.skipIf(sys.flags.optimize >= 2, "Docstrings are omitted with -O2 and above") def test_property_decorator_doc_writable(self): - class PropertyWritableDoc(object): + class PropertyWritableDoc: @Property(object) def spam(self): diff --git a/sources/pyside6/tests/registry/init_platform.py b/sources/pyside6/tests/registry/init_platform.py index 0a040d0fc..e911f2182 100644 --- a/sources/pyside6/tests/registry/init_platform.py +++ b/sources/pyside6/tests/registry/init_platform.py @@ -104,7 +104,7 @@ from shibokensupport.signature.lib.enum_sig import SimplifyingEnumerator # noqa sourcepath = os.path.splitext(__file__)[0] + ".py" -class Formatter(object): +class Formatter: """ Formatter is formatting the signature listing of an enumerator. diff --git a/sources/pyside6/tests/util/helper/basicpyslotcase.py b/sources/pyside6/tests/util/helper/basicpyslotcase.py index 80da149bd..b495eaead 100644 --- a/sources/pyside6/tests/util/helper/basicpyslotcase.py +++ b/sources/pyside6/tests/util/helper/basicpyslotcase.py @@ -5,7 +5,7 @@ from __future__ import annotations import gc -class BasicPySlotCase(object): +class BasicPySlotCase: '''Base class that tests python slots and signal emissions. Python slots are defined as any callable passed to QObject.connect(). diff --git a/sources/pyside6/tests/util/helper/docmodifier.py b/sources/pyside6/tests/util/helper/docmodifier.py index b6de62abb..ee95d9a0f 100644 --- a/sources/pyside6/tests/util/helper/docmodifier.py +++ b/sources/pyside6/tests/util/helper/docmodifier.py @@ -59,7 +59,7 @@ class DocModifier(type): if __name__ == '__main__': # tests - class BaseTest(object): + class BaseTest: __metaclass__ = DocModifier def testBase(self): diff --git a/sources/pyside6/tests/util/processtimer.py b/sources/pyside6/tests/util/processtimer.py index 8187901c6..905405585 100644 --- a/sources/pyside6/tests/util/processtimer.py +++ b/sources/pyside6/tests/util/processtimer.py @@ -15,7 +15,7 @@ class TimeoutException(Exception): return repr(self.msg) -class ProcessTimer(object): +class ProcessTimer: '''Timeout function for controlling a subprocess.Popen instance. Naive implementation using busy loop, see later other means diff --git a/sources/shiboken6/libshiboken/embed/signature_bootstrap.py b/sources/shiboken6/libshiboken/embed/signature_bootstrap.py index b0ba77107..7458500b3 100644 --- a/sources/shiboken6/libshiboken/embed/signature_bootstrap.py +++ b/sources/shiboken6/libshiboken/embed/signature_bootstrap.py @@ -167,7 +167,7 @@ def prepare_zipfile(): return sys.meta_path, EmbeddableZipImporter(vzip) -class EmbeddableZipImporter(object): +class EmbeddableZipImporter: def __init__(self, zip_file): def p2m(filename): diff --git a/sources/shiboken6/shibokenmodule/Shiboken.pyi b/sources/shiboken6/shibokenmodule/Shiboken.pyi index 6a1a63217..26fe9396e 100644 --- a/sources/shiboken6/shibokenmodule/Shiboken.pyi +++ b/sources/shiboken6/shibokenmodule/Shiboken.pyi @@ -13,12 +13,12 @@ Shiboken, except for defaults which are replaced by "...". from shiboken6 import Shiboken -class Object(object): +class Object: def __init__(self) -> None: ... -class VoidPtr(object): +class VoidPtr: def __init__(self, value: int) -> None: ... diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py index 13508af1f..9dbddca2f 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py @@ -44,7 +44,7 @@ def signal_check(thing): return thing and type(thing) in (Signal, SignalInstance) -class ExactEnumerator(object): +class ExactEnumerator: """ ExactEnumerator enumerates all signatures in a module as they are. diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py index ef0f32dc6..cff546005 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py @@ -30,7 +30,7 @@ from shibokensupport.signature.lib.tool import build_brace_pattern indent = " " * 4 -class Writer(object): +class Writer: def __init__(self, outfile, *args): self.outfile = outfile self.history = [True, True] diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py index 5b7749388..af0fc6c0a 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/mapping.py @@ -24,7 +24,7 @@ from typing import TypeVar, Generic from _imp import is_builtin -class ellipsis(object): +class ellipsis: def __repr__(self): return "..." @@ -126,7 +126,7 @@ class KeywordOnly(_NotCalled): # Parameterized primitive variables -class _Parameterized(object): +class _Parameterized: def __init__(self, type): self.type = type self.__name__ = self.__class__.__name__ @@ -149,7 +149,7 @@ class ArrayLikeVariable(_Parameterized): StringList = ArrayLikeVariable(str) -class Reloader(object): +class Reloader: """ Reloder class diff --git a/sources/shiboken6/tests/samplebinding/bug_704_test.py b/sources/shiboken6/tests/samplebinding/bug_704_test.py index d0cfe4038..76fa84653 100644 --- a/sources/shiboken6/tests/samplebinding/bug_704_test.py +++ b/sources/shiboken6/tests/samplebinding/bug_704_test.py @@ -15,7 +15,7 @@ init_paths() from sample import ObjectType -class NewStyle(object): +class NewStyle: def name(self): return "NewStyle" diff --git a/sources/shiboken6/tests/samplebinding/metaclass_test.py b/sources/shiboken6/tests/samplebinding/metaclass_test.py index c233e7e12..cbde1b579 100644 --- a/sources/shiboken6/tests/samplebinding/metaclass_test.py +++ b/sources/shiboken6/tests/samplebinding/metaclass_test.py @@ -18,7 +18,7 @@ class MetaA(type): pass -class A(object): +class A: __metaclass__ = MetaA diff --git a/sources/shiboken6/tests/samplebinding/mixed_mi_test.py b/sources/shiboken6/tests/samplebinding/mixed_mi_test.py index b3ee886d4..50e4970ce 100644 --- a/sources/shiboken6/tests/samplebinding/mixed_mi_test.py +++ b/sources/shiboken6/tests/samplebinding/mixed_mi_test.py @@ -17,7 +17,7 @@ init_paths() from sample import ObjectType -class Base(object): +class Base: '''Base Python class''' def __init__(self): diff --git a/sources/shiboken6/tests/samplebinding/overload_sorting_test.py b/sources/shiboken6/tests/samplebinding/overload_sorting_test.py index 462a44eff..df4fdc010 100644 --- a/sources/shiboken6/tests/samplebinding/overload_sorting_test.py +++ b/sources/shiboken6/tests/samplebinding/overload_sorting_test.py @@ -18,7 +18,7 @@ from sample import (CustomOverloadSequence, ImplicitBase, ImplicitConv, ImplicitTarget, SortedOverload) -class Dummy(object): +class Dummy: pass diff --git a/sources/shiboken6/tests/samplebinding/overload_test.py b/sources/shiboken6/tests/samplebinding/overload_test.py index f87e4ef57..95a313df0 100644 --- a/sources/shiboken6/tests/samplebinding/overload_test.py +++ b/sources/shiboken6/tests/samplebinding/overload_test.py @@ -179,7 +179,7 @@ class OverloadTest(unittest.TestCase): # Overload.acceptSequence(void*) overload = Overload() - class Foo(object): + class Foo: pass foo = Foo() |