commit ed6dda592a18d5dde5104bac2c184058b04877a3 parent 36861d1ca6bdbc72e8eb09bac849de1c7c163118 Author: Alex Hochheiden <ahochheiden@mozilla.com> Date: Wed, 10 Dec 2025 06:03:20 +0000 Bug 2003412 - Fix UP008 warnings: Use super() call instead of super(__class__, self) r=emilio,perftest-reviewers,mozperftest-reviewers,search-reviewers,sessionstore-reviewers,places-reviewers,win-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,layout-reviewers,dom-worker-reviewers,jdescottes,emz,jari,gstoll,scunnane,sparky,nsharpley https://docs.astral.sh/ruff/rules/super-call-with-parameters/ Differential Revision: https://phabricator.services.mozilla.com/D274684 Diffstat:
201 files changed, 457 insertions(+), 522 deletions(-)
diff --git a/browser/components/places/tests/marionette/test_reopen_from_library.py b/browser/components/places/tests/marionette/test_reopen_from_library.py @@ -10,7 +10,7 @@ from marionette_harness import MarionetteTestCase, WindowManagerMixin class TestReopenFromLibrary(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestReopenFromLibrary, self).setUp() + super().setUp() self.original_showForNewBookmarks_pref = self.marionette.get_pref( "browser.bookmarks.editDialog.showForNewBookmarks" @@ -29,7 +29,7 @@ class TestReopenFromLibrary(WindowManagerMixin, MarionetteTestCase): self.marionette.restart(in_app=False, clean=True) - super(TestReopenFromLibrary, self).tearDown() + super().tearDown() def test_open_bookmark_from_library_with_no_browser_window_open(self): bookmark_url = self.marionette.absolute_url("empty.html") diff --git a/browser/components/search/test/marionette/telemetry/test_ping_submitted.py b/browser/components/search/test/marionette/telemetry/test_ping_submitted.py @@ -8,7 +8,7 @@ from marionette_harness.marionette_test import MarionetteTestCase class TestPingSubmitted(MarionetteTestCase): def setUp(self): - super(TestPingSubmitted, self).setUp() + super().setUp() self.marionette.set_context(self.marionette.CONTEXT_CHROME) diff --git a/browser/components/search/test/marionette/test_engines_on_restart.py b/browser/components/search/test/marionette/test_engines_on_restart.py @@ -9,7 +9,7 @@ from marionette_harness.marionette_test import MarionetteTestCase class TestEnginesOnRestart(MarionetteTestCase): def setUp(self): - super(TestEnginesOnRestart, self).setUp() + super().setUp() self.marionette.enforce_gecko_prefs( { "browser.search.log": True, diff --git a/browser/components/sessionstore/test/marionette/session_store_test_case.py b/browser/components/sessionstore/test/marionette/session_store_test_case.py @@ -45,7 +45,7 @@ class SessionStoreTestCase(WindowManagerMixin, MarionetteTestCase): test_windows=DEFAULT_WINDOWS, taskbartabs_enable=False, ): - super(SessionStoreTestCase, self).setUp() + super().setUp() self.marionette.set_context("chrome") platform = self.marionette.session_capabilities["platformName"] @@ -97,7 +97,7 @@ class SessionStoreTestCase(WindowManagerMixin, MarionetteTestCase): # Create a fresh profile for subsequent tests. self.marionette.restart(in_app=False, clean=True) finally: - super(SessionStoreTestCase, self).tearDown() + super().tearDown() def open_windows(self, window_sets, is_private=False): """Open a set of windows with tabs pointing at some URLs. diff --git a/browser/components/sessionstore/test/marionette/test_log_files.py b/browser/components/sessionstore/test/marionette/test_log_files.py @@ -15,7 +15,7 @@ def inline(doc): class TestSessionRestoreLogging(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestSessionRestoreLogging, self).setUp() + super().setUp() self.marionette.enforce_gecko_prefs( { "browser.sessionstore.loglevel": "Debug", @@ -28,7 +28,7 @@ class TestSessionRestoreLogging(WindowManagerMixin, MarionetteTestCase): # Create a fresh profile for subsequent tests. self.marionette.restart(in_app=False, clean=True) finally: - super(TestSessionRestoreLogging, self).tearDown() + super().tearDown() def getSessionFilePath(self): profilePath = self.marionette.instance.profile.profile diff --git a/browser/components/sessionstore/test/marionette/test_persist_closed_tabs_restore_manually.py b/browser/components/sessionstore/test/marionette/test_persist_closed_tabs_restore_manually.py @@ -29,7 +29,7 @@ class TestSessionRestoreClosedTabs(SessionStoreTestCase): """ def setUp(self): - super(TestSessionRestoreClosedTabs, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=True, diff --git a/browser/components/sessionstore/test/marionette/test_restore_loading_tab.py b/browser/components/sessionstore/test/marionette/test_restore_loading_tab.py @@ -13,7 +13,7 @@ def inline(doc): class TestRestoreLoadingPage(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestRestoreLoadingPage, self).setUp() + super().setUp() self.delayed_page = self.marionette.absolute_url("slow") def do_test(self, html, is_restoring_expected): diff --git a/browser/components/sessionstore/test/marionette/test_restore_manually.py b/browser/components/sessionstore/test/marionette/test_restore_manually.py @@ -22,7 +22,7 @@ class TestSessionRestoreManually(SessionStoreTestCase): """ def setUp(self): - super(TestSessionRestoreManually, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=True, diff --git a/browser/components/sessionstore/test/marionette/test_restore_manually_with_pinned_tabs.py b/browser/components/sessionstore/test/marionette/test_restore_manually_with_pinned_tabs.py @@ -19,7 +19,7 @@ def inline(doc): class TestSessionRestoreWithPinnedTabs(SessionStoreTestCase): def setUp(self): - super(TestSessionRestoreWithPinnedTabs, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=True, diff --git a/browser/components/sessionstore/test/marionette/test_restore_manually_with_tab_groups.py b/browser/components/sessionstore/test/marionette/test_restore_manually_with_tab_groups.py @@ -19,7 +19,7 @@ def inline(doc): class TestSessionRestoreWithTabGroups(SessionStoreTestCase): def setUp(self): - super(TestSessionRestoreWithTabGroups, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=True, diff --git a/browser/components/sessionstore/test/marionette/test_restore_sidebar.py b/browser/components/sessionstore/test/marionette/test_restore_sidebar.py @@ -21,7 +21,7 @@ class TestSessionRestore(SessionStoreTestCase): """ def setUp(self): - super(TestSessionRestore, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=True, diff --git a/browser/components/sessionstore/test/marionette/test_restore_sidebar_automatic.py b/browser/components/sessionstore/test/marionette/test_restore_sidebar_automatic.py @@ -21,7 +21,7 @@ class TestSessionRestore(SessionStoreTestCase): """ def setUp(self): - super(TestSessionRestore, self).setUp( + super().setUp( startup_page=3, include_private=False, restore_on_demand=False, diff --git a/browser/components/sessionstore/test/marionette/test_restore_windows_after_close_last_tabs.py b/browser/components/sessionstore/test/marionette/test_restore_windows_after_close_last_tabs.py @@ -17,9 +17,7 @@ class TestSessionStoreEnabledAllWindows(SessionStoreTestCase): :param include_private: Whether to open private windows. """ - super(TestSessionStoreEnabledAllWindows, self).setUp( - include_private=include_private, startup_page=3 - ) + super().setUp(include_private=include_private, startup_page=3) def test_with_variety(self): """Test opening and restoring both standard and private windows. diff --git a/browser/components/sessionstore/test/marionette/test_restore_windows_after_restart_and_quit.py b/browser/components/sessionstore/test/marionette/test_restore_windows_after_restart_and_quit.py @@ -21,9 +21,7 @@ class TestSessionStoreEnabledAllWindows(SessionStoreTestCase): :param include_private: Whether to open private windows. """ - super(TestSessionStoreEnabledAllWindows, self).setUp( - include_private=include_private, startup_page=3 - ) + super().setUp(include_private=include_private, startup_page=3) def test_with_variety(self): """Test opening and restoring both standard and private windows. @@ -48,9 +46,7 @@ class TestSessionStoreEnabledAllWindows(SessionStoreTestCase): class TestSessionStoreEnabledNoPrivateWindows(TestSessionStoreEnabledAllWindows): def setUp(self): - super(TestSessionStoreEnabledNoPrivateWindows, self).setUp( - include_private=False - ) + super().setUp(include_private=False) class TestSessionStoreDisabled(SessionStoreTestCase): diff --git a/browser/components/sessionstore/test/marionette/test_restore_windows_after_windows_shutdown.py b/browser/components/sessionstore/test/marionette/test_restore_windows_after_windows_shutdown.py @@ -24,7 +24,7 @@ from session_store_test_case import SessionStoreTestCase class TestWindowsShutdown(SessionStoreTestCase): def setUp(self): - super(TestWindowsShutdown, self).setUp(startup_page=3, no_auto_updates=False) + super().setUp(startup_page=3, no_auto_updates=False) def test_with_variety(self): """Test session restore selected by user.""" @@ -33,9 +33,7 @@ class TestWindowsShutdown(SessionStoreTestCase): class TestWindowsShutdownRegisterRestart(SessionStoreTestCase): def setUp(self): - super(TestWindowsShutdownRegisterRestart, self).setUp( - startup_page=3, no_auto_updates=False, win_register_restart=True - ) + super().setUp(startup_page=3, no_auto_updates=False, win_register_restart=True) def test_manual_restart(self): """Test that restore tabs works in case of register restart failure.""" @@ -44,7 +42,7 @@ class TestWindowsShutdownRegisterRestart(SessionStoreTestCase): class TestWindowsShutdownNormal(SessionStoreTestCase): def setUp(self): - super(TestWindowsShutdownNormal, self).setUp(no_auto_updates=False) + super().setUp(no_auto_updates=False) def test_with_variety(self): """Test that windows are not restored on a normal restart.""" @@ -53,9 +51,7 @@ class TestWindowsShutdownNormal(SessionStoreTestCase): class TestWindowsShutdownForcedSessionRestore(SessionStoreTestCase): def setUp(self): - super(TestWindowsShutdownForcedSessionRestore, self).setUp( - no_auto_updates=False, win_register_restart=True - ) + super().setUp(no_auto_updates=False, win_register_restart=True) def test_os_restart(self): """Test that register application restart restores the session.""" diff --git a/browser/components/sessionstore/test/marionette/test_tabgroups_restore.py b/browser/components/sessionstore/test/marionette/test_tabgroups_restore.py @@ -30,7 +30,7 @@ DEFAULT_WINDOWS = set( class TestAutoRestoreWithTabGroups(SessionStoreTestCase): def setUp(self): - super(TestAutoRestoreWithTabGroups, self).setUp( + super().setUp( startup_page=3, include_private=False, restore_on_demand=True, diff --git a/browser/components/sessionstore/test/marionette/test_taskbartab_restore.py b/browser/components/sessionstore/test/marionette/test_taskbartab_restore.py @@ -19,7 +19,7 @@ def inline(title): class TestManualRestoreWithTaskbarTabs(SessionStoreTestCase): def setUp(self): - super(TestManualRestoreWithTaskbarTabs, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=False, @@ -89,7 +89,7 @@ class TestManualRestoreWithTaskbarTabs(SessionStoreTestCase): class TestAutoRestoreWithTaskbarTabs(SessionStoreTestCase): def setUp(self): - super(TestAutoRestoreWithTaskbarTabs, self).setUp( + super().setUp( startup_page=3, include_private=False, restore_on_demand=False, diff --git a/browser/components/sessionstore/test/marionette/test_taskbartab_sessionstate.py b/browser/components/sessionstore/test/marionette/test_taskbartab_sessionstate.py @@ -17,7 +17,7 @@ def inline(title): class TestTaskbarTabSessionState(SessionStoreTestCase): def setUp(self): - super(TestTaskbarTabSessionState, self).setUp( + super().setUp( startup_page=1, include_private=False, restore_on_demand=False, diff --git a/dom/cache/test/marionette/test_cacheapi_encryption_PBM.py b/dom/cache/test/marionette/test_cacheapi_encryption_PBM.py @@ -23,7 +23,7 @@ class CacheAPIEncryptionPBM(QuotaTestCase): """ def setUp(self): - super(CacheAPIEncryptionPBM, self).setUp() + super().setUp() self.testHTML = "dom/cache/basicCacheAPI_PBM.html" self.cacheName = "CachePBMTest" @@ -45,7 +45,7 @@ class CacheAPIEncryptionPBM(QuotaTestCase): self.dbCheckpointThresholdBytes = 512 * 1024 def tearDown(self): - super(CacheAPIEncryptionPBM, self).setUp() + super().tearDown() self.marionette.set_pref(CACHEAPI_PBM_PREF, self.defaultCacheAPIPBMPref) self.marionette.set_pref(QM_TESTING_PREF, self.defaultQMPrefValue) diff --git a/dom/cache/test/marionette/test_caches_delete_cleanup_after_shutdown.py b/dom/cache/test/marionette/test_caches_delete_cleanup_after_shutdown.py @@ -33,13 +33,13 @@ class CachesDeleteCleanupAtShutdownTestCase(MarionetteTestCase): """ def setUp(self): - super(CachesDeleteCleanupAtShutdownTestCase, self).setUp() + super().setUp() self.marionette.restart(in_app=False, clean=True) self.marionette.set_pref(QM_TESTING_PREF, True) def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(CachesDeleteCleanupAtShutdownTestCase, self).tearDown() + super().tearDown() self.marionette.set_pref(QM_TESTING_PREF, False) def getUsage(self): diff --git a/dom/indexedDB/test/marionette/test_IDB_encryption_PBM.py b/dom/indexedDB/test/marionette/test_IDB_encryption_PBM.py @@ -23,7 +23,7 @@ class IDBEncryptionPBM(QuotaTestCase): """ def setUp(self): - super(IDBEncryptionPBM, self).setUp() + super().setUp() self.testHTML = "dom/indexedDB/basicIDB_PBM.html" self.IDBName = "IDBTest" @@ -41,7 +41,7 @@ class IDBEncryptionPBM(QuotaTestCase): self.marionette.set_pref(QM_TESTING_PREF, True) def tearDown(self): - super(IDBEncryptionPBM, self).tearDown() + super().tearDown() self.marionette.set_pref(INDEXED_DB_PBM_PREF, self.defaultIDBPrefValue) self.marionette.set_pref(QM_TESTING_PREF, self.defaultQMPrefValue) diff --git a/dom/quota/test/marionette/test_private_repository_cleanup.py b/dom/quota/test/marionette/test_private_repository_cleanup.py @@ -22,7 +22,7 @@ AUTOSTART_PBM_PREF = "browser.privatebrowsing.autostart" class PrivateRepositoryCleanup(QuotaTestCase): def setUp(self, autostartPBM=False): - super(PrivateRepositoryCleanup, self).setUp() + super().setUp() self.marionette.set_pref(AUTOSTART_PBM_PREF, autostartPBM) self.marionette.set_pref(QM_TESTING_PREF, True) @@ -37,7 +37,7 @@ class PrivateRepositoryCleanup(QuotaTestCase): self.marionette.clear_pref(QM_TESTING_PREF) self.marionette.restart(in_app=True) - super(PrivateRepositoryCleanup, self).tearDown() + super().tearDown() def doStorageWork(self): origin = "https://example.com^privateBrowsingId=1" @@ -74,7 +74,7 @@ class PBM(PrivateRepositoryCleanup): class PBMAutoStart(PrivateRepositoryCleanup): def setUp(self): - super(PBMAutoStart, self).setUp(True) + super().setUp(True) def test_ensure_cleanup(self): self.doStorageWork() diff --git a/dom/workers/test/marionette/test_service_workers_at_startup.py b/dom/workers/test/marionette/test_service_workers_at_startup.py @@ -14,12 +14,12 @@ from service_worker_utils import MarionetteServiceWorkerTestCase class ServiceWorkerAtStartupTestCase(MarionetteServiceWorkerTestCase): def setUp(self): - super(ServiceWorkerAtStartupTestCase, self).setUp() + super().setUp() self.install_service_worker("serviceworker/install_serviceworker.html") def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(ServiceWorkerAtStartupTestCase, self).tearDown() + super().tearDown() def test_registered_service_worker_after_restart(self): self.marionette.restart() diff --git a/dom/workers/test/marionette/test_service_workers_disabled.py b/dom/workers/test/marionette/test_service_workers_disabled.py @@ -13,12 +13,12 @@ from service_worker_utils import MarionetteServiceWorkerTestCase class ServiceWorkersDisabledTestCase(MarionetteServiceWorkerTestCase): def setUp(self): - super(ServiceWorkersDisabledTestCase, self).setUp() + super().setUp() self.install_service_worker("serviceworker/install_serviceworker.html") def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(ServiceWorkersDisabledTestCase, self).tearDown() + super().tearDown() def test_service_workers_disabled_at_startup(self): # self.marionette.set_pref sets preferences after startup. Using it diff --git a/extensions/pref/autoconfig/test/marionette/test_autoconfig.py b/extensions/pref/autoconfig/test/marionette/test_autoconfig.py @@ -19,7 +19,7 @@ class TestAutoConfig(MarionetteTestCase): if hasattr(self, "pref_file_dir_created"): os.rmdir(self.pref_file_dir) - super(TestAutoConfig, self).tearDown() + super().tearDown() def pref_has_user_value(self, pref): with self.marionette.using_context("chrome"): diff --git a/js/src/gdb/mozilla/IonGraph.py b/js/src/gdb/mozilla/IonGraph.py @@ -96,9 +96,7 @@ class IonGraphBinParameter(gdb.Parameter): return "Path to iongraph binary set to: %s" % value def __init__(self): - super(IonGraphBinParameter, self).__init__( - "iongraph-bin", gdb.COMMAND_SUPPORT, gdb.PARAM_FILENAME - ) + super().__init__("iongraph-bin", gdb.COMMAND_SUPPORT, gdb.PARAM_FILENAME) self.value = os.getenv("GDB_IONGRAPH", "") if self.value == "": self.value = search_in_path("iongraph") @@ -115,9 +113,7 @@ class DotBinParameter(gdb.Parameter): return "Path to dot binary set to: %s" % value def __init__(self): - super(DotBinParameter, self).__init__( - "dot-bin", gdb.COMMAND_SUPPORT, gdb.PARAM_FILENAME - ) + super().__init__("dot-bin", gdb.COMMAND_SUPPORT, gdb.PARAM_FILENAME) self.value = os.getenv("GDB_DOT", "") if self.value == "": self.value = search_in_path("dot") @@ -134,9 +130,7 @@ class PngViewerBinParameter(gdb.Parameter): return "Path to a png viewer binary set to: %s" % self.value def __init__(self): - super(PngViewerBinParameter, self).__init__( - "pngviewer-bin", gdb.COMMAND_SUPPORT, gdb.PARAM_FILENAME - ) + super().__init__("pngviewer-bin", gdb.COMMAND_SUPPORT, gdb.PARAM_FILENAME) self.value = os.getenv("GDB_PNGVIEWER", "") if self.value == "": self.value = search_in_path("xdg-open") @@ -153,9 +147,7 @@ class IonGraphCommand(gdb.Command): """ def __init__(self): - super(IonGraphCommand, self).__init__( - "iongraph", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION - ) + super().__init__("iongraph", gdb.COMMAND_DATA, gdb.COMPLETE_EXPRESSION) self.typeCache = ModuleCache() def invoke(self, mirGenExpr, from_tty): diff --git a/js/src/gdb/mozilla/JSObject.py b/js/src/gdb/mozilla/JSObject.py @@ -46,7 +46,7 @@ gdb_string_regexp = re.compile(r'(?:0x[0-9a-z]+ )?(?:<.*> )?"(.*)"', re.I) @ptr_pretty_printer("JSObject") class JSObjectPtrOrRef(prettyprinters.Pointer): def __init__(self, value, cache): - super(JSObjectPtrOrRef, self).__init__(value, cache) + super().__init__(value, cache) if not cache.mod_JSObject: cache.mod_JSObject = JSObjectTypeCache() self.otc = cache.mod_JSObject diff --git a/js/src/gdb/mozilla/JSString.py b/js/src/gdb/mozilla/JSString.py @@ -32,7 +32,7 @@ class JSStringTypeCache: class Common(mozilla.prettyprinters.Pointer): def __init__(self, value, cache): - super(Common, self).__init__(value, cache) + super().__init__(value, cache) if not cache.mod_JSString: cache.mod_JSString = JSStringTypeCache(cache) self.stc = cache.mod_JSString diff --git a/js/src/gdb/mozilla/JSSymbol.py b/js/src/gdb/mozilla/JSSymbol.py @@ -20,7 +20,7 @@ UniqueSymbol = 0xFFFFFFFF @ptr_pretty_printer("JS::Symbol") class JSSymbolPtr(mozilla.prettyprinters.Pointer): def __init__(self, value, cache): - super(JSSymbolPtr, self).__init__(value, cache) + super().__init__(value, cache) self.value = value def to_string(self): diff --git a/js/src/gdb/mozilla/jitsrc.py b/js/src/gdb/mozilla/jitsrc.py @@ -106,7 +106,7 @@ patterns = [ class JitSource(gdb.Command): def __init__(self): - super(JitSource, self).__init__("jitsrc", gdb.COMMAND_RUNNING) + super().__init__("jitsrc", gdb.COMMAND_RUNNING) self.dont_repeat() def disable_breakpoints(self): diff --git a/js/src/gdb/mozilla/jsop.py b/js/src/gdb/mozilla/jsop.py @@ -49,7 +49,7 @@ class JSOp: @ptr_pretty_printer("jsbytecode") class JSBytecodePtr(mozilla.prettyprinters.Pointer): def __init__(self, value, cache): - super(JSBytecodePtr, self).__init__(value, cache) + super().__init__(value, cache) self.jotc = JSOpTypeCache.get_or_create(cache) def to_string(self): diff --git a/js/src/gdb/mozilla/prettyprinters.py b/js/src/gdb/mozilla/prettyprinters.py @@ -391,7 +391,7 @@ class Pointer: # Don't try to provide pretty-printers for NULL pointers. if value.type.strip_typedefs().code == gdb.TYPE_CODE_PTR and value == 0: return None - return super(Pointer, cls).__new__(cls) + return super().__new__(cls) def __init__(self, value, cache): self.value = value diff --git a/js/src/gdb/mozilla/unwind.py b/js/src/gdb/mozilla/unwind.py @@ -75,7 +75,7 @@ class UnwinderTypeCache(TypeCache): self.d = None self.frame_enum_names = {} self.frame_class_types = {} - super(UnwinderTypeCache, self).__init__(None) + super().__init__(None) # We take this bizarre approach to defer trying to look up any # symbols until absolutely needed. Without this, the loading @@ -164,7 +164,7 @@ class JitFrameDecorator(FrameDecorator): JIT frame in the stack.""" def __init__(self, base, info, cache): - super(JitFrameDecorator, self).__init__(base) + super().__init__(base) self.info = info self.cache = cache @@ -517,7 +517,7 @@ class SpiderMonkeyUnwinder(Unwinder): UNWINDERS = [x64UnwinderState] def __init__(self, typecache): - super(SpiderMonkeyUnwinder, self).__init__("SpiderMonkey") + super().__init__("SpiderMonkey") self.typecache = typecache self.unwinder_state = None diff --git a/js/src/gdb/run-tests.py b/js/src/gdb/run-tests.py @@ -61,7 +61,7 @@ def make_shell_cmd(l): class Summary: class SummaryBar(progressbar.ProgressBar): def __init__(self, limit): - super(Summary.SummaryBar, self).__init__("", limit, 24) + super().__init__("", limit, 24) def start(self): self.label = "[starting ]" @@ -152,7 +152,7 @@ class Summary: class Test(TaskPool.Task): def __init__(self, path, summary): - super(Test, self).__init__() + super().__init__() self.test_path = path # path to .py test file self.summary = summary @@ -188,7 +188,7 @@ class Test(TaskPool.Task): ] def start(self, pipe, deadline): - super(Test, self).start(pipe, deadline) + super().start(pipe, deadline) if OPTIONS.show_cmd: self.summary.interleave_output(lambda: self.show_cmd(sys.stdout)) diff --git a/js/src/gdb/taskpool.py b/js/src/gdb/taskpool.py @@ -211,11 +211,11 @@ if __name__ == "__main__": class SortableTask(TaskPool.Task): def __init__(self, n): - super(SortableTask, self).__init__() + super().__init__() self.n = n def start(self, pipe, deadline): - super(SortableTask, self).start(pipe, deadline) + super().start(pipe, deadline) def cmd(self): return ["sh", "-c", "echo out; sleep %d; echo err>&2" % (self.n,)] diff --git a/layout/tools/reftest/reftestcommandline.py b/layout/tools/reftest/reftestcommandline.py @@ -12,7 +12,7 @@ here = os.path.abspath(os.path.dirname(__file__)) class ReftestArgumentsParser(argparse.ArgumentParser): def __init__(self, **kwargs): - super(ReftestArgumentsParser, self).__init__(**kwargs) + super().__init__(**kwargs) # Try to import a MozbuildObject. Success indicates that we are # running from a source tree. This allows some defaults to be set @@ -465,7 +465,7 @@ class ReftestArgumentsParser(argparse.ArgumentParser): class DesktopArgumentsParser(ReftestArgumentsParser): def __init__(self, **kwargs): - super(DesktopArgumentsParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.add_argument( "--run-tests-in-parallel", @@ -476,7 +476,7 @@ class DesktopArgumentsParser(ReftestArgumentsParser): ) def validate(self, options, reftest): - super(DesktopArgumentsParser, self).validate(options, reftest) + super().validate(options, reftest) if options.runTestsInParallel: if options.logFile is not None: @@ -525,7 +525,7 @@ class DesktopArgumentsParser(ReftestArgumentsParser): class RemoteArgumentsParser(ReftestArgumentsParser): def __init__(self, **kwargs): - super(RemoteArgumentsParser, self).__init__() + super().__init__() # app, xrePath and utilityPath variables are set in main function self.set_defaults( diff --git a/python/mozbuild/mozbuild/action/tooltool.py b/python/mozbuild/mozbuild/action/tooltool.py @@ -998,17 +998,17 @@ class TarFile(tarfile.TarFile): self._extracted_members.add(targetpath) def extract(self, *args, **kwargs): - self._tooltool_do_extract(super(TarFile, self).extract, *args, **kwargs) + self._tooltool_do_extract(super().extract, *args, **kwargs) # extractall in versions for cpython that implement PEP 706 call _extract_one # instead of extract. def _extract_one(self, *args, **kwargs): - self._tooltool_do_extract(super(TarFile, self)._extract_one, *args, **kwargs) + self._tooltool_do_extract(super()._extract_one, *args, **kwargs) def extractall(self, *args, **kwargs): self._deferred_links = {} self._extracted_members = set() - super(TarFile, self).extractall(*args, **kwargs) + super().extractall(*args, **kwargs) for links in self._deferred_links.values(): for tarinfo, linkpath, numeric_owner in links: log.warn("Cannot create dangling symbolic link: %s", linkpath) diff --git a/python/mozbuild/mozbuild/action/unify_tests.py b/python/mozbuild/mozbuild/action/unify_tests.py @@ -15,7 +15,7 @@ from mozpack.unify import UnifiedFinder class UnifiedTestFinder(UnifiedFinder): def unify_file(self, path, file1, file2): - unified = super(UnifiedTestFinder, self).unify_file(path, file1, file2) + unified = super().unify_file(path, file1, file2) basename = mozpath.basename(path) if basename == "mozinfo.json": # The mozinfo.json files contain processor info, which differs diff --git a/python/mozbuild/mozbuild/artifact_cache.py b/python/mozbuild/mozbuild/artifact_cache.py @@ -77,7 +77,7 @@ class ArtifactPersistLimit(dlmanager.PersistLimit): """ def __init__(self, log=None): - super(ArtifactPersistLimit, self).__init__( + super().__init__( size_limit=MAX_CACHED_ARTIFACTS_SIZE, file_limit=MIN_CACHED_ARTIFACTS ) self._log = log @@ -105,11 +105,11 @@ class ArtifactPersistLimit(dlmanager.PersistLimit): except OSError: pass self._downloaded_now.add(path) - super(ArtifactPersistLimit, self).register_file(path) + super().register_file(path) def register_dir_content(self, directory, pattern="*"): self._registering_dir = True - super(ArtifactPersistLimit, self).register_dir_content(directory, pattern) + super().register_dir_content(directory, pattern) self._registering_dir = False def remove_old_files(self): diff --git a/python/mozbuild/mozbuild/artifact_commands.py b/python/mozbuild/mozbuild/artifact_commands.py @@ -328,7 +328,7 @@ def artifact_toolchain( class DownloadRecord(FileRecord): def __init__(self, url, *args, **kwargs): - super(DownloadRecord, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.url = url self.basename = self.filename @@ -339,7 +339,7 @@ def artifact_toolchain( def validate(self): if self.size is None and self.digest is None: return True - return super(DownloadRecord, self).validate() + return super().validate() class ArtifactRecord(DownloadRecord): def __init__(self, task_id, artifact_name): @@ -367,9 +367,7 @@ def artifact_toolchain( artifact_name, use_proxy=not artifact_name.startswith("public/"), ) - super(ArtifactRecord, self).__init__( - artifact_url, name, None, digest, algorithm, unpack=True - ) + super().__init__(artifact_url, name, None, digest, algorithm, unpack=True) records = OrderedDict() downloaded = [] diff --git a/python/mozbuild/mozbuild/backend/base.py b/python/mozbuild/mozbuild/backend/base.py @@ -349,7 +349,7 @@ def HybridBackend(*backends): class TheHybridBackend(BuildBackend): def __init__(self, environment): self._backends = [b(environment) for b in backends] - super(TheHybridBackend, self).__init__(environment) + super().__init__(environment) def consume_object(self, obj): return any(b.consume_object(obj) for b in self._backends) diff --git a/python/mozbuild/mozbuild/backend/clangd.py b/python/mozbuild/mozbuild/backend/clangd.py @@ -128,9 +128,7 @@ class ClangdBackend(CompileDBBackend): CompileDBBackend._init(self) def _get_compiler_args(self, cenv, canonical_suffix): - compiler_args = super(ClangdBackend, self)._get_compiler_args( - cenv, canonical_suffix - ) + compiler_args = super()._get_compiler_args(cenv, canonical_suffix) if compiler_args is None: return None diff --git a/python/mozbuild/mozbuild/backend/cpp_eclipse.py b/python/mozbuild/mozbuild/backend/cpp_eclipse.py @@ -29,7 +29,7 @@ class CppEclipseBackend(CommonBackend): "Eclipse is not supported on Windows. " "Consider using Visual Studio instead." ) - super(CppEclipseBackend, self).__init__(environment) + super().__init__(environment) def _init(self): CommonBackend._init(self) diff --git a/python/mozbuild/mozbuild/backend/fastermake.py b/python/mozbuild/mozbuild/backend/fastermake.py @@ -26,7 +26,7 @@ from mozbuild.makeutil import Makefile class FasterMakeBackend(MakeBackend, PartialBackend): def _init(self): - super(FasterMakeBackend, self)._init() + super()._init() self._manifest_entries = defaultdict(set) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -386,7 +386,7 @@ class RecursiveMakeBackend(MakeBackend): } def summary(self): - summary = super(RecursiveMakeBackend, self).summary() + summary = super().summary() summary.extend( "; {makefile_in:d} -> {makefile_out:d} Makefile", makefile_in=self._makefile_in_count, diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py @@ -301,9 +301,7 @@ class MozbuildObject(ProcessExecutionMixin): ) for a in args ) - return super(ReducedConfigureSandbox, self).depends_impl( - *args, **kwargs - ) + return super().depends_impl(*args, **kwargs) # This may be called recursively from configure itself for $reasons, # so avoid logging to the same logger (configure uses "moz.configure") diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py @@ -203,7 +203,7 @@ class DependsFunction: def __getattr__(self, key): if key.startswith("_"): - return super(DependsFunction, self).__getattr__(key) + return super().__getattr__(key) # Our function may return None or an object that simply doesn't have # the wanted key. In that case, just return None. return TrivialDependsFunction( @@ -227,7 +227,7 @@ class CombinedDependsFunction(DependsFunction): elif d not in flatten_deps: flatten_deps.append(d) - super(CombinedDependsFunction, self).__init__(sandbox, func, flatten_deps) + super().__init__(sandbox, func, flatten_deps) @memoize def result(self): @@ -582,7 +582,7 @@ class ConfigureSandbox(dict): if func: return func - return super(ConfigureSandbox, self).__getitem__(key) + return super().__getitem__(key) def __setitem__(self, key, value): if ( @@ -608,7 +608,7 @@ class ConfigureSandbox(dict): if isinstance(value, SandboxDependsFunction): self._depends[value].name = key - return super(ConfigureSandbox, self).__setitem__(key, value) + return super().__setitem__(key, value) def _resolve(self, arg): if isinstance(arg, SandboxDependsFunction): diff --git a/python/mozbuild/mozbuild/configure/lint.py b/python/mozbuild/mozbuild/configure/lint.py @@ -41,9 +41,7 @@ class LintSandbox(ConfigureSandbox): self._bool_options = [] self._bool_func_options = [] self.LOG = "" - super(LintSandbox, self).__init__( - {}, environ=environ, argv=argv, stdout=stdout, stderr=stderr - ) + super().__init__({}, environ=environ, argv=argv, stdout=stdout, stderr=stderr) def run(self, path=None): if path: @@ -191,10 +189,10 @@ class LintSandbox(ConfigureSandbox): elif self._missing_help_dependency(obj): e = ConfigureError("Missing '--help' dependency") self._raise_from(e, obj) - return super(LintSandbox, self)._value_for_depends(obj) + return super()._value_for_depends(obj) def option_impl(self, *args, **kwargs): - result = super(LintSandbox, self).option_impl(*args, **kwargs) + result = super().option_impl(*args, **kwargs) when = self._conditions.get(result) if when: self._value_for(when) @@ -323,7 +321,7 @@ class LintSandbox(ConfigureSandbox): return do_wraps def imports_impl(self, _import, _from=None, _as=None): - wrapper = super(LintSandbox, self).imports_impl(_import, _from=_from, _as=_as) + wrapper = super().imports_impl(_import, _from=_from, _as=_as) def decorator(func): self._has_imports.add(func) @@ -332,7 +330,7 @@ class LintSandbox(ConfigureSandbox): return decorator def _prepare_function(self, func, update_globals=None): - wrapped = super(LintSandbox, self)._prepare_function(func, update_globals) + wrapped = super()._prepare_function(func, update_globals) _, glob = self.unwrap(wrapped) imports = set() for _from, _import, _as in self._imports.get(func, ()): diff --git a/python/mozbuild/mozbuild/configure/options.py b/python/mozbuild/mozbuild/configure/options.py @@ -43,7 +43,7 @@ class OptionValue(tuple): """ def __new__(cls, values=(), origin="unknown"): - return super(OptionValue, cls).__new__(cls, values) + return super().__new__(cls, values) def __init__(self, values=(), origin="unknown"): self.origin = origin @@ -96,13 +96,13 @@ class OptionValue(tuple): elif type(other) is not type(self): return False else: - return super(OptionValue, self).__eq__(other) + return super().__eq__(other) def __ne__(self, other): return not self.__eq__(other) def __repr__(self): - return "%s%s" % (self.__class__.__name__, super(OptionValue, self).__repr__()) + return "%s%s" % (self.__class__.__name__, super().__repr__()) @staticmethod def from_(value): @@ -140,10 +140,10 @@ class NegativeOptionValue(OptionValue): """ def __new__(cls, origin="unknown"): - return super(NegativeOptionValue, cls).__new__(cls, origin=origin) + return super().__new__(cls, origin=origin) def __init__(self, origin="unknown"): - super(NegativeOptionValue, self).__init__(origin=origin) + super().__init__(origin=origin) class InvalidOptionError(Exception): @@ -154,7 +154,7 @@ class ConflictingOptionError(InvalidOptionError): def __init__(self, message, **format_data): if format_data: message = message.format(**format_data) - super(ConflictingOptionError, self).__init__(message) + super().__init__(message) for k, v in format_data.items(): setattr(self, k, v) diff --git a/python/mozbuild/mozbuild/configure/util.py b/python/mozbuild/mozbuild/configure/util.py @@ -72,7 +72,7 @@ class ConfigureOutputHandler(logging.Handler): """ def __init__(self, stdout=sys.stdout, stderr=sys.stderr, maxlen=20): - super(ConfigureOutputHandler, self).__init__() + super().__init__() self._stdout = stdout self._stderr = stderr if stdout != stderr else self._stdout diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py @@ -245,7 +245,7 @@ class Context(KeyedDefaultDict): class TemplateContext(Context): def __init__(self, template=None, allowed_variables={}, config=None): self.template = template - super(TemplateContext, self).__init__(allowed_variables, config) + super().__init__(allowed_variables, config) def _validate(self, key, value): return Context._validate(self, key, value, True) @@ -302,7 +302,7 @@ class InitializedDefines(ContextDerivedValue, OrderedDict): if other: if not isinstance(other[0], OrderedDict): raise ValueError("Can only call update() with another OrderedDict") - return super(InitializedDefines, self).update(*other, **kwargs) + return super().update(*other, **kwargs) raise ValueError("No arguments passed to update()") @@ -843,7 +843,7 @@ class PathMeta(type): cls = AbsolutePath else: cls = SourcePath - return super(PathMeta, cls).__call__(context, value) + return super().__call__(context, value) class Path(ContextDerivedValue, str, metaclass=PathMeta): @@ -859,7 +859,7 @@ class Path(ContextDerivedValue, str, metaclass=PathMeta): """ def __new__(cls, context, value=None): - self = super(Path, cls).__new__(cls, value) + self = super().__new__(cls, value) self.context = context self.srcdir = context.srcdir return self @@ -919,7 +919,7 @@ class SourcePath(Path): raise ValueError( f'Filesystem absolute paths are not allowed\nPath: "{value}"' ) - self = super(SourcePath, cls).__new__(cls, context, value) + self = super().__new__(cls, context, value) if value.startswith("/"): path = None @@ -953,7 +953,7 @@ class RenamedSourcePath(SourcePath): def __new__(cls, context, value): assert isinstance(value, tuple) source, target_basename = value - self = super(RenamedSourcePath, cls).__new__(cls, context, source) + self = super().__new__(cls, context, source) self._target_basename = target_basename return self @@ -968,7 +968,7 @@ class ObjDirPath(Path): def __new__(cls, context, value=None): if not value.startswith("!"): raise ValueError("Object directory paths must start with ! prefix") - self = super(ObjDirPath, cls).__new__(cls, context, value) + self = super().__new__(cls, context, value) if value.startswith("!/"): path = mozpath.join(context.config.topobjdir, value[2:]) @@ -986,7 +986,7 @@ class AbsolutePath(Path): raise ValueError("Absolute paths must start with % prefix") if not os.path.isabs(value[1:]): raise ValueError("Path '%s' is not absolute" % value[1:]) - self = super(AbsolutePath, cls).__new__(cls, context, value) + self = super().__new__(cls, context, value) self.full_path = mozpath.normpath(value[1:]) return self @@ -999,7 +999,7 @@ def ContextDerivedTypedList(klass, base_class=List): class _TypedList(ContextDerivedValue, TypedList(klass, base_class)): def __init__(self, context, iterable=[], **kwargs): self.context = context - super(_TypedList, self).__init__(iterable, **kwargs) + super().__init__(iterable, **kwargs) def normalize(self, e): if not isinstance(e, klass): @@ -1016,7 +1016,7 @@ def ContextDerivedTypedListWithItems(type, base_class=List): class _TypedListWithItems(ContextDerivedTypedList(type, base_class)): def __getitem__(self, name): name = self.normalize(name) - return super(_TypedListWithItems, self).__getitem__(name) + return super().__getitem__(name) return _TypedListWithItems @@ -1174,7 +1174,7 @@ def OrderedPathListWithAction(action): def _action(item): return item, action(context, item) - super(_OrderedListWithAction, self).__init__(context, action=_action, *args) + super().__init__(context, action=_action, *args) return _OrderedListWithAction @@ -1303,7 +1303,7 @@ class Files(SubContext): } def __init__(self, parent, *patterns): - super(Files, self).__init__(parent) + super().__init__(parent) self.patterns = patterns self.finalized = set() diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py @@ -498,12 +498,7 @@ class SandboxValidationError(Exception): s.write("The error occurred when validating the result of ") s.write("the execution. The reported error is:\n") s.write("\n") - s.write( - "".join( - " %s\n" % l - for l in super(SandboxValidationError, self).__str__().splitlines() - ) - ) + s.write("".join(" %s\n" % l for l in super().__str__().splitlines())) s.write("\n") return s.getvalue() diff --git a/python/mozbuild/mozbuild/test/configure/common.py b/python/mozbuild/mozbuild/test/configure/common.py @@ -117,7 +117,7 @@ class ConfigureTestSandbox(ConfigureSandbox): os_contents["environ"] = dict(environ) self.imported_os = ReadOnlyNamespace(**os_contents) - super(ConfigureTestSandbox, self).__init__(config, environ, *args, **kwargs) + super().__init__(config, environ, *args, **kwargs) @memoized_property def _wrapped_mozfile(self): diff --git a/python/mozbuild/mozbuild/test/configure/test_configure.py b/python/mozbuild/mozbuild/test/configure/test_configure.py @@ -474,7 +474,7 @@ class TestConfigure(unittest.TestCase): class CountApplyImportsSandbox(ConfigureSandbox): def _apply_imports(self, *args, **kwargs): imports.append((args, kwargs)) - super(CountApplyImportsSandbox, self)._apply_imports(*args, **kwargs) + super()._apply_imports(*args, **kwargs) config = {} out = StringIO() diff --git a/python/mozbuild/mozbuild/test/configure/test_moz_configure.py b/python/mozbuild/mozbuild/test/configure/test_moz_configure.py @@ -154,7 +154,7 @@ class TestTargetOpenBSD(TargetTest): def config_sub(self, stdin, args): if args[0] == "amd64-unknown-openbsd6.4": return 0, "x86_64-unknown-openbsd6.4", "" - return super(TestTargetOpenBSD, self).config_sub(stdin, args) + return super().config_sub(stdin, args) class TestMozConfigure(BaseConfigureTest): diff --git a/python/mozbuild/mozbuild/test/configure/test_options.py b/python/mozbuild/mozbuild/test/configure/test_options.py @@ -20,7 +20,7 @@ from mozbuild.configure.options import ( class Option(Option): def __init__(self, *args, **kwargs): kwargs["help"] = "Dummy help" - super(Option, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) class TestOption(unittest.TestCase): diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_configure.py @@ -343,7 +343,7 @@ LIBRARY_NAME_INFOS = { class BaseToolchainTest(BaseConfigureTest): def setUp(self): - super(BaseToolchainTest, self).setUp() + super().setUp() self.maxDiff = None self.out = StringIO() self.logger = logging.getLogger("BaseToolchainTest") @@ -355,7 +355,7 @@ class BaseToolchainTest(BaseConfigureTest): self.logger.removeHandler(self.handler) del self.handler del self.out - super(BaseToolchainTest, self).tearDown() + super().tearDown() def do_toolchain_test(self, paths, results, args=[], environ={}): """Helper to test the toolchain checks from toolchain.configure. diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py @@ -344,7 +344,7 @@ class CompilerResult(ReadOnlyNamespace): flags = [] if wrapper is None: wrapper = [] - super(CompilerResult, self).__init__( + super().__init__( flags=flags, version=version, type=type, diff --git a/python/mozbuild/mozbuild/test/frontend/test_sandbox.py b/python/mozbuild/mozbuild/test/frontend/test_sandbox.py @@ -125,12 +125,10 @@ class TestedSandbox(MozbuildSandbox): return SourcePath(self._context, path) def exec_file(self, path, becomes_current_path=True): - super(TestedSandbox, self).exec_file( - self.normalize_path(path), becomes_current_path - ) + super().exec_file(self.normalize_path(path), becomes_current_path) def exec_source(self, source, path="", becomes_current_path=True): - super(TestedSandbox, self).exec_source( + super().exec_source( source, self.normalize_path(path) if path else "", becomes_current_path ) diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py @@ -83,7 +83,7 @@ class EmptyValue(str): """ def __init__(self): - super(EmptyValue, self).__init__() + super().__init__() class ReadOnlyNamespace: @@ -91,7 +91,7 @@ class ReadOnlyNamespace: def __init__(self, **kwargs): for k, v in kwargs.items(): - super(ReadOnlyNamespace, self).__setattr__(k, v) + super().__setattr__(k, v) def __delattr__(self, key): raise Exception("Object does not support deletion.") @@ -400,13 +400,13 @@ class List(list): raise ValueError("List can only be created from other list instances.") self._kwargs = kwargs - super(List, self).__init__(iterable) + super().__init__(iterable) def extend(self, l): if not isinstance(l, list): raise ValueError("List can only be extended with other list instances.") - return super(List, self).extend(l) + return super().extend(l) def __setitem__(self, key, val): if isinstance(key, slice): @@ -416,8 +416,8 @@ class List(list): ) if key.step: raise ValueError("List cannot be sliced with a nonzero step " "value") - return super(List, self).__setitem__(key, val) - return super(List, self).__setitem__(key, val) + return super().__setitem__(key, val) + return super().__setitem__(key, val) def __setslice__(self, i, j, sequence): return self.__setitem__(slice(i, j), sequence) @@ -438,7 +438,7 @@ class List(list): if not isinstance(other, list): raise ValueError("Only lists can be appended to lists.") - return super(List, self).__iadd__(other) + return super().__iadd__(other) class UnsortedError(Exception): @@ -496,27 +496,27 @@ class StrictOrderingOnAppendList(List): StrictOrderingOnAppendList.ensure_sorted(iterable) - super(StrictOrderingOnAppendList, self).__init__(iterable, **kwargs) + super().__init__(iterable, **kwargs) def extend(self, l): StrictOrderingOnAppendList.ensure_sorted(l) - return super(StrictOrderingOnAppendList, self).extend(l) + return super().extend(l) def __setitem__(self, key, val): if isinstance(key, slice): StrictOrderingOnAppendList.ensure_sorted(val) - return super(StrictOrderingOnAppendList, self).__setitem__(key, val) + return super().__setitem__(key, val) def __add__(self, other): StrictOrderingOnAppendList.ensure_sorted(other) - return super(StrictOrderingOnAppendList, self).__add__(other) + return super().__add__(other) def __iadd__(self, other): StrictOrderingOnAppendList.ensure_sorted(other) - return super(StrictOrderingOnAppendList, self).__iadd__(other) + return super().__iadd__(other) class ImmutableStrictOrderingOnAppendList(StrictOrderingOnAppendList): @@ -560,9 +560,7 @@ class StrictOrderingOnAppendListWithAction(StrictOrderingOnAppendList): "with another list" ) iterable = [self._action(i) for i in iterable] - super(StrictOrderingOnAppendListWithAction, self).__init__( - iterable, action=action - ) + super().__init__(iterable, action=action) def extend(self, l): if not isinstance(l, list): @@ -571,7 +569,7 @@ class StrictOrderingOnAppendListWithAction(StrictOrderingOnAppendList): "with another list" ) l = [self._action(i) for i in l] - return super(StrictOrderingOnAppendListWithAction, self).extend(l) + return super().extend(l) def __setitem__(self, key, val): if isinstance(key, slice): @@ -581,7 +579,7 @@ class StrictOrderingOnAppendListWithAction(StrictOrderingOnAppendList): "with another list" ) val = [self._action(item) for item in val] - return super(StrictOrderingOnAppendListWithAction, self).__setitem__(key, val) + return super().__setitem__(key, val) def __add__(self, other): if not isinstance(other, list): @@ -589,7 +587,7 @@ class StrictOrderingOnAppendListWithAction(StrictOrderingOnAppendList): "StrictOrderingOnAppendListWithAction can only be added with " "another list" ) - return super(StrictOrderingOnAppendListWithAction, self).__add__(other) + return super().__add__(other) def __iadd__(self, other): if not isinstance(other, list): @@ -598,7 +596,7 @@ class StrictOrderingOnAppendListWithAction(StrictOrderingOnAppendList): "another list" ) other = [self._action(i) for i in other] - return super(StrictOrderingOnAppendListWithAction, self).__iadd__(other) + return super().__iadd__(other) class MozbuildDeletionError(Exception): @@ -707,9 +705,7 @@ def StrictOrderingOnAppendListWithFlagsFactory(flags): "'%s' object does not support item assignment" % self.__class__.__name__ ) - result = super( - StrictOrderingOnAppendListWithFlagsSpecialization, self - ).__setitem__(name, value) + result = super().__setitem__(name, value) # We may have removed items. for k in set(self._flags.keys()) - set(self): del self._flags[k] @@ -732,17 +728,13 @@ def StrictOrderingOnAppendListWithFlagsFactory(flags): self._flags.update(other._flags) def extend(self, l): - result = super( - StrictOrderingOnAppendListWithFlagsSpecialization, self - ).extend(l) + result = super().extend(l) if isinstance(l, StrictOrderingOnAppendListWithFlags): self._update_flags(l) return result def __add__(self, other): - result = super( - StrictOrderingOnAppendListWithFlagsSpecialization, self - ).__add__(other) + result = super().__add__(other) if isinstance(other, StrictOrderingOnAppendListWithFlags): # Result has flags from other but not from self, since # internally we duplicate self and then extend with other, and @@ -754,9 +746,7 @@ def StrictOrderingOnAppendListWithFlagsFactory(flags): return result def __iadd__(self, other): - result = super( - StrictOrderingOnAppendListWithFlagsSpecialization, self - ).__iadd__(other) + result = super().__iadd__(other) if isinstance(other, StrictOrderingOnAppendListWithFlags): self._update_flags(other) return result @@ -984,7 +974,7 @@ def TypedNamedTuple(name, fields): if len(args) == 1 and not kwargs and isinstance(args[0], tuple): args = args[0] - return super(TypedTuple, klass).__new__(klass, *args, **kwargs) + return super().__new__(klass, *args, **kwargs) def __init__(self, *args, **kwargs): for i, (fname, ftype) in enumerate(self._fields): @@ -1032,27 +1022,27 @@ def TypedList(type, base_class=List): iterable = [] iterable = self._ensure_type(iterable) - super(_TypedList, self).__init__(iterable, **kwargs) + super().__init__(iterable, **kwargs) def extend(self, l): l = self._ensure_type(l) - return super(_TypedList, self).extend(l) + return super().extend(l) def __setitem__(self, key, val): val = self._ensure_type(val) - return super(_TypedList, self).__setitem__(key, val) + return super().__setitem__(key, val) def __add__(self, other): other = self._ensure_type(other) - return super(_TypedList, self).__add__(other) + return super().__add__(other) def __iadd__(self, other): other = self._ensure_type(other) - return super(_TypedList, self).__iadd__(other) + return super().__iadd__(other) def append(self, other): self += [other] @@ -1213,13 +1203,13 @@ class EnumString(str): "Can only compare with %s" % ", ".join("'%s'" % v for v in self.POSSIBLE_VALUES) ) - return super(EnumString, self).__eq__(other) + return super().__eq__(other) def __ne__(self, other): return not (self == other) def __hash__(self): - return super(EnumString, self).__hash__() + return super().__hash__() def __repr__(self): return f"{self.__class__.__name__}({str(self)!r})" diff --git a/python/mozbuild/mozpack/files.py b/python/mozbuild/mozpack/files.py @@ -433,7 +433,7 @@ class HardlinkFile(File): assert isinstance(dest, str) if not hasattr(os, "link"): - return super(HardlinkFile, self).copy(dest, skip_if_older=skip_if_older) + return super().copy(dest, skip_if_older=skip_if_older) try: path_st = os.stat(self.path) @@ -463,7 +463,7 @@ class HardlinkFile(File): os.link(self.path, dest) except OSError: # If we can't hard link, fall back to copying - return super(HardlinkFile, self).copy(dest, skip_if_older=skip_if_older) + return super().copy(dest, skip_if_older=skip_if_older) return True @@ -1166,7 +1166,7 @@ class MercurialRevisionFinder(BaseFinder): if not hglib: raise Exception("hglib package not found") - super(MercurialRevisionFinder, self).__init__(base=repo, **kwargs) + super().__init__(base=repo, **kwargs) self._root = mozpath.normpath(repo).rstrip("/") self._recognize_repo_paths = recognize_repo_paths diff --git a/python/mozbuild/mozpack/packager/l10n.py b/python/mozbuild/mozpack/packager/l10n.py @@ -81,7 +81,7 @@ class LocaleManifestFinder: class L10NRepackFormatterMixin: def __init__(self, *args, **kwargs): - super(L10NRepackFormatterMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._dictionaries = {} def add(self, path, file): @@ -104,7 +104,7 @@ class L10NRepackFormatterMixin: # in the omnijar, as expected -- but the signatures won't be valid # after repacking. Therefore, drop them. return - super(L10NRepackFormatterMixin, self).add(path, file) + super().add(path, file) def L10NRepackFormatter(klass): diff --git a/python/mozbuild/mozpack/test/test_files.py b/python/mozbuild/mozpack/test/test_files.py @@ -1248,7 +1248,7 @@ class TestComposedFinder(MatchTestTemplate, TestWithTmpDir): @unittest.skipIf(os.name == "nt", "Does not currently work in Python3 on Windows") class TestMercurialRevisionFinder(MatchTestTemplate, TestWithTmpDir): def setUp(self): - super(TestMercurialRevisionFinder, self).setUp() + super().setUp() hglib.init(self.tmpdir) self._clients = [] @@ -1262,7 +1262,7 @@ class TestMercurialRevisionFinder(MatchTestTemplate, TestWithTmpDir): self._clients[:] = [] - super(TestMercurialRevisionFinder, self).tearDown() + super().tearDown() def _client(self): configs = ( diff --git a/python/mozbuild/mozpack/test/test_packager_unpack.py b/python/mozbuild/mozpack/test/test_packager_unpack.py @@ -52,7 +52,7 @@ class TestUnpack(TestWithTmpDir): OMNIJAR_NAME = name def __init__(self, registry): - super(OmniFooFormatter, self).__init__(registry, name) + super().__init__(registry, name) return OmniFooFormatter diff --git a/python/mozperftest/mozperftest/layers.py b/python/mozperftest/mozperftest/layers.py @@ -92,7 +92,7 @@ class Layer(MachLogger): class Layers(Layer): def __init__(self, env, mach_command, factories): - super(Layers, self).__init__(env, mach_command) + super().__init__(env, mach_command) def _active(layer): # if it's activated by default, see if we need to deactivate diff --git a/python/mozperftest/mozperftest/script.py b/python/mozperftest/mozperftest/script.py @@ -103,7 +103,7 @@ class ScriptInfo(defaultdict): """Loads and parses a Browsertime test script.""" def __init__(self, path): - super(ScriptInfo, self).__init__() + super().__init__() try: self.script = Path(path).resolve() if self.script.suffix == ".html": diff --git a/python/mozperftest/mozperftest/system/android.py b/python/mozperftest/mozperftest/system/android.py @@ -60,7 +60,7 @@ class AndroidSetupError(Exception): class ADBLoggedDevice(ADBDevice): def __init__(self, *args, **kw): self._provided_logger = kw.pop("logger") - super(ADBLoggedDevice, self).__init__(*args, **kw) + super().__init__(*args, **kw) def _get_logger(self, logger_name, verbose): return self._provided_logger @@ -123,7 +123,7 @@ class AndroidDevice(Layer): } def __init__(self, env, mach_cmd): - super(AndroidDevice, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.android_activity = self.app_name = self.device = None self.capture_logcat = self.capture_file = None self._custom_apk_path = None diff --git a/python/mozperftest/mozperftest/system/binarysetup.py b/python/mozperftest/mozperftest/system/binarysetup.py @@ -13,7 +13,7 @@ class BinarySetup(Layer): arguments = {} def __init__(self, env, mach_cmd): - super(BinarySetup, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.env = env self.mach_cmd = mach_cmd self.get_binary_path = mach_cmd.get_binary_path diff --git a/python/mozperftest/mozperftest/system/macos.py b/python/mozperftest/mozperftest/system/macos.py @@ -27,7 +27,7 @@ class MacosDevice(Layer): activated = platform.system() == "Darwin" def __init__(self, env, mach_cmd): - super(MacosDevice, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self._tmp_dirs = [] def _run_process(self, args): diff --git a/python/mozperftest/mozperftest/system/profile.py b/python/mozperftest/mozperftest/system/profile.py @@ -46,7 +46,7 @@ class Profile(Layer): } def __init__(self, env, mach_cmd): - super(Profile, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self._created_dirs = [] def setup(self): diff --git a/python/mozperftest/mozperftest/system/proxy.py b/python/mozperftest/mozperftest/system/proxy.py @@ -109,7 +109,7 @@ class ProxyRunner(Layer): } def __init__(self, env, mach_cmd): - super(ProxyRunner, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.proxy = None self.tmpdir = None diff --git a/python/mozperftest/mozperftest/system/setups.py b/python/mozperftest/mozperftest/system/setups.py @@ -54,7 +54,7 @@ class BaseVersionProducer: class DesktopVersionProducer(BaseVersionProducer): def get_binary_version(self, binary, **kwargs): try: - return super(DesktopVersionProducer, self).get_binary_version(binary) + return super().get_binary_version(binary) except Exception: pass @@ -118,9 +118,7 @@ class DesktopVersionProducer(BaseVersionProducer): class MobileVersionProducer(BaseVersionProducer): def get_binary_version(self, binary, apk_path=None, **kwargs): try: - return super(MobileVersionProducer, self).get_binary_version( - apk_path or binary - ) + return super().get_binary_version(apk_path or binary) except Exception: pass diff --git a/python/mozperftest/mozperftest/system/simpleperf.py b/python/mozperftest/mozperftest/system/simpleperf.py @@ -159,7 +159,7 @@ class SimpleperfProfiler(Layer): } def __init__(self, env, mach_cmd): - super(SimpleperfProfiler, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.device = ADBDevice() @staticmethod diff --git a/python/mozperftest/mozperftest/system/versionproducer.py b/python/mozperftest/mozperftest/system/versionproducer.py @@ -14,7 +14,7 @@ class VersionProducer(Layer): arguments = {} def __init__(self, env, mach_cmd): - super(VersionProducer, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.env = env self.mach_cmd = mach_cmd diff --git a/python/mozperftest/mozperftest/test/alert.py b/python/mozperftest/mozperftest/test/alert.py @@ -305,7 +305,7 @@ class AlertTestRunner(Layer): } def __init__(self, env, mach_cmd): - super(AlertTestRunner, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.perfherder_data = {} def _get_task_info(self, task_id): diff --git a/python/mozperftest/mozperftest/test/browsertime/runner.py b/python/mozperftest/mozperftest/test/browsertime/runner.py @@ -88,7 +88,7 @@ class BrowsertimeRunner(NodeRunner): } def __init__(self, env, mach_cmd): - super(BrowsertimeRunner, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.topsrcdir = mach_cmd.topsrcdir self._mach_context = mach_cmd._mach_context self.virtualenv_manager = mach_cmd.virtualenv_manager @@ -198,7 +198,7 @@ class BrowsertimeRunner(NodeRunner): if node is not None: os.environ["NODEJS"] = node - super(BrowsertimeRunner, self).setup() + super().setup() install_url = self.get_arg("install-url") # installing Python deps on the fly diff --git a/python/mozperftest/mozperftest/test/functionaltestrunner.py b/python/mozperftest/mozperftest/test/functionaltestrunner.py @@ -14,7 +14,7 @@ class FunctionalTestProcessor(mozlog.handlers.StreamHandler): def __init__(self, *args, **kwargs): self._match = [] - super(FunctionalTestProcessor, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def __call__(self, data): formatted = self.formatter(data) diff --git a/python/mozperftest/mozperftest/test/mochitest.py b/python/mozperftest/mozperftest/test/mochitest.py @@ -98,7 +98,7 @@ class Mochitest(Layer): } def __init__(self, env, mach_cmd): - super(Mochitest, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.topsrcdir = mach_cmd.topsrcdir self._mach_context = mach_cmd._mach_context self.python_path = mach_cmd.virtualenv_manager.python_path diff --git a/python/mozperftest/mozperftest/test/noderunner.py b/python/mozperftest/mozperftest/test/noderunner.py @@ -14,7 +14,7 @@ class NodeRunner(Layer): name = "node" def __init__(self, env, mach_cmd): - super(NodeRunner, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.topsrcdir = mach_cmd.topsrcdir self._mach_context = mach_cmd._mach_context self.python_path = mach_cmd.virtualenv_manager.python_path diff --git a/python/mozperftest/mozperftest/test/shellscript.py b/python/mozperftest/mozperftest/test/shellscript.py @@ -70,7 +70,7 @@ class ShellScriptRunner(Layer): } def __init__(self, env, mach_cmd): - super(ShellScriptRunner, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.metrics = [] self.timed_out = False self.output_timed_out = False diff --git a/python/mozperftest/mozperftest/test/webpagetest.py b/python/mozperftest/mozperftest/test/webpagetest.py @@ -132,7 +132,7 @@ class PropagatingErrorThread(Thread): self.exc = e def join(self, timeout=None): - super(PropagatingErrorThread, self).join() + super().join() if self.exc: raise self.exc @@ -177,7 +177,7 @@ class WebPageTest(Layer): } def __init__(self, env, mach_cmd): - super(WebPageTest, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) if utils.ON_TRY: self.WPT_key = utils.get_tc_secret(wpt=True)["wpt_key"] else: diff --git a/python/mozperftest/mozperftest/test/xpcshell.py b/python/mozperftest/mozperftest/test/xpcshell.py @@ -72,7 +72,7 @@ class XPCShell(Layer): } def __init__(self, env, mach_cmd): - super(XPCShell, self).__init__(env, mach_cmd) + super().__init__(env, mach_cmd) self.topsrcdir = mach_cmd.topsrcdir self._mach_context = mach_cmd._mach_context self.python_path = mach_cmd.virtualenv_manager.python_path diff --git a/python/mozrelease/mozrelease/partner_repack.py b/python/mozrelease/mozrelease/partner_repack.py @@ -442,7 +442,7 @@ class RepackLinux(RepackBase): repack_info, **kwargs, ): - super(RepackLinux, self).__init__( + super().__init__( build, partner_dir, build_dir, @@ -454,7 +454,7 @@ class RepackLinux(RepackBase): self.uncompressed_build = build.replace(".xz", "") def unpackBuild(self): - super(RepackLinux, self).unpackBuild() + super().unpackBuild() target_path = Path(self.uncompressed_build) unpack_cmd = f"xz -c -d {self.build} > {target_path.absolute()}" shellCommand(unpack_cmd) @@ -465,7 +465,7 @@ class RepackLinux(RepackBase): sys.exit(1) def copyFiles(self): - super(RepackLinux, self).copyFiles(LINUX_DEST_DIR) + super().copyFiles(LINUX_DEST_DIR) def repackBuild(self): if options.quiet: @@ -489,7 +489,7 @@ class RepackMac(RepackBase): repack_info, **kwargs, ): - super(RepackMac, self).__init__( + super().__init__( build, partner_dir, build_dir, @@ -501,7 +501,7 @@ class RepackMac(RepackBase): self.uncompressed_build = build.replace(".gz", "") def unpackBuild(self): - super(RepackMac, self).unpackBuild() + super().unpackBuild() gunzip_cmd = "gunzip %s" % self.build shellCommand(gunzip_cmd) if not Path(self.uncompressed_build).exists(): @@ -523,7 +523,7 @@ class RepackMac(RepackBase): sys.exit(1) def copyFiles(self): - super(RepackMac, self).copyFiles(Path(self.appName) / MAC_DEST_DIR) + super().copyFiles(Path(self.appName) / MAC_DEST_DIR) def repackBuild(self): if options.quiet: @@ -552,7 +552,7 @@ class RepackWin(RepackBase): repack_info, **kwargs, ): - super(RepackWin, self).__init__( + super().__init__( build, partner_dir, build_dir, @@ -563,7 +563,7 @@ class RepackWin(RepackBase): ) def copyFiles(self): - super(RepackWin, self).copyFiles(WINDOWS_DEST_DIR) + super().copyFiles(WINDOWS_DEST_DIR) def repackBuild(self): if options.quiet: @@ -596,7 +596,7 @@ class RepackWin(RepackBase): z.close() def stage(self): - super(RepackWin, self).stage() + super().stage() setup_dest = Path(str(self.final_build).replace("target.zip", "setup.exe")) if "replacement_setup_exe" in self.repack_info: log.info("Overriding setup.exe with custom copy") diff --git a/python/mozversioncontrol/mozversioncontrol/errors.py b/python/mozversioncontrol/mozversioncontrol/errors.py @@ -21,7 +21,7 @@ class MissingVCSExtension(MissingVCSInfo): def __init__(self, ext): self.ext = ext msg = f"Could not detect required extension '{self.ext}'" - super(MissingVCSExtension, self).__init__(msg) + super().__init__(msg) class InvalidRepoPath(Exception): diff --git a/python/mozversioncontrol/mozversioncontrol/repo/git.py b/python/mozversioncontrol/mozversioncontrol/repo/git.py @@ -56,7 +56,7 @@ class GitRepository(Repository): """An implementation of `Repository` for Git repositories.""" def __init__(self, path: Path, git="git"): - super(GitRepository, self).__init__(path, tool=git) + super().__init__(path, tool=git) @property def name(self): diff --git a/python/mozversioncontrol/mozversioncontrol/repo/jj.py b/python/mozversioncontrol/mozversioncontrol/repo/jj.py @@ -49,7 +49,7 @@ class JujutsuRepository(Repository): HEAD_REVSET = 'coalesce(@ ~ (empty() & description(exact:"")) ~ bookmarks(), @-)' def __init__(self, path: Path, jj="jj", git="git"): - super(JujutsuRepository, self).__init__(path, tool=jj) + super().__init__(path, tool=jj) self._git = GitRepository(path, git=git) # Find git root. Newer jj has `jj git root`, but this should support diff --git a/python/mozversioncontrol/mozversioncontrol/repo/mercurial.py b/python/mozversioncontrol/mozversioncontrol/repo/mercurial.py @@ -27,7 +27,7 @@ class HgRepository(Repository): def __init__(self, path: Path, hg="hg"): import hglib.client - super(HgRepository, self).__init__(path, tool=hg) + super().__init__(path, tool=hg) self._env["HGPLAIN"] = "1" # Setting this modifies a global variable and makes all future hglib @@ -91,7 +91,7 @@ class HgRepository(Repository): def _run(self, *args, **runargs): if not self._client.server: - return super(HgRepository, self)._run(*args, **runargs) + return super()._run(*args, **runargs) # hglib requires bytes on python 3 args = [a.encode("utf-8") if not isinstance(a, bytes) else a for a in args] diff --git a/python/mozversioncontrol/mozversioncontrol/repo/source.py b/python/mozversioncontrol/mozversioncontrol/repo/source.py @@ -17,7 +17,7 @@ class SrcRepository(Repository): """An implementation of `Repository` for Git repositories.""" def __init__(self, path: Path, src="src"): - super(SrcRepository, self).__init__(path, tool=None) + super().__init__(path, tool=None) @property def name(self): diff --git a/remote/mach_commands.py b/remote/mach_commands.py @@ -385,7 +385,7 @@ class TemporaryDirectory: class PuppeteerRunner(MozbuildObject): def __init__(self, *args, **kwargs): - super(PuppeteerRunner, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.remotedir = os.path.join(self.topsrcdir, "remote") self.puppeteer_dir = os.path.join(self.remotedir, "test", "puppeteer") diff --git a/security/ct/tests/gtest/createSTHTestData.py b/security/ct/tests/gtest/createSTHTestData.py @@ -57,7 +57,7 @@ class UnknownParameterTypeError(Error): """Base class for handling unexpected input in this module.""" def __init__(self, value): - super(Error, self).__init__() + super().__init__() self.value = value self.category = "key" @@ -69,7 +69,7 @@ class InputTooLongError(Error): """Helper exception type for inputs that are too long.""" def __init__(self, length): - super(InputTooLongError, self).__init__() + super().__init__() self.length = length def __str__(self): diff --git a/security/manager/tools/pycms.py b/security/manager/tools/pycms.py @@ -55,7 +55,7 @@ class UnknownDirectiveError(Error): directives.""" def __init__(self, directive): - super(UnknownDirectiveError, self).__init__() + super().__init__() self.directive = directive def __str__(self): diff --git a/security/manager/tools/pykey.py b/security/manager/tools/pykey.py @@ -91,7 +91,7 @@ class UnknownBaseError(Exception): """Base class for handling unexpected input in this module.""" def __init__(self, value): - super(UnknownBaseError, self).__init__() + super().__init__() self.value = value self.category = "input" @@ -119,7 +119,7 @@ class UnsupportedHashAlgorithmError(Exception): """Helper exception type for unsupported hash algorithms.""" def __init__(self, value): - super(UnsupportedHashAlgorithmError, self).__init__() + super().__init__() self.value = value def __str__(self): diff --git a/security/manager/tools/pypkcs12.py b/security/manager/tools/pypkcs12.py @@ -37,7 +37,7 @@ class OpenSSLError(Error): """Class for handling errors when calling OpenSSL.""" def __init__(self, status): - super(OpenSSLError, self).__init__() + super().__init__() self.status = status def __str__(self): diff --git a/taskcluster/docker/snap-coreXX-build/snap-tests/basic_tests.py b/taskcluster/docker/snap-coreXX-build/snap-tests/basic_tests.py @@ -429,7 +429,7 @@ class SnapTestsBase: class SnapTests(SnapTestsBase): def __init__(self, exp): self._dir = "basic_tests" - super(__class__, self).__init__(exp) + super().__init__(exp) def test_snap_core_base(self, exp): assert self.snap_core_base() in ["22", "24"], "Core base should be 22 or 24" diff --git a/testing/addtest.py b/testing/addtest.py @@ -116,7 +116,7 @@ class WebPlatformTestsCreator(Creator): local_path = os.path.join("testing", "web-platform", "mozilla", "tests") def __init__(self, *args, **kwargs): - super(WebPlatformTestsCreator, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.reftest = self.suite == "web-platform-tests-reftest" @classmethod diff --git a/testing/firefox-ui/harness/firefox_ui_harness/arguments/base.py b/testing/firefox-ui/harness/firefox_ui_harness/arguments/base.py @@ -12,6 +12,6 @@ class FirefoxUIBaseArguments: class FirefoxUIArguments(BaseMarionetteArguments): def __init__(self, **kwargs): - super(FirefoxUIArguments, self).__init__(**kwargs) + super().__init__(**kwargs) self.register_argument_container(FirefoxUIBaseArguments()) diff --git a/testing/firefox-ui/harness/firefox_ui_harness/runners/base.py b/testing/firefox-ui/harness/firefox_ui_harness/runners/base.py @@ -9,7 +9,7 @@ from marionette_harness import BaseMarionetteTestRunner, MarionetteTestCase class FirefoxUITestRunner(BaseMarionetteTestRunner): def __init__(self, **kwargs): - super(FirefoxUITestRunner, self).__init__(**kwargs) + super().__init__(**kwargs) # select the appropriate GeckoInstance self.app = "fxdesktop" diff --git a/testing/firefox-ui/tests/functional/safebrowsing/test_initial_download.py b/testing/firefox-ui/tests/functional/safebrowsing/test_initial_download.py @@ -70,7 +70,7 @@ class TestSafeBrowsingInitialDownload(MarionetteTestCase): return set(sorted(files)) def setUp(self): - super(TestSafeBrowsingInitialDownload, self).setUp() + super().setUp() self.safebrowsing_shavar_files = self.get_safebrowsing_files(False) if any( @@ -121,7 +121,7 @@ class TestSafeBrowsingInitialDownload(MarionetteTestCase): # Restart with a fresh profile self.marionette.restart(in_app=False, clean=True) finally: - super(TestSafeBrowsingInitialDownload, self).tearDown() + super().tearDown() def test_safe_browsing_initial_download(self): def check_downloaded(_): diff --git a/testing/firefox-ui/tests/functional/safebrowsing/test_notification.py b/testing/firefox-ui/tests/functional/safebrowsing/test_notification.py @@ -10,7 +10,7 @@ from marionette_harness import MarionetteTestCase, WindowManagerMixin class TestSafeBrowsingNotificationBar(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestSafeBrowsingNotificationBar, self).setUp() + super().setUp() self.test_data = [ # Unwanted software URL @@ -43,7 +43,7 @@ class TestSafeBrowsingNotificationBar(WindowManagerMixin, MarionetteTestCase): self.remove_permission("https://www.itisatrap.org", "safe-browsing") self.close_all_tabs() finally: - super(TestSafeBrowsingNotificationBar, self).tearDown() + super().tearDown() def test_notification_bar(self): for item in self.test_data: diff --git a/testing/firefox-ui/tests/functional/safebrowsing/test_warning_pages.py b/testing/firefox-ui/tests/functional/safebrowsing/test_warning_pages.py @@ -10,7 +10,7 @@ from marionette_harness import MarionetteTestCase, WindowManagerMixin class TestSafeBrowsingWarningPages(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestSafeBrowsingWarningPages, self).setUp() + super().setUp() self.urls = [ # Unwanted software URL @@ -50,7 +50,7 @@ class TestSafeBrowsingWarningPages(WindowManagerMixin, MarionetteTestCase): self.remove_permission("https://www.itisatrap.org", "safe-browsing") self.close_all_tabs() finally: - super(TestSafeBrowsingWarningPages, self).tearDown() + super().tearDown() def test_warning_pages(self): for unsafe_page in self.urls: diff --git a/testing/firefox-ui/tests/functional/security/test_https_first.py b/testing/firefox-ui/tests/functional/security/test_https_first.py @@ -18,7 +18,7 @@ from marionette_harness import MarionetteTestCase, WindowManagerMixin class TestHTTPSFirst(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestHTTPSFirst, self).setUp() + super().setUp() self.http_url = "http://example.org/" self.https_url = "https://example.org/" @@ -30,7 +30,7 @@ class TestHTTPSFirst(WindowManagerMixin, MarionetteTestCase): with self.marionette.using_context("chrome"): self.marionette.execute_script("Services.perms.removeAll();") - super(TestHTTPSFirst, self).tearDown() + super().tearDown() def test_no_upgrade_with_http_only_site(self): self.navigate_in_urlbar(self.http_only_url) diff --git a/testing/firefox-ui/tests/functional/security/test_ssl_status_after_restart.py b/testing/firefox-ui/tests/functional/security/test_ssl_status_after_restart.py @@ -8,7 +8,7 @@ from marionette_harness import MarionetteTestCase, WindowManagerMixin class TestSSLStatusAfterRestart(WindowManagerMixin, MarionetteTestCase): def setUp(self): - super(TestSSLStatusAfterRestart, self).setUp() + super().setUp() self.marionette.set_context("chrome") self.test_url = "https://www.itisatrap.org/" @@ -22,7 +22,7 @@ class TestSSLStatusAfterRestart(WindowManagerMixin, MarionetteTestCase): self.marionette.clear_pref("browser.startup.page") self.marionette.clear_pref("network.http.rcwn.enable") - super(TestSSLStatusAfterRestart, self).tearDown() + super().tearDown() def test_ssl_status_after_restart(self): with self.marionette.using_context("content"): diff --git a/testing/gtest/remotegtests.py b/testing/gtest/remotegtests.py @@ -413,9 +413,7 @@ class AppWaiter: class remoteGtestOptions(argparse.ArgumentParser): def __init__(self): - super(remoteGtestOptions, self).__init__( - usage="usage: %prog [options] test_filter" - ) + super().__init__(usage="usage: %prog [options] test_filter") self.add_argument( "--package", dest="package", diff --git a/testing/gtest/rungtests.py b/testing/gtest/rungtests.py @@ -259,7 +259,7 @@ class GTests: class gtestOptions(argparse.ArgumentParser): def __init__(self): - super(gtestOptions, self).__init__() + super().__init__() self.add_argument( "--cwd", diff --git a/testing/marionette/client/marionette_driver/errors.py b/testing/marionette/client/marionette_driver/errors.py @@ -117,9 +117,7 @@ class ElementNotVisibleException(MarionetteException): stacktrace=None, cause=None, ): - super(ElementNotVisibleException, self).__init__( - message, cause=cause, stacktrace=stacktrace - ) + super().__init__(message, cause=cause, stacktrace=stacktrace) class ElementNotAccessibleException(MarionetteException): diff --git a/testing/marionette/client/marionette_driver/expected.py b/testing/marionette/client/marionette_driver/expected.py @@ -66,10 +66,10 @@ class element_not_present(element_present): """ def __init__(self, *args): - super(element_not_present, self).__init__(*args) + super().__init__(*args) def __call__(self, marionette): - return not super(element_not_present, self).__call__(marionette) + return not super().__call__(marionette) class element_stale: @@ -156,10 +156,10 @@ class elements_not_present(elements_present): """ def __init__(self, *args): - super(elements_not_present, self).__init__(*args) + super().__init__(*args) def __call__(self, marionette): - return not super(elements_not_present, self).__call__(marionette) + return not super().__call__(marionette) class element_displayed: @@ -235,10 +235,10 @@ class element_not_displayed(element_displayed): """ def __init__(self, *args): - super(element_not_displayed, self).__init__(*args) + super().__init__(*args) def __call__(self, marionette): - return not super(element_not_displayed, self).__call__(marionette) + return not super().__call__(marionette) class element_selected: @@ -266,10 +266,10 @@ class element_not_selected(element_selected): """ def __init__(self, element): - super(element_not_selected, self).__init__(element) + super().__init__(element) def __call__(self, marionette): - return not super(element_not_selected, self).__call__(marionette) + return not super().__call__(marionette) class element_enabled: @@ -296,10 +296,10 @@ class element_not_enabled(element_enabled): """ def __init__(self, element): - super(element_not_enabled, self).__init__(element) + super().__init__(element) def __call__(self, marionette): - return not super(element_not_enabled, self).__call__(marionette) + return not super().__call__(marionette) def _find(marionette, func): diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -520,7 +520,7 @@ class FennecInstance(GeckoInstance): required_prefs = deepcopy(FennecInstance.fennec_prefs) required_prefs.update(kwargs.get("prefs", {})) - super(FennecInstance, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.required_prefs.update(required_prefs) self.runner_class = FennecEmulatorRunner @@ -602,7 +602,7 @@ class FennecInstance(GeckoInstance): :param clean: If True, also perform runner cleanup. """ - super(FennecInstance, self).close(clean) + super().close(clean) if clean and self.runner and self.runner.device.connected: try: self.runner.device.device.remove_forwards(f"tcp:{self.marionette_port}") @@ -701,13 +701,13 @@ class DesktopInstance(GeckoInstance): required_prefs = deepcopy(DesktopInstance.desktop_prefs) required_prefs.update(kwargs.get("prefs", {})) - super(DesktopInstance, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.required_prefs.update(required_prefs) class ThunderbirdInstance(GeckoInstance): def __init__(self, *args, **kwargs): - super(ThunderbirdInstance, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) try: # Copied alongside in the test archive from .thunderbirdinstance import thunderbird_prefs diff --git a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py @@ -29,7 +29,7 @@ class expectedFailure(Exception): """ def __init__(self, exc_info): - super(expectedFailure, self).__init__() + super().__init__() self.exc_info = exc_info @@ -84,7 +84,7 @@ class CommonTestCase(unittest.TestCase, metaclass=MetaParameterized): pydebugger = None def __init__(self, methodName, marionette_weakref, fixtures, **kwargs): - super(CommonTestCase, self).__init__(methodName) + super().__init__(methodName) self.methodName = methodName self._marionette_weakref = marionette_weakref @@ -297,7 +297,7 @@ class CommonTestCase(unittest.TestCase, metaclass=MetaParameterized): self.marionette.start_session() self.marionette.timeout.reset() - super(CommonTestCase, self).setUp() + super().setUp() def cleanTest(self): self._delete_session() @@ -338,7 +338,7 @@ class MarionetteTestCase(CommonTestCase): self.filepath = filepath self.testvars = kwargs.pop("testvars", None) - super(MarionetteTestCase, self).__init__( + super().__init__( methodName, marionette_weakref=marionette_weakref, fixtures=fixtures, @@ -389,7 +389,7 @@ class MarionetteTestCase(CommonTestCase): ) def setUp(self): - super(MarionetteTestCase, self).setUp() + super().setUp() self.marionette.test_name = self.test_name def tearDown(self): @@ -400,7 +400,7 @@ class MarionetteTestCase(CommonTestCase): self.marionette.test_name = None - super(MarionetteTestCase, self).tearDown() + super().tearDown() def wait_for_condition(self, method, timeout=30): timeout = float(timeout) + time.time() diff --git a/testing/marionette/harness/marionette_harness/runner/base.py b/testing/marionette/harness/marionette_harness/runner/base.py @@ -160,7 +160,7 @@ class MarionetteTestResult(StructuredTestResult, TestResultCollection): self.add_test_result( test, output=self._exc_info_to_string(err, test), result_actual="ERROR" ) - super(MarionetteTestResult, self).addError(test, err) + super().addError(test, err) def addFailure(self, test, err): self.add_test_result( @@ -168,28 +168,28 @@ class MarionetteTestResult(StructuredTestResult, TestResultCollection): output=self._exc_info_to_string(err, test), result_actual="UNEXPECTED-FAIL", ) - super(MarionetteTestResult, self).addFailure(test, err) + super().addFailure(test, err) def addSuccess(self, test): self.passed += 1 self.add_test_result(test, result_actual="PASS") - super(MarionetteTestResult, self).addSuccess(test) + super().addSuccess(test) def addExpectedFailure(self, test, err): """Called when an expected failure/error occured.""" self.add_test_result( test, output=self._exc_info_to_string(err, test), result_actual="KNOWN-FAIL" ) - super(MarionetteTestResult, self).addExpectedFailure(test, err) + super().addExpectedFailure(test, err) def addUnexpectedSuccess(self, test): """Called when a test was expected to fail, but succeed.""" self.add_test_result(test, result_actual="UNEXPECTED-PASS") - super(MarionetteTestResult, self).addUnexpectedSuccess(test) + super().addUnexpectedSuccess(test) def addSkip(self, test, reason): self.add_test_result(test, output=reason, result_actual="SKIPPED") - super(MarionetteTestResult, self).addSkip(test, reason) + super().addSkip(test, reason) def getInfo(self, test): return test.test_name @@ -250,7 +250,7 @@ class MarionetteTextTestRunner(StructuredTestRunner): ) def run(self, test): - result = super(MarionetteTextTestRunner, self).run(test) + result = super().run(test) result.printLogs(test) return result diff --git a/testing/mochitest/bisection.py b/testing/mochitest/bisection.py @@ -7,7 +7,7 @@ class Bisect: "Class for creating, bisecting and summarizing for --bisect-chunk option." def __init__(self, harness): - super(Bisect, self).__init__() + super().__init__() self.summary = [] self.contents = {} self.repeat = 10 diff --git a/testing/mochitest/runjunit.py b/testing/mochitest/runjunit.py @@ -479,7 +479,7 @@ class JunitArgumentParser(argparse.ArgumentParser): """ def __init__(self, **kwargs): - super(JunitArgumentParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.add_argument( "--appname", diff --git a/testing/mochitest/runtestsremote.py b/testing/mochitest/runtestsremote.py @@ -257,7 +257,7 @@ class MochiRemote(MochitestDesktop): return retVal def getChromeTestDir(self, options): - local = super(MochiRemote, self).getChromeTestDir(options) + local = super().getChromeTestDir(options) remote = self.remoteChromeTestDir if options.flavor == "chrome" and not self.chromePushed: self.log.info("pushing %s to %s on device..." % (local, remote)) diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py @@ -17,7 +17,7 @@ class IniParseError(Exception): else: path = getattr(fp, "path", "unknown") msg = f"Error parsing manifest file '{path}', line {linenum}: {msg}" - super(IniParseError, self).__init__(msg) + super().__init__(msg) def read_ini( diff --git a/testing/mozbase/mozinfo/mozinfo/string_version.py b/testing/mozbase/mozinfo/mozinfo/string_version.py @@ -14,7 +14,7 @@ class StringVersion(str): pat = re.compile(r"(\d+)|([^\d.]+)") def __init__(self, vstring): - super(StringVersion, self).__init__() + super().__init__() # We'll use unicode internally. # This check is mainly for python2 strings (which are bytes). diff --git a/testing/mozbase/mozlog/mozlog/formatters/grouping.py b/testing/mozbase/mozlog/mozlog/formatters/grouping.py @@ -18,7 +18,7 @@ class GroupingFormatter(base.BaseFormatter): together in a readable format.""" def __init__(self): - super(GroupingFormatter, self).__init__() + super().__init__() self.number_of_tests = 0 self.completed_tests = 0 self.need_to_erase_last_line = False diff --git a/testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py b/testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py @@ -58,7 +58,7 @@ class Tag(list): self.__dict__.update(kwargs) def __init__(self, *args, **kwargs): - super(Tag, self).__init__(args) + super().__init__(args) self.attr = self.Attr(**kwargs) def __unicode__(self): @@ -269,7 +269,7 @@ class HtmlVisitor(SimpleUnicodeVisitor): value = getattr(attrs, name) if value is None: return - return super(HtmlVisitor, self).repr_attribute(attrs, name) + return super().repr_attribute(attrs, name) def _issingleton(self, tagname): return tagname in self.single diff --git a/testing/mozbase/mozlog/mozlog/formatters/machformatter.py b/testing/mozbase/mozlog/mozlog/formatters/machformatter.py @@ -77,7 +77,7 @@ class MachFormatter(base.BaseFormatter): enable_screenshot=False, **kwargs, ): - super(MachFormatter, self).__init__(**kwargs) + super().__init__(**kwargs) if start_time is None: start_time = time.time() @@ -115,7 +115,7 @@ class MachFormatter(base.BaseFormatter): def __call__(self, data): self.summary(data) - s = super(MachFormatter, self).__call__(data) + s = super().__call__(data) if s is None: return diff --git a/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py b/testing/mozbase/mozlog/mozlog/formatters/tbplformatter.py @@ -29,7 +29,7 @@ class TbplFormatter(BaseFormatter): """ def __init__(self, compact=False, summary_on_shutdown=False, **kwargs): - super(TbplFormatter, self).__init__(**kwargs) + super().__init__(**kwargs) self.suite_start_time = None self.test_start_times = {} self.buffer = None @@ -42,7 +42,7 @@ class TbplFormatter(BaseFormatter): def __call__(self, data): if self.summary_on_shutdown: self.summary(data) - return super(TbplFormatter, self).__call__(data) + return super().__call__(data) @property def compact(self): diff --git a/testing/mozbase/mozlog/mozlog/handlers/resourcehandler.py b/testing/mozbase/mozlog/mozlog/handlers/resourcehandler.py @@ -11,7 +11,7 @@ class ResourceHandler(LogHandler): """Handler class for recording a resource usage profile.""" def __init__(self, command_context, **kwargs): - super(ResourceHandler, self).__init__(**kwargs) + super().__init__(**kwargs) from mozsystemmonitor.resourcemonitor import SystemResourceMonitor diff --git a/testing/mozbase/mozlog/mozlog/handlers/summaryhandler.py b/testing/mozbase/mozlog/mozlog/handlers/summaryhandler.py @@ -18,7 +18,7 @@ class SummaryHandler(LogHandler): """ def __init__(self, **kwargs): - super(SummaryHandler, self).__init__(**kwargs) + super().__init__(**kwargs) self.summary = OrderedDict() self.current_suite = None diff --git a/testing/mozbase/mozlog/mozlog/logtypes.py b/testing/mozbase/mozlog/mozlog/logtypes.py @@ -221,7 +221,7 @@ class SubStatus(Status): class Dict(ContainerType): def _format_item_type(self, item_type): - superfmt = super(Dict, self)._format_item_type + superfmt = super()._format_item_type if isinstance(item_type, dict): if len(item_type) != 1: @@ -276,7 +276,7 @@ class Boolean(DataType): class Tuple(ContainerType): def _format_item_type(self, item_type): - superfmt = super(Tuple, self)._format_item_type + superfmt = super()._format_item_type if isinstance(item_type, (tuple, list)): return [superfmt(t) for t in item_type] diff --git a/testing/mozbase/mozlog/tests/test_structured.py b/testing/mozbase/mozlog/tests/test_structured.py @@ -52,7 +52,7 @@ class BaseStructuredTest(unittest.TestCase): class TestStatusHandler(BaseStructuredTest): def setUp(self): - super(TestStatusHandler, self).setUp() + super().setUp() self.handler = handlers.StatusHandler() self.logger.add_handler(self.handler) @@ -109,7 +109,7 @@ class TestStatusHandler(BaseStructuredTest): class TestSummaryHandler(BaseStructuredTest): def setUp(self): - super(TestSummaryHandler, self).setUp() + super().setUp() self.handler = handlers.SummaryHandler() self.logger.add_handler(self.handler) diff --git a/testing/mozbase/mozprofile/mozprofile/profile.py b/testing/mozbase/mozprofile/mozprofile/profile.py @@ -199,7 +199,7 @@ class Profile(BaseProfile): :param allowlistpaths: List of paths to pass to Firefox to allow read access to from the content process sandbox. """ - super(Profile, self).__init__( + super().__init__( profile=profile, addons=addons, preferences=preferences, @@ -281,7 +281,7 @@ class Profile(BaseProfile): self.clean_preferences() if getattr(self, "addons", None) is not None: self.addons.clean() - super(Profile, self).cleanup() + super().cleanup() def clean_preferences(self): """Removed preferences added by mozrunner.""" @@ -517,7 +517,7 @@ class ChromiumProfile(BaseProfile): return False def __init__(self, **kwargs): - super(ChromiumProfile, self).__init__(**kwargs) + super().__init__(**kwargs) if self.create_new: self.profile = os.path.join(self.profile, "Default") diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py @@ -146,7 +146,7 @@ class MitmproxyDesktop(Mitmproxy): def stop(self): LOG.info("MitmproxyDesktop stop!!") - super(MitmproxyDesktop, self).stop() + super().stop() self.turn_off_browser_proxy() def turn_off_browser_proxy(self): diff --git a/testing/mozbase/mozrunner/mozrunner/base/browser.py b/testing/mozbase/mozrunner/mozrunner/base/browser.py @@ -96,7 +96,7 @@ class BlinkRuntimeRunner(BaseRunner): """A base runner class for running apps like Google Chrome or Chromium.""" def __init__(self, binary, cmdargs=None, **runner_args): - super(BlinkRuntimeRunner, self).__init__(**runner_args) + super().__init__(**runner_args) self.binary = binary self.cmdargs = cmdargs or [] diff --git a/testing/mozbase/mozrunner/mozrunner/base/device.py b/testing/mozbase/mozrunner/mozrunner/base/device.py @@ -189,5 +189,5 @@ class DeviceRunner(BaseRunner): class FennecRunner(DeviceRunner): def __init__(self, cmdargs=None, **kwargs): - super(FennecRunner, self).__init__(**kwargs) + super().__init__(**kwargs) self.cmdargs = cmdargs or [] diff --git a/testing/mozbase/mozrunner/mozrunner/devices/emulator.py b/testing/mozbase/mozrunner/mozrunner/devices/emulator.py @@ -90,7 +90,7 @@ class BaseEmulator(Device): binary=kwargs.pop("binary", None), avd=kwargs.pop("avd", None), ) - super(BaseEmulator, self).__init__(app_ctx, **kwargs) + super().__init__(app_ctx, **kwargs) self.tmpdir = tempfile.mkdtemp() # These rely on telnet self.battery = EmulatorBattery(self) @@ -161,14 +161,14 @@ class BaseEmulator(Device): if self.connected: return - super(BaseEmulator, self).connect() + super().connect() self.port = int(self.serial[self.serial.rindex("-") + 1 :]) def cleanup(self): """ Cleans up and kills the emulator, if it was started by mozrunner. """ - super(BaseEmulator, self).cleanup() + super().cleanup() if self.proc: self.proc.kill() self.proc = None @@ -205,7 +205,7 @@ class BaseEmulator(Device): class EmulatorAVD(BaseEmulator): def __init__(self, app_ctx, binary, avd, port=5554, **kwargs): - super(EmulatorAVD, self).__init__(app_ctx, binary=binary, avd=avd, **kwargs) + super().__init__(app_ctx, binary=binary, avd=avd, **kwargs) self.port = port @property @@ -213,7 +213,7 @@ class EmulatorAVD(BaseEmulator): """ Arguments to pass into the emulator binary. """ - qemu_args = super(EmulatorAVD, self).args + qemu_args = super().args qemu_args.extend(["-avd", self.arch.avd, "-port", str(self.port)]) qemu_args.extend(self.arch.extra_args) return qemu_args @@ -225,4 +225,4 @@ class EmulatorAVD(BaseEmulator): env = os.environ env["ANDROID_AVD_HOME"] = self.app_ctx.avd_home - super(EmulatorAVD, self).start() + super().start() diff --git a/testing/mozbase/moztest/moztest/resolve.py b/testing/mozbase/moztest/moztest/resolve.py @@ -605,7 +605,7 @@ class BuildBackendLoader(TestLoader): class TestManifestLoader(TestLoader): def __init__(self, *args, **kwargs): - super(TestManifestLoader, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.finder = FileFinder(self.topsrcdir) self.reader = self.mozbuild_reader(config_mode="empty") self.variables = {f"{k}_MANIFESTS": v[0] for k, v in TEST_MANIFESTS.items()} @@ -670,7 +670,7 @@ class TestResolver(MozbuildObject): def __init__(self, *args, **kwargs): loader_cls = kwargs.pop("loader_cls", BuildBackendLoader) - super(TestResolver, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.load_tests = self._spawn(loader_cls) self._tests = [] diff --git a/testing/mozharness/mozharness/base/python.py b/testing/mozharness/mozharness/base/python.py @@ -141,7 +141,7 @@ class VirtualenvMixin: def __init__(self, *args, **kwargs): self._virtualenv_modules = [] - super(VirtualenvMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def register_virtualenv_module( self, @@ -816,7 +816,7 @@ class ResourceMonitoringMixin(PerfherderResourceOptionsMixin): """ def __init__(self, *args, **kwargs): - super(ResourceMonitoringMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.register_virtualenv_module("psutil>=5.9.0", method="pip", optional=True) self.register_virtualenv_module("jsonschema==2.5.1", method="pip") diff --git a/testing/mozharness/mozharness/base/script.py b/testing/mozharness/mozharness/base/script.py @@ -2092,7 +2092,7 @@ class BaseScript(ScriptMixin, LogMixin): **kwargs, ): self._return_code = 0 - super(BaseScript, self).__init__() + super().__init__() self.log_obj = None self.abs_dirs = None diff --git a/testing/mozharness/mozharness/base/vcs/gittool.py b/testing/mozharness/mozharness/base/vcs/gittool.py @@ -28,12 +28,12 @@ class GittoolParser(OutputParser): m = self.got_revision_exp.match(line) if m: self.got_revision = m.group(1) - super(GittoolParser, self).parse_single_line(line) + super().parse_single_line(line) class GittoolVCS(ScriptMixin, LogMixin): def __init__(self, log_obj=None, config=None, vcs_config=None, script_obj=None): - super(GittoolVCS, self).__init__() + super().__init__() self.log_obj = log_obj self.script_obj = script_obj diff --git a/testing/mozharness/mozharness/base/vcs/mercurial.py b/testing/mozharness/mozharness/base/vcs/mercurial.py @@ -52,7 +52,7 @@ class RepositoryUpdateRevisionParser(OutputParser): if m: self.revision = m.group(1) - return super(RepositoryUpdateRevisionParser, self).parse_single_line(line) + return super().parse_single_line(line) def make_hg_url(hg_host, repo_path, protocol="http", revision=None, filename=None): @@ -80,7 +80,7 @@ class MercurialVCS(ScriptMixin, LogMixin, TransferMixin): # get_branches, cleanOutgoingRevs def __init__(self, log_obj=None, config=None, vcs_config=None, script_obj=None): - super(MercurialVCS, self).__init__() + super().__init__() self.can_share = None self.log_obj = log_obj self.script_obj = script_obj diff --git a/testing/mozharness/mozharness/base/vcs/vcsbase.py b/testing/mozharness/mozharness/base/vcs/vcsbase.py @@ -117,7 +117,7 @@ class VCSMixin: class VCSScript(VCSMixin, BaseScript): def __init__(self, **kwargs): - super(VCSScript, self).__init__(**kwargs) + super().__init__(**kwargs) def pull(self, repos=None, parent_dir=None): repos = repos or self.config.get("repos") diff --git a/testing/mozharness/mozharness/mozilla/building/buildbase.py b/testing/mozharness/mozharness/mozilla/building/buildbase.py @@ -73,7 +73,7 @@ class MakeUploadOutputParser(OutputParser): tbpl_error_list = TBPL_UPLOAD_ERRORS def __init__(self, **kwargs): - super(MakeUploadOutputParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.tbpl_status = TBPL_SUCCESS def parse_single_line(self, line): @@ -219,9 +219,7 @@ class BuildingConfig(BaseConfig): # now let's update config with the remaining config files. # this functionality is the same as the base class - all_config_dicts.extend( - super(BuildingConfig, self).get_cfgs_from_files(all_config_files, options) - ) + all_config_dicts.extend(super().get_cfgs_from_files(all_config_files, options)) # stack variant cfg file on top of that, if it is present if variant_cfg_file: @@ -516,7 +514,7 @@ class BuildScript( # objdir is referenced in _query_abs_dirs() so let's make sure we # have that attribute before calling BaseScript.__init__ self.objdir = None - super(BuildScript, self).__init__(**kwargs) + super().__init__(**kwargs) # epoch is only here to represent the start of the build # that this mozharn script came from. until I can grab bbot's # status.build.gettime()[0] this will have to do as a rough estimate @@ -603,7 +601,7 @@ items from that key's value." # let's evoke the base query_env and make a copy of it # as we don't always want every key below added to the same dict - env = copy.deepcopy(super(BuildScript, self).query_env(**kwargs)) + env = copy.deepcopy(super().query_env(**kwargs)) if self.query_is_nightly() or self.query_is_nightly_promotion(): # taskcluster sets the update channel for shipping builds diff --git a/testing/mozharness/mozharness/mozilla/l10n/locales.py b/testing/mozharness/mozharness/mozilla/l10n/locales.py @@ -112,7 +112,7 @@ class LocalesMixin: def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(LocalesMixin, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() c = self.config dirs = {} dirs["abs_work_dir"] = os.path.join(c["base_work_dir"], c["work_dir"]) diff --git a/testing/mozharness/mozharness/mozilla/mozbase.py b/testing/mozharness/mozharness/mozilla/mozbase.py @@ -13,7 +13,7 @@ class MozbaseMixin: """ def __init__(self, *args, **kwargs): - super(MozbaseMixin, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @PreScriptAction("create-virtualenv") def _install_mozbase(self, action): diff --git a/testing/mozharness/mozharness/mozilla/structuredlog.py b/testing/mozharness/mozharness/mozilla/structuredlog.py @@ -36,7 +36,7 @@ class StructuredOutputParser(OutputParser): self.suite_category = kwargs.pop("suite_category", None) tbpl_compact = kwargs.pop("log_compact", False) - super(StructuredOutputParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.allow_crashes = kwargs.pop("allow_crashes", False) mozlog = self._get_mozlog_module() @@ -61,7 +61,7 @@ class StructuredOutputParser(OutputParser): def _handle_unstructured_output(self, line, log_output=True): self.log_output = log_output - return super(StructuredOutputParser, self).parse_single_line(line) + return super().parse_single_line(line) def parse_single_line(self, line): """Parses a line of log output from the child process and passes diff --git a/testing/mozharness/mozharness/mozilla/testing/android.py b/testing/mozharness/mozharness/mozilla/testing/android.py @@ -51,7 +51,7 @@ class AndroidMixin: self.use_gles3 = False self.use_root = True self.xre_path = None - super(AndroidMixin, self).__init__(**kwargs) + super().__init__(**kwargs) @property def adb_path(self): diff --git a/testing/mozharness/mozharness/mozilla/testing/codecoverage.py b/testing/mozharness/mozharness/mozilla/testing/codecoverage.py @@ -79,7 +79,7 @@ class CodeCoverageMixin(SingleTestMixin): else: raise Exception(f"Unexpected OS: {mozinfo.os}") - super(CodeCoverageMixin, self).__init__(**kwargs) + super().__init__(**kwargs) @property def code_coverage_enabled(self): diff --git a/testing/mozharness/mozharness/mozilla/testing/per_test_base.py b/testing/mozharness/mozharness/mozilla/testing/per_test_base.py @@ -17,7 +17,7 @@ class SingleTestMixin: """Utility functions for per-test testing like test verification and per-test coverage.""" def __init__(self, **kwargs): - super(SingleTestMixin, self).__init__(**kwargs) + super().__init__(**kwargs) self.suites = {} self.tests_downloaded = False diff --git a/testing/mozharness/mozharness/mozilla/testing/raptor.py b/testing/mozharness/mozharness/mozilla/testing/raptor.py @@ -667,7 +667,7 @@ class Raptor( ], ) kwargs.setdefault("config", {}) - super(Raptor, self).__init__(**kwargs) + super().__init__(**kwargs) # Convenience self.workdir = self.query_abs_dirs()["abs_work_dir"] @@ -796,7 +796,7 @@ class Raptor( def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(Raptor, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() abs_dirs["abs_blob_upload_dir"] = os.path.join( abs_dirs["abs_work_dir"], "blobber_upload_dir" ) @@ -1147,7 +1147,7 @@ class Raptor( def clobber(self): # Recreate the upload directory for storing the logcat collected # during APK installation. - super(Raptor, self).clobber() + super().clobber() upload_dir = self.query_abs_dirs()["abs_blob_upload_dir"] if not os.path.isdir(upload_dir): self.mkdir_p(upload_dir) @@ -1158,7 +1158,7 @@ class Raptor( # the logcat file will be left in the upload directory. self.logcat_start() try: - super(Raptor, self).install_android_app(apk, replace=replace) + super().install_android_app(apk, replace=replace) finally: self.logcat_stop() @@ -1170,7 +1170,7 @@ class Raptor( "tools/wpt_third_party/h2/*", "tools/wpt_third_party/pywebsocket3/*", ] - return super(Raptor, self).download_and_extract( + return super().download_and_extract( extract_dirs=extract_dirs, suite_categories=["common", "condprof", "raptor"] ) @@ -1273,7 +1273,7 @@ class Raptor( self.setup_local_ffmpeg() # Require pip >= 1.5 so pip will prefer .whl files to install - super(Raptor, self).create_virtualenv(modules=modules) + super().create_virtualenv(modules=modules) # Install Raptor dependencies self.install_module(requirements=[raptor_requirements]) @@ -1337,7 +1337,7 @@ class Raptor( else: self.install_android_app(str(installer_path)) else: - super(Raptor, self).install() + super().install() def _artifact_perf_data(self, src, dest): if not os.path.isdir(os.path.dirname(dest)): @@ -1522,7 +1522,7 @@ class RaptorOutputParser(OutputParser): RE_PERF_DATA = re.compile(r".*PERFHERDER_DATA:\s+(\{.*\})") def __init__(self, **kwargs): - super(RaptorOutputParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.minidump_output = None self.found_perf_data = [] self.tbpl_status = TBPL_SUCCESS @@ -1557,4 +1557,4 @@ class RaptorOutputParser(OutputParser): return else: SystemResourceMonitor.record_event(raptor_line) - super(RaptorOutputParser, self).parse_single_line(line) + super().parse_single_line(line) diff --git a/testing/mozharness/mozharness/mozilla/testing/talos.py b/testing/mozharness/mozharness/mozilla/testing/talos.py @@ -79,7 +79,7 @@ class TalosOutputParser(OutputParser): worst_tbpl_status = TBPL_SUCCESS def __init__(self, **kwargs): - super(TalosOutputParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.minidump_output = None self.found_perf_data = [] @@ -122,7 +122,7 @@ class TalosOutputParser(OutputParser): elif line.startswith("Running cycle ") or line.startswith("PROCESS-CRASH "): SystemResourceMonitor.record_event(line) - super(TalosOutputParser, self).parse_single_line(line) + super().parse_single_line(line) class Talos( @@ -321,7 +321,7 @@ class Talos( ], ) kwargs.setdefault("config", {}) - super(Talos, self).__init__(**kwargs) + super().__init__(**kwargs) self.workdir = self.query_abs_dirs()["abs_work_dir"] # convenience @@ -374,7 +374,7 @@ class Talos( def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(Talos, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() abs_dirs["abs_blob_upload_dir"] = os.path.join( abs_dirs["abs_work_dir"], "blobber_upload_dir" ) @@ -754,7 +754,7 @@ class Talos( "tools/wpt_third_party/h2/*", "tools/wpt_third_party/pywebsocket3/*", ] - return super(Talos, self).download_and_extract( + return super().download_and_extract( extract_dirs=extract_dirs, suite_categories=["common", "talos"] ) @@ -809,7 +809,7 @@ class Talos( requirements=[mozbase_requirements], editable=True, ) - super(Talos, self).create_virtualenv() + super().create_virtualenv() # talos in harness requires what else is # listed in talos requirements.txt file. self.install_module(requirements=[talos_requirements]) diff --git a/testing/mozharness/mozharness/mozilla/testing/testbase.py b/testing/mozharness/mozharness/mozilla/testing/testbase.py @@ -768,7 +768,7 @@ Did you run with --create-virtualenv? Is mozinstall in virtualenv_modules?""" self._run_cmd_checks(c.get("postflight_run_cmd_suites", [])) def query_abs_dirs(self): - abs_dirs = super(TestingMixin, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() if "MOZ_FETCHES_DIR" in os.environ: abs_dirs["abs_fetches_dir"] = os.environ["MOZ_FETCHES_DIR"] return abs_dirs diff --git a/testing/mozharness/mozharness/mozilla/testing/unittest.py b/testing/mozharness/mozharness/mozilla/testing/unittest.py @@ -63,10 +63,10 @@ class TestSummaryOutputParserHelper(OutputParser): self.last_line = None self.tbpl_status = TBPL_SUCCESS self.worst_log_level = INFO - super(TestSummaryOutputParserHelper, self).__init__(**kwargs) + super().__init__(**kwargs) def parse_single_line(self, line): - super(TestSummaryOutputParserHelper, self).parse_single_line(line) + super().parse_single_line(line) self.last_line = line m = self.regex.search(line) if m: @@ -118,7 +118,7 @@ class DesktopUnittestOutputParser(OutputParser): # worst_log_level defined already in DesktopUnittestOutputParser # but is here to make pylint happy self.worst_log_level = INFO - super(DesktopUnittestOutputParser, self).__init__(**kwargs) + super().__init__(**kwargs) self.summary_suite_re = TinderBoxPrintRe.get("%s_summary" % suite_category, {}) self.harness_error_re = TinderBoxPrintRe["harness_error"]["minimum_regex"] self.full_harness_error_re = TinderBoxPrintRe["harness_error"]["full_regex"] @@ -198,7 +198,7 @@ class DesktopUnittestOutputParser(OutputParser): SystemResourceMonitor.end_marker("test", part[1]) else: SystemResourceMonitor.record_event(line) - super(DesktopUnittestOutputParser, self).parse_single_line(line) + super().parse_single_line(line) def evaluate_parser(self, return_code, success_codes=None, previous_summary=None): success_codes = success_codes or [0] diff --git a/testing/mozharness/mozharness/mozilla/testing/verify_tools.py b/testing/mozharness/mozharness/mozilla/testing/verify_tools.py @@ -23,7 +23,7 @@ class VerifyToolsMixin(SingleTestMixin): """Utility functions for test verification.""" def __init__(self): - super(VerifyToolsMixin, self).__init__() + super().__init__() @property def verify_enabled(self): diff --git a/testing/mozharness/scripts/android_emulator_pgo.py b/testing/mozharness/scripts/android_emulator_pgo.py @@ -67,7 +67,7 @@ class AndroidProfileRun(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin): config_options = copy.deepcopy(testing_config_options) def __init__(self, require_config_file=False): - super(AndroidProfileRun, self).__init__( + super().__init__( config_options=self.config_options, all_actions=[ "download", @@ -94,7 +94,7 @@ class AndroidProfileRun(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin): def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(AndroidProfileRun, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = {} dirs["abs_test_install_dir"] = os.path.join(abs_dirs["abs_src_dir"], "testing") diff --git a/testing/mozharness/scripts/android_emulator_unittest.py b/testing/mozharness/scripts/android_emulator_unittest.py @@ -184,7 +184,7 @@ class AndroidEmulatorTest( ) def __init__(self, require_config_file=False): - super(AndroidEmulatorTest, self).__init__( + super().__init__( config_options=self.config_options, all_actions=[ "clobber", @@ -232,7 +232,7 @@ class AndroidEmulatorTest( def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(AndroidEmulatorTest, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = {} dirs["abs_test_install_dir"] = os.path.join(abs_dirs["abs_work_dir"], "tests") dirs["abs_test_bin_dir"] = os.path.join( @@ -494,9 +494,7 @@ class AndroidEmulatorTest( """ Download and extract product APK, tests.zip, and host utils. """ - super(AndroidEmulatorTest, self).download_and_extract( - suite_categories=self._query_suite_categories() - ) + super().download_and_extract(suite_categories=self._query_suite_categories()) dirs = self.query_abs_dirs() self.xre_path = dirs["abs_xre_dir"] diff --git a/testing/mozharness/scripts/android_hardware_unittest.py b/testing/mozharness/scripts/android_hardware_unittest.py @@ -138,7 +138,7 @@ class AndroidHardwareTest( ] + copy.deepcopy(testing_config_options) def __init__(self, require_config_file=False): - super(AndroidHardwareTest, self).__init__( + super().__init__( config_options=self.config_options, all_actions=[ "clobber", @@ -181,7 +181,7 @@ class AndroidHardwareTest( def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(AndroidHardwareTest, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = {} dirs["abs_test_install_dir"] = os.path.join(abs_dirs["abs_work_dir"], "tests") dirs["abs_test_bin_dir"] = os.path.join( @@ -417,9 +417,7 @@ class AndroidHardwareTest( """ Download and extract product APK, tests.zip, and host utils. """ - super(AndroidHardwareTest, self).download_and_extract( - suite_categories=self._query_suite_categories() - ) + super().download_and_extract(suite_categories=self._query_suite_categories()) dirs = self.query_abs_dirs() self.xre_path = dirs["abs_xre_dir"] diff --git a/testing/mozharness/scripts/android_wrench.py b/testing/mozharness/scripts/android_wrench.py @@ -41,7 +41,7 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin): # the wrench source code. self.wrench_dir = "/data/data/org.mozilla.wrench/files/wrench" - super(AndroidWrench, self).__init__() + super().__init__() # Override AndroidMixin's use_root to ensure we use run-as instead of # root to push and pull files from the device, as the latter fails due @@ -82,7 +82,7 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin): abs_dirs["abs_work_dir"] = os.path.expanduser("~/.wrench") if os.environ.get("MOZ_AUTOMATION", "0") == "1": # In automation use the standard work dir if there is one - parent_abs_dirs = super(AndroidWrench, self).query_abs_dirs() + parent_abs_dirs = super().query_abs_dirs() if "abs_work_dir" in parent_abs_dirs: abs_dirs["abs_work_dir"] = parent_abs_dirs["abs_work_dir"] @@ -129,7 +129,7 @@ class AndroidWrench(TestingMixin, BaseScript, MozbaseMixin, AndroidMixin): logcat_cmd = [self.adb_path, "-s", self.device_serial, "logcat", "-c"] self.info(" ".join(logcat_cmd)) subprocess.check_call(logcat_cmd) - super(AndroidWrench, self).logcat_start() + super().logcat_start() def wait_until_process_done(self, process_name, timeout): """Waits until the specified process has exited. Polls the process list diff --git a/testing/mozharness/scripts/awsy_script.py b/testing/mozharness/scripts/awsy_script.py @@ -115,7 +115,7 @@ class AWSY(TestingMixin, MercurialScript, TooltoolMixin, CodeCoverageMixin): ], ) kwargs.setdefault("config", {}) - super(AWSY, self).__init__(**kwargs) + super().__init__(**kwargs) self.installer_url = self.config.get("installer_url") self.tests = None @@ -129,7 +129,7 @@ class AWSY(TestingMixin, MercurialScript, TooltoolMixin, CodeCoverageMixin): def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(AWSY, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = {} dirs["abs_blob_upload_dir"] = os.path.join( @@ -141,9 +141,7 @@ class AWSY(TestingMixin, MercurialScript, TooltoolMixin, CodeCoverageMixin): return self.abs_dirs def download_and_extract(self, extract_dirs=None, suite_categories=None): - ret = super(AWSY, self).download_and_extract( - suite_categories=["common", "awsy"] - ) + ret = super().download_and_extract(suite_categories=["common", "awsy"]) return ret @PreScriptAction("create-virtualenv") diff --git a/testing/mozharness/scripts/desktop_partner_repacks.py b/testing/mozharness/scripts/desktop_partner_repacks.py @@ -119,7 +119,7 @@ class DesktopPartnerRepacks(AutomationMixin, BaseScript, VirtualenvMixin, Secret def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(DesktopPartnerRepacks, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() for directory in abs_dirs: value = abs_dirs[directory] abs_dirs[directory] = value diff --git a/testing/mozharness/scripts/desktop_unittest.py b/testing/mozharness/scripts/desktop_unittest.py @@ -413,7 +413,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM def __init__(self, require_config_file=True): # abs_dirs defined already in BaseScript but is here to make pylint happy self.abs_dirs = None - super(DesktopUnittest, self).__init__( + super().__init__( config_options=self.config_options, all_actions=[ "clobber", @@ -475,7 +475,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM # helper methods {{{2 def _pre_config_lock(self, rw_config): - super(DesktopUnittest, self)._pre_config_lock(rw_config) + super()._pre_config_lock(rw_config) c = self.config if not c.get("run_all_suites"): return # configs are valid @@ -493,7 +493,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(DesktopUnittest, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() c = self.config dirs = {} @@ -1036,7 +1036,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, MozbaseMixin, CodeCoverageM for cat in SUITE_CATEGORIES if self._query_specified_suites(cat) is not None ] - super(DesktopUnittest, self).download_and_extract( + super().download_and_extract( extract_dirs=extract_dirs, suite_categories=target_categories ) diff --git a/testing/mozharness/scripts/does_it_crash.py b/testing/mozharness/scripts/does_it_crash.py @@ -72,7 +72,7 @@ class DoesItCrash(BaseScript): ] def __init__(self): - super(DoesItCrash, self).__init__( + super().__init__( all_actions=[ "download", "run-thing", diff --git a/testing/mozharness/scripts/firefox_ui_tests.py b/testing/mozharness/scripts/firefox_ui_tests.py @@ -101,7 +101,7 @@ class FirefoxUIFunctionalTests(TestingMixin, VCSToolsScript, CodeCoverageMixin): "uninstall", ] - super(FirefoxUIFunctionalTests, self).__init__( + super().__init__( config_options=config_options, all_actions=all_actions or actions, default_actions=default_actions or actions, @@ -141,15 +141,13 @@ class FirefoxUIFunctionalTests(TestingMixin, VCSToolsScript, CodeCoverageMixin): "mozpack/*", "mozbuild/*", ] - super(FirefoxUIFunctionalTests, self).download_and_extract( - extract_dirs=extract_dirs - ) + super().download_and_extract(extract_dirs=extract_dirs) def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(FirefoxUIFunctionalTests, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() abs_tests_install_dir = os.path.join(abs_dirs["abs_work_dir"], "tests") dirs = { diff --git a/testing/mozharness/scripts/fx_desktop_build.py b/testing/mozharness/scripts/fx_desktop_build.py @@ -58,12 +58,12 @@ class FxDesktopBuild(BuildScript): }, "ConfigClass": BuildingConfig, } - super(FxDesktopBuild, self).__init__(**buildscript_kwargs) + super().__init__(**buildscript_kwargs) def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(FxDesktopBuild, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = { # BuildFactories in factory.py refer to a 'build' dir on the slave. diff --git a/testing/mozharness/scripts/marionette.py b/testing/mozharness/scripts/marionette.py @@ -175,7 +175,7 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM repos = [] def __init__(self, require_config_file=False): - super(MarionetteTest, self).__init__( + super().__init__( config_options=self.config_options, all_actions=[ "clobber", @@ -216,7 +216,7 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM self.parser_class = TestSummaryOutputParserHelper def _pre_config_lock(self, rw_config): - super(MarionetteTest, self)._pre_config_lock(rw_config) + super()._pre_config_lock(rw_config) if not self.config.get("emulator") and not self.config.get( "marionette_address" ): @@ -234,7 +234,7 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(MarionetteTest, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = {} dirs["abs_test_install_dir"] = os.path.join(abs_dirs["abs_work_dir"], "tests") dirs["abs_marionette_dir"] = os.path.join( @@ -286,7 +286,7 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM return f"{testsuite}_{platform}" def download_and_extract(self): - super(MarionetteTest, self).download_and_extract() + super().download_and_extract() if self.config.get("emulator"): dirs = self.query_abs_dirs() @@ -305,7 +305,7 @@ class MarionetteTest(TestingMixin, MercurialScript, TransferMixin, CodeCoverageM if self.config.get("emulator"): self.info("Emulator tests; skipping.") else: - super(MarionetteTest, self).install() + super().install() def run_tests(self): """ diff --git a/testing/mozharness/scripts/openh264_build.py b/testing/mozharness/scripts/openh264_build.py @@ -116,7 +116,7 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin): def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - dirs = super(OpenH264Build, self).query_abs_dirs() + dirs = super().query_abs_dirs() dirs["abs_upload_dir"] = os.path.join(dirs["abs_work_dir"], "upload") self.abs_dirs = dirs return self.abs_dirs diff --git a/testing/mozharness/scripts/release/bouncer_check.py b/testing/mozharness/scripts/release/bouncer_check.py @@ -79,7 +79,7 @@ class BouncerCheck(BaseScript): ] def __init__(self, require_config_file=True): - super(BouncerCheck, self).__init__( + super().__init__( config_options=self.config_options, require_config_file=require_config_file, config={ @@ -99,7 +99,7 @@ class BouncerCheck(BaseScript): ) def _pre_config_lock(self, rw_config): - super(BouncerCheck, self)._pre_config_lock(rw_config) + super()._pre_config_lock(rw_config) if "product_field" not in self.config: return diff --git a/testing/mozharness/scripts/release/generate-checksums.py b/testing/mozharness/scripts/release/generate-checksums.py @@ -95,7 +95,7 @@ class ChecksumsGenerator(BaseScript, VirtualenvMixin): self.file_prefix = self._get_file_prefix() def _pre_config_lock(self, rw_config): - super(ChecksumsGenerator, self)._pre_config_lock(rw_config) + super()._pre_config_lock(rw_config) # These defaults are set here rather in the config because default # lists cannot be completely overidden, only appended to. diff --git a/testing/mozharness/scripts/release/update-verify-config-creator.py b/testing/mozharness/scripts/release/update-verify-config-creator.py @@ -339,7 +339,7 @@ class UpdateVerifyConfigCreator(BaseScript): self.log("Closed HG client.") def _pre_config_lock(self, rw_config): - super(UpdateVerifyConfigCreator, self)._pre_config_lock(rw_config) + super()._pre_config_lock(rw_config) if "updater_platform" not in self.config: self.config["updater_platform"] = self.config["platform"] diff --git a/testing/mozharness/scripts/repackage.py b/testing/mozharness/scripts/repackage.py @@ -40,7 +40,7 @@ class Repackage(BaseScript): def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(Repackage, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() config = self.config dirs = {} diff --git a/testing/mozharness/scripts/telemetry/telemetry_client.py b/testing/mozharness/scripts/telemetry/telemetry_client.py @@ -108,7 +108,7 @@ class TelemetryTests(TestingMixin, VCSToolsScript, CodeCoverageMixin): "uninstall", ] - super(TelemetryTests, self).__init__( + super().__init__( config_options=config_options, all_actions=all_actions or actions, default_actions=default_actions or actions, @@ -142,7 +142,7 @@ class TelemetryTests(TestingMixin, VCSToolsScript, CodeCoverageMixin): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(TelemetryTests, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() abs_test_install_dir = os.path.join(abs_dirs["abs_work_dir"], "tests") diff --git a/testing/mozharness/scripts/web_platform_tests.py b/testing/mozharness/scripts/web_platform_tests.py @@ -236,7 +236,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM ) def __init__(self, require_config_file=True): - super(WebPlatformTest, self).__init__( + super().__init__( config_options=self.config_options, all_actions=[ "clobber", @@ -280,7 +280,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM def query_abs_dirs(self): if self.abs_dirs: return self.abs_dirs - abs_dirs = super(WebPlatformTest, self).query_abs_dirs() + abs_dirs = super().query_abs_dirs() dirs = {} dirs["abs_app_install_dir"] = os.path.join( @@ -553,7 +553,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM return cmd def download_and_extract(self): - super(WebPlatformTest, self).download_and_extract( + super().download_and_extract( extract_dirs=[ "mach", "bin/*", @@ -623,7 +623,7 @@ class WebPlatformTest(TestingMixin, MercurialScript, CodeCoverageMixin, AndroidM if self.is_android: self.install_android_app(self.installer_path) else: - super(WebPlatformTest, self).install() + super().install() def _install_fonts(self): if self.is_android: diff --git a/testing/mozharness/test/test_base_script.py b/testing/mozharness/test/test_base_script.py @@ -34,7 +34,7 @@ baz""" class CleanupObj(script.ScriptMixin, log.LogMixin): def __init__(self): - super(CleanupObj, self).__init__() + super().__init__() self.log_obj = None self.config = {"log_level": ERROR} @@ -796,7 +796,7 @@ class BaseScriptWithDecorators(script.BaseScript): option_args.extend(["--base-work-dir", self._tmpdir]) kwargs["option_args"] = option_args - super(BaseScriptWithDecorators, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.pre_run_1_args = [] self.raise_during_pre_run_1 = False diff --git a/testing/mozharness/test/test_l10n_locales.py b/testing/mozharness/test/test_l10n_locales.py @@ -23,7 +23,7 @@ class LocalesTest(locales.LocalesMixin, script.BaseScript): kwargs["config"] = {"log_type": "simple", "log_level": "error"} if "initial_config_file" not in kwargs: kwargs["initial_config_file"] = "test/test.json" - super(LocalesTest, self).__init__(**kwargs) + super().__init__(**kwargs) self.config = {} self.log_obj = None diff --git a/testing/mozharness/test/test_mozilla_structured.py b/testing/mozharness/test/test_mozilla_structured.py @@ -26,7 +26,7 @@ failure_summary = RunSummary( class TestParser(MozbaseMixin, StructuredOutputParser): def __init__(self, *args, **kwargs): - super(TestParser, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.config = {} diff --git a/testing/raptor/raptor/benchmark.py b/testing/raptor/raptor/benchmark.py @@ -81,7 +81,7 @@ class Benchmark: def log_message(self, *args): if CustomHandler.verbose: - super(CustomHandler, self).log_message(*args) + super().log_message(*args) def end_headers(self): self.send_header("Access-Control-Allow-Origin", "*") diff --git a/testing/raptor/raptor/browsertime/android.py b/testing/raptor/raptor/browsertime/android.py @@ -41,7 +41,7 @@ class BrowsertimeAndroid(PerftestAndroid, Browsertime): """ def __init__(self, app, binary, activity=None, intent=None, **kwargs): - super(BrowsertimeAndroid, self).__init__( + super().__init__( app, binary, **kwargs, @@ -202,7 +202,7 @@ class BrowsertimeAndroid(PerftestAndroid, Browsertime): return args_list def build_browser_profile(self): - super(BrowsertimeAndroid, self).build_browser_profile() + super().build_browser_profile() if self.config["app"] in FIREFOX_ANDROID_APPS: # Merge in the Android profile. @@ -232,7 +232,7 @@ class BrowsertimeAndroid(PerftestAndroid, Browsertime): self.device.rm(self.geckodriver_profile, force=True, recursive=True) def run_test_setup(self, test): - super(BrowsertimeAndroid, self).run_test_setup(test) + super().run_test_setup(test) self.set_reverse_ports() @@ -248,10 +248,10 @@ class BrowsertimeAndroid(PerftestAndroid, Browsertime): # Make sure that chrome is enabled on the device self.device.shell_output("pm enable com.android.chrome") - return super(BrowsertimeAndroid, self).run_tests(tests, test_names) + return super().run_tests(tests, test_names) def run_test_teardown(self, test): LOG.info("removing reverse socket connections") self.device.remove_socket_connections("reverse") - super(BrowsertimeAndroid, self).run_test_teardown(test) + super().run_test_teardown(test) diff --git a/testing/raptor/raptor/browsertime/base.py b/testing/raptor/raptor/browsertime/base.py @@ -63,7 +63,7 @@ class Browsertime(Perftest, metaclass=ABCMeta): # use the chrome-m profile class for both chrome-m and CaR-m profile_class = "chrome-m" - super(Browsertime, self).__init__( + super().__init__( app, binary, profile_class=profile_class, @@ -101,7 +101,7 @@ class Browsertime(Perftest, metaclass=ABCMeta): return self._crash_directory def build_browser_profile(self): - super(Browsertime, self).build_browser_profile() + super().build_browser_profile() if self.profile is not None: self.remove_mozprofile_delimiters_from_profile() @@ -157,7 +157,7 @@ class Browsertime(Perftest, metaclass=ABCMeta): if test.get("preferences", ""): test["preferences"] = self._convert_prefs_to_dict(test["preferences"]) - super(Browsertime, self).run_test_setup(test) + super().run_test_setup(test) if test.get("type") == "benchmark" or test.get("benchmark_webserver", False): # benchmark-type tests require the benchmark test to be served out @@ -253,7 +253,7 @@ class Browsertime(Perftest, metaclass=ABCMeta): LOG.info(f"test: {test}") def run_test_teardown(self, test): - super(Browsertime, self).run_test_teardown(test) + super().run_test_teardown(test) # If we were using a playback tool, stop it if self.playback is not None: @@ -269,13 +269,13 @@ class Browsertime(Perftest, metaclass=ABCMeta): test.get("support_class").clean_up() def check_for_crashes(self): - super(Browsertime, self).check_for_crashes() + super().check_for_crashes() self.crashes += mozcrash.log_crashes( LOG, self.crash_directory, self.config["symbols_path"] ) def clean_up(self): - super(Browsertime, self).clean_up() + super().clean_up() def _expose_browser_profiler(self, extra_profiler_run, test): """Use this method to check if we will use an exposed gecko profiler via browsertime. diff --git a/testing/raptor/raptor/browsertime/desktop.py b/testing/raptor/raptor/browsertime/desktop.py @@ -14,7 +14,7 @@ LOG = RaptorLogger(component="raptor-browsertime-desktop") class BrowsertimeDesktop(PerftestDesktop, Browsertime): def __init__(self, *args, **kwargs): - super(BrowsertimeDesktop, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) @property def browsertime_args(self): diff --git a/testing/raptor/raptor/cmdline.py b/testing/raptor/raptor/cmdline.py @@ -653,7 +653,7 @@ class _StopAction(argparse.Action): default=argparse.SUPPRESS, help=None, ): - super(_StopAction, self).__init__( + super().__init__( option_strings=option_strings, dest=dest, default=default, @@ -664,7 +664,7 @@ class _StopAction(argparse.Action): class _PrintTests(_StopAction): def __init__(self, integrated_apps=INTEGRATED_APPS, *args, **kwargs): - super(_PrintTests, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.integrated_apps = integrated_apps def __call__(self, parser, namespace, values, option_string=None): diff --git a/testing/raptor/raptor/perftest.py b/testing/raptor/raptor/perftest.py @@ -749,7 +749,7 @@ class PerftestAndroid(Perftest): LOG.info("Reverse port forwarding is used only on local devices") def build_browser_profile(self): - super(PerftestAndroid, self).build_browser_profile() + super().build_browser_profile() if self.config["app"] in FIREFOX_ANDROID_APPS: # Merge in the Android profile. @@ -803,7 +803,7 @@ class PerftestDesktop(Perftest): """Mixin class for Desktop-specific Perftest subclasses""" def __init__(self, *args, **kwargs): - super(PerftestDesktop, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def setup_chrome_args(self, test): """Sets up chrome/chromium cmd-line arguments. diff --git a/testing/raptor/raptor/results.py b/testing/raptor/raptor/results.py @@ -301,7 +301,7 @@ class BrowsertimeResultsHandler(PerftestResultsHandler): """Process Browsertime results""" def __init__(self, config, root_results_dir=None): - super(BrowsertimeResultsHandler, self).__init__(**config) + super().__init__(**config) self._root_results_dir = root_results_dir self.browsertime_visualmetrics = False self.failed_vismets = [] diff --git a/testing/raptor/test/conftest.py b/testing/raptor/test/conftest.py @@ -120,28 +120,28 @@ def create_args(): def ConcretePerftest(): class PerftestImplementation(Perftest): def check_for_crashes(self): - super(PerftestImplementation, self).check_for_crashes() + super().check_for_crashes() def clean_up(self): - super(PerftestImplementation, self).clean_up() + super().clean_up() def run_test(self, test, timeout): - super(PerftestImplementation, self).run_test(test, timeout) + super().run_test(test, timeout) def run_test_setup(self, test): - super(PerftestImplementation, self).run_test_setup(test) + super().run_test_setup(test) def run_test_teardown(self, test): - super(PerftestImplementation, self).run_test_teardown(test) + super().run_test_teardown(test) def set_browser_test_prefs(self): - super(PerftestImplementation, self).set_browser_test_prefs() + super().set_browser_test_prefs() def get_browser_meta(self): return (), () def setup_chrome_args(self, test): - super(PerftestImplementation, self).setup_chrome_args(test) + super().setup_chrome_args(test) return PerftestImplementation @@ -157,6 +157,6 @@ def ConcreteBrowsertime(): return (), () def setup_chrome_args(self, test): - super(BrowsertimeImplementation, self).setup_chrome_args(test) + super().setup_chrome_args(test) return BrowsertimeImplementation diff --git a/testing/raptor/test/test_raptor.py b/testing/raptor/test/test_raptor.py @@ -22,7 +22,7 @@ DEFAULT_TIMEOUT = 125 class TestBrowserThread(threading.Thread): def __init__(self, raptor_instance, tests, names): - super(TestBrowserThread, self).__init__() + super().__init__() self.raptor_instance = raptor_instance self.tests = tests self.names = names diff --git a/testing/talos/talos/cmdline.py b/testing/talos/talos/cmdline.py @@ -15,7 +15,7 @@ class _StopAction(argparse.Action): default=argparse.SUPPRESS, help=None, ): - super(_StopAction, self).__init__( + super().__init__( option_strings=option_strings, dest=dest, default=default, diff --git a/testing/talos/talos/test.py b/testing/talos/talos/test.py @@ -146,7 +146,7 @@ class TsBase(Test): ] def __init__(self, **kw): - super(TsBase, self).__init__(**kw) + super().__init__(**kw) # Unless set to False explicitly, all TsBase tests will have the blocklist # enabled by default in order to more accurately test the startup paths. diff --git a/testing/talos/talos/xtalos/xperf_analyzer.py b/testing/talos/talos/xtalos/xperf_analyzer.py @@ -204,7 +204,7 @@ class XPerfInterval(XPerfAttribute): """ def __init__(self, startevt, endevt, attrs=None, **kwargs): - super(XPerfInterval, self).__init__([startevt, endevt], **kwargs) + super().__init__([startevt, endevt], **kwargs) if not attrs: self.attrs_during_interval = [] else: @@ -224,7 +224,7 @@ class XPerfInterval(XPerfAttribute): # sub-attributes by setting their session to None. for a in self.attrs_during_interval: a.set_session(None) - super(XPerfInterval, self).on_event_matched(evt) + super().on_event_matched(evt) def process(self): # Propagate the process call to our sub-attributes @@ -293,7 +293,7 @@ class XPerfCounter(XPerfAttribute): value is a function that evaluates the corresponding value from the event's whiteboard. """ - super(XPerfCounter, self).__init__([evt], XPerfAttribute.PERSISTENT, **kwargs) + super().__init__([evt], XPerfAttribute.PERSISTENT, **kwargs) self.values = dict() self.count = 0 try: @@ -470,7 +470,7 @@ class Nth(EventExpression): """ def __init__(self, N, event): - super(Nth, self).__init__(event) + super().__init__(event) self.event = event self.N = N self.match_count = 0 @@ -528,7 +528,7 @@ class EventSequence(EventExpression): """ def __init__(self, *events): - super(EventSequence, self).__init__(list(events)) + super().__init__(list(events)) if len(events) < 2: raise Exception( "EventSequence requires at least two events, %d provided" % len(events) @@ -591,7 +591,7 @@ class BindThread(EventExpression): """ def __init__(self, event): - super(BindThread, self).__init__(event) + super().__init__(event) self.event = event self.tid = None @@ -635,11 +635,11 @@ class ClassicEvent(XPerfEvent): guid_index = None def __init__(self, guidstr): - super(ClassicEvent, self).__init__("UnknownEvent/Classic") + super().__init__("UnknownEvent/Classic") self.guid = UUID(guidstr) def match(self, row): - if not super(ClassicEvent, self).match(row): + if not super().match(row): return False if not ClassicEvent.guid_index: @@ -656,9 +656,7 @@ class SessionStoreWindowRestored(ClassicEvent): """The Firefox session store window restored event""" def __init__(self): - super(SessionStoreWindowRestored, self).__init__( - EVENT_ID_FIREFOX_WINDOW_RESTORED - ) + super().__init__(EVENT_ID_FIREFOX_WINDOW_RESTORED) def __str__(self): return "Firefox Session Store Window Restored" @@ -670,7 +668,7 @@ class ProcessStart(XPerfEvent): extractor = re.compile(r"^(.+) \(\s*(\d+)\)$") def __init__(self, leafname): - super(ProcessStart, self).__init__("P-Start") + super().__init__("P-Start") self.leafname = leafname.lower() @staticmethod @@ -700,7 +698,7 @@ class ProcessStart(XPerfEvent): return [t.strip('"') for t in result] def match(self, row): - if not super(ProcessStart, self).match(row): + if not super().match(row): return False if not ProcessStart.process_index: @@ -745,10 +743,10 @@ class ThreadStart(XPerfEvent): pid_extractor = re.compile(r"^.+ \(\s*(\d+)\)$") def __init__(self): - super(ThreadStart, self).__init__("T-Start") + super().__init__("T-Start") def match(self, row): - if not super(ThreadStart, self).match(row): + if not super().match(row): return False if not ThreadStart.process_index: @@ -777,13 +775,13 @@ class ReadyThread(XPerfEvent): tid_index = None def __init__(self): - super(ReadyThread, self).__init__("ReadyThread") + super().__init__("ReadyThread") def set_whiteboard(self, data): - super(ReadyThread, self).set_whiteboard(data) + super().set_whiteboard(data) def match(self, row): - if not super(ReadyThread, self).match(row): + if not super().match(row): return False if not ReadyThread.tid_index: @@ -808,10 +806,10 @@ class ContextSwitchToThread(XPerfEvent): tid_index = None def __init__(self): - super(ContextSwitchToThread, self).__init__("CSwitch") + super().__init__("CSwitch") def match(self, row): - if not super(ContextSwitchToThread, self).match(row): + if not super().match(row): return False if not ContextSwitchToThread.tid_index: @@ -849,12 +847,12 @@ class FileIOReadOrWrite(XPerfEvent): else: raise Exception("Invalid verb argument to FileIOReadOrWrite") - super(FileIOReadOrWrite, self).__init__(evt_name) + super().__init__(evt_name) self.verb = verb def match(self, row): - if not super(FileIOReadOrWrite, self).match(row): + if not super().match(row): return False if not FileIOReadOrWrite.tid_index: diff --git a/testing/web-platform/mach_commands.py b/testing/web-platform/mach_commands.py @@ -20,7 +20,7 @@ class WebPlatformTestsRunnerSetup(MozbuildObject): default_log_type = "mach" def __init__(self, *args, **kwargs): - super(WebPlatformTestsRunnerSetup, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._here = os.path.join(self.topsrcdir, "testing", "web-platform") kwargs["tests_root"] = os.path.join(self._here, "tests") sys.path.insert(0, kwargs["tests_root"]) diff --git a/testing/xpcshell/remotexpcshelltests.py b/testing/xpcshell/remotexpcshelltests.py @@ -539,7 +539,7 @@ class XPCShellRemote(xpcshell.XPCShellTests): RemoteProcessMonitor.freeProcess(test.selectedProcess) def buildPrefsFile(self, extraPrefs): - prefs = super(XPCShellRemote, self).buildPrefsFile(extraPrefs) + prefs = super().buildPrefsFile(extraPrefs) remotePrefsFile = posixpath.join(self.remoteTestRoot, "user.js") self.device.push(self.prefsFile, remotePrefsFile) self.device.chmod(remotePrefsFile) @@ -692,7 +692,7 @@ class XPCShellRemote(xpcshell.XPCShellTests): self.device.chmod(self.remoteScriptsDir, recursive=True) def trySetupNode(self): - super(XPCShellRemote, self).trySetupNode() + super().trySetupNode() # make node host ports visible to device if "MOZHTTP2_PORT" in self.env: port = "tcp:{}".format(self.env["MOZHTTP2_PORT"]) @@ -708,7 +708,7 @@ class XPCShellRemote(xpcshell.XPCShellTests): self.log.info("reversed MOZNODE_EXEC_PORT connection for port " + port) def shutdownNode(self): - super(XPCShellRemote, self).shutdownNode() + super().shutdownNode() if "MOZHTTP2_PORT" in self.env: port = "tcp:{}".format(self.env["MOZHTTP2_PORT"]) diff --git a/testing/xpcshell/selftest.py b/testing/xpcshell/selftest.py @@ -445,7 +445,7 @@ class XPCShellTestsTests(unittest.TestCase): """ def __init__(self, name): - super(XPCShellTestsTests, self).__init__(name) + super().__init__(name) from buildconfig import substs from mozbuild.base import MozbuildObject diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/marionette/test_bouncetracking_storage_persistence.py b/toolkit/components/antitracking/bouncetrackingprotection/test/marionette/test_bouncetracking_storage_persistence.py @@ -11,7 +11,7 @@ from marionette_harness import MarionetteTestCase class BounceTrackingStoragePersistenceTestCase(MarionetteTestCase): def setUp(self): - super(BounceTrackingStoragePersistenceTestCase, self).setUp() + super().setUp() self.marionette.enforce_gecko_prefs( { "privacy.bounceTrackingProtection.enabled": True, @@ -25,7 +25,7 @@ class BounceTrackingStoragePersistenceTestCase(MarionetteTestCase): def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(BounceTrackingStoragePersistenceTestCase, self).tearDown() + super().tearDown() def populate_state(self): # Add some data to test persistence. diff --git a/toolkit/components/cleardata/tests/marionette/test_service_worker_at_shutdown.py b/toolkit/components/cleardata/tests/marionette/test_service_worker_at_shutdown.py @@ -8,13 +8,13 @@ from marionette_harness import MarionetteTestCase class ServiceWorkerAtShutdownTestCase(MarionetteTestCase): def setUp(self): - super(ServiceWorkerAtShutdownTestCase, self).setUp() + super().setUp() self.install_service_worker() self.set_pref_to_delete_site_data_on_shutdown() def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(ServiceWorkerAtShutdownTestCase, self).tearDown() + super().tearDown() def install_service_worker(self): install_url = self.marionette.absolute_url( diff --git a/toolkit/components/extensions/test/marionette/test_extension_serviceworkers_purged_on_pref_disabled.py b/toolkit/components/extensions/test/marionette/test_extension_serviceworkers_purged_on_pref_disabled.py @@ -22,7 +22,7 @@ from service_worker_testutils import ( class PurgeExtensionServiceWorkersOnPrefDisabled(MarionetteServiceWorkerTestCase): def setUp(self): - super(PurgeExtensionServiceWorkersOnPrefDisabled, self).setUp() + super().setUp() self.test_extension_id = EXT_ID # Flip the "mirror: once" pref and restart Firefox to be able # to run the extension successfully. @@ -32,7 +32,7 @@ class PurgeExtensionServiceWorkersOnPrefDisabled(MarionetteServiceWorkerTestCase def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(PurgeExtensionServiceWorkersOnPrefDisabled, self).tearDown() + super().tearDown() def test_unregistering_service_worker_when_clearing_data(self): self.install_extension_with_service_worker() diff --git a/toolkit/components/extensions/test/marionette/test_temporary_extension_serviceworkers_not_persisted.py b/toolkit/components/extensions/test/marionette/test_temporary_extension_serviceworkers_not_persisted.py @@ -23,7 +23,7 @@ class TemporarilyInstalledAddonServiceWorkerNotPersisted( MarionetteServiceWorkerTestCase ): def setUp(self): - super(TemporarilyInstalledAddonServiceWorkerNotPersisted, self).setUp() + super().setUp() self.test_extension_id = EXT_ID # Flip the "mirror: once" pref and restart Firefox to be able # to run the extension successfully. @@ -32,7 +32,7 @@ class TemporarilyInstalledAddonServiceWorkerNotPersisted( def tearDown(self): self.marionette.restart(in_app=False, clean=True) - super(TemporarilyInstalledAddonServiceWorkerNotPersisted, self).tearDown() + super().tearDown() def test_temporarily_installed_addon_serviceWorkers_not_persisted(self): self.install_temporary_extension_with_service_worker() diff --git a/toolkit/components/glean/build_scripts/translate_events.py b/toolkit/components/glean/build_scripts/translate_events.py @@ -28,7 +28,7 @@ bug_number_pattern = re.compile(r"\d+") class IndentingDumper(yaml.Dumper): def increase_indent(self, flow=False, indentless=False): - return super(IndentingDumper, self).increase_indent(flow, False) + return super().increase_indent(flow, False) def get_bug_number_from_url(url: str) -> int: diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_ping_filters.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_ping_filters.py @@ -14,11 +14,11 @@ class FOGDocTypePingFilter(FOGPingFilter): """Ping filter that accepts FOG pings that match the doc-type.""" def __init__(self, doc_type): - super(FOGDocTypePingFilter, self).__init__() + super().__init__() self.doc_type = doc_type def __call__(self, ping): - if not super(FOGDocTypePingFilter, self).__call__(ping): + if not super().__call__(ping): return False # Verify that the given ping was submitted to the URL for the doc_type diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/fog_testcase.py @@ -13,7 +13,7 @@ class FOGTestCase(TelemetryTestCase): def __init__(self, *args, **kwargs): """Initialize the test case and create a ping server.""" - super(FOGTestCase, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self._logger = mozlog.get_default_logger(component="FOGTestCase") def setUp(self, *args, **kwargs): @@ -21,7 +21,7 @@ class FOGTestCase(TelemetryTestCase): This test is skipped if the build doesn't support FOG. """ - super(FOGTestCase, self).setUp(*args, **kwargs) + super().setUp(*args, **kwargs) with self.marionette.using_context(self.marionette.CONTEXT_CHROME): fog_android = self.marionette.execute_script( @@ -31,7 +31,7 @@ class FOGTestCase(TelemetryTestCase): if fog_android: # Before we skip this test, we need to quit marionette and the ping # server created in TelemetryTestCase by running tearDown - super(FOGTestCase, self).tearDown(*args, **kwargs) + super().tearDown(*args, **kwargs) self.skipTest("FOG is only initialized when not in an Android build.") self.fog_ping_server = FOGPingServer( @@ -61,5 +61,5 @@ class FOGTestCase(TelemetryTestCase): ) def tearDown(self, *args, **kwargs): - super(FOGTestCase, self).tearDown(*args, **kwargs) + super().tearDown(*args, **kwargs) self.fog_ping_server.stop() diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/ping_filters.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/ping_filters.py @@ -14,7 +14,7 @@ class DeletionRequestPingFilter(PingFilter): """Ping filter that accepts deletion-request pings.""" def __call__(self, ping): - if not super(DeletionRequestPingFilter, self).__call__(ping): + if not super().__call__(ping): return False return ping["type"] == "deletion-request" @@ -24,7 +24,7 @@ class EventPingFilter(PingFilter): """Ping filter that accepts event pings.""" def __call__(self, ping): - if not super(EventPingFilter, self).__call__(ping): + if not super().__call__(ping): return False return ping["type"] == "event" @@ -34,7 +34,7 @@ class FirstShutdownPingFilter(PingFilter): """Ping filter that accepts first-shutdown pings.""" def __call__(self, ping): - if not super(FirstShutdownPingFilter, self).__call__(ping): + if not super().__call__(ping): return False return ping["type"] == "first-shutdown" @@ -44,7 +44,7 @@ class MainPingFilter(PingFilter): """Ping filter that accepts main pings.""" def __call__(self, ping): - if not super(MainPingFilter, self).__call__(ping): + if not super().__call__(ping): return False return ping["type"] == "main" @@ -56,11 +56,11 @@ class MainPingReasonFilter(MainPingFilter): """ def __init__(self, reason): - super(MainPingReasonFilter, self).__init__() + super().__init__() self.reason = reason def __call__(self, ping): - if not super(MainPingReasonFilter, self).__call__(ping): + if not super().__call__(ping): return False return ping["payload"]["info"]["reason"] == self.reason diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runner.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/runner.py @@ -59,7 +59,7 @@ class TelemetryTestRunner(BaseMarionetteTestRunner): } ) - super(TelemetryTestRunner, self).__init__(prefs=prefs, **kwargs) + super().__init__(prefs=prefs, **kwargs) self.testvars["server_root"] = kwargs["server_root"] self.testvars["server_url"] = SERVER_URL diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py @@ -25,7 +25,7 @@ UUID_PATTERN = re.compile( class TelemetryTestCase(WindowManagerMixin, MarionetteTestCase): def __init__(self, *args, **kwargs): """Initialize the test case and create a ping server.""" - super(TelemetryTestCase, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def setUp(self, *args, **kwargs): """Set up the test case and start the ping server.""" @@ -35,7 +35,7 @@ class TelemetryTestCase(WindowManagerMixin, MarionetteTestCase): ) self.ping_server.start() - super(TelemetryTestCase, self).setUp(*args, **kwargs) + super().setUp(*args, **kwargs) # Store IDs of addons installed via self.install_addon() self.addon_ids = [] @@ -232,6 +232,6 @@ class TelemetryTestCase(WindowManagerMixin, MarionetteTestCase): def tearDown(self, *args, **kwargs): """Stop the ping server and tear down the testcase.""" - super(TelemetryTestCase, self).tearDown() + super().tearDown() self.ping_server.stop() self.marionette.quit(in_app=False, clean=True) diff --git a/toolkit/components/telemetry/tests/marionette/tests/client/test_shutdown_pings_succeed.py b/toolkit/components/telemetry/tests/marionette/tests/client/test_shutdown_pings_succeed.py @@ -10,7 +10,7 @@ class TestShutdownPingsSucced(TelemetryTestCase): """Test Firefox shutdown pings.""" def tearDown(self): - super(TestShutdownPingsSucced, self).tearDown() + super().tearDown() # We need a fresh profile next run in order that the "new-profile" and # "first-shutdown" pings are sent. diff --git a/toolkit/components/telemetry/tests/marionette/tests/unit/test_ping_server_received_ping.py b/toolkit/components/telemetry/tests/marionette/tests/unit/test_ping_server_received_ping.py @@ -9,7 +9,7 @@ from telemetry_harness.testcase import TelemetryTestCase class TestPingServer(TelemetryTestCase): def setUp(self, *args, **kwargs): """Set up the test case retrieve the pings URL.""" - super(TestPingServer, self).setUp(*args, **kwargs) + super().setUp(*args, **kwargs) self.pings_url = self.ping_server.get_url("/pings") def test_ping_server_received_ping(self): diff --git a/toolkit/xre/dllservices/mozglue/gen_dll_blocklist_defs.py b/toolkit/xre/dllservices/mozglue/gen_dll_blocklist_defs.py @@ -588,7 +588,7 @@ class A11yBlocklistEntry(DllBlocklistEntry): def __init__(self, name, ver, flags=(), **kwargs): """These arguments are identical to DllBlocklistEntry.__init__""" - super(A11yBlocklistEntry, self).__init__(name, ver, flags, **kwargs) + super().__init__(name, ver, flags, **kwargs) class RedirectToNoOpEntryPoint(DllBlocklistEntry): @@ -602,10 +602,10 @@ class RedirectToNoOpEntryPoint(DllBlocklistEntry): def __init__(self, name, ver, flags=(), **kwargs): """These arguments are identical to DllBlocklistEntry.__init__""" - super(RedirectToNoOpEntryPoint, self).__init__(name, ver, flags, **kwargs) + super().__init__(name, ver, flags, **kwargs) def get_flags_list(self): - flags = super(RedirectToNoOpEntryPoint, self).get_flags_list() + flags = super().get_flags_list() # RedirectToNoOpEntryPoint items always include the following flag flags.add(REDIRECT_TO_NOOP_ENTRYPOINT) return flags @@ -641,7 +641,7 @@ class LspBlocklistEntry(DllBlocklistEntry): generated around the entry during output. """ - super(LspBlocklistEntry, self).__init__(name, ver, flags, **kwargs) + super().__init__(name, ver, flags, **kwargs) if not guids: raise ValueError("Missing GUID(s)!") @@ -661,7 +661,7 @@ class LspBlocklistEntry(DllBlocklistEntry): LspBlocklistEntry.Guids.setdefault(guid, []).append(name) def get_flags_list(self): - flags = super(LspBlocklistEntry, self).get_flags_list() + flags = super().get_flags_list() # LSP entries always include the following flag flags.add(SUBSTITUTE_LSP_PASSTHROUGH) return flags @@ -693,7 +693,7 @@ class LspBlocklistEntry(DllBlocklistEntry): def write(self, output, mode): if mode != LSP_MODE_GUID: - super(LspBlocklistEntry, self).write(output, mode) + super().write(output, mode) return # We dump the entire contents of Guids on the first call, and then diff --git a/toolkit/xre/test/marionette/test_fission_autostart.py b/toolkit/xre/test/marionette/test_fission_autostart.py @@ -123,7 +123,7 @@ class TestFissionAutostart(MarionetteTestCase): self.setUpSession() def setUp(self): - super(TestFissionAutostart, self).setUp() + super().setUp() # If we have configured marionette to require a particular value for # `fission.autostart`, remove it as a forced pref until `tearDown`, and @@ -152,7 +152,7 @@ class TestFissionAutostart(MarionetteTestCase): ) self.marionette.restart(in_app=False, clean=True) - super(TestFissionAutostart, self).tearDown() + super().tearDown() def test_runtime_changes(self): """Tests that changes to preferences during runtime do not have any diff --git a/toolkit/xre/test/marionette/test_win32k_enrollment.py b/toolkit/xre/test/marionette/test_win32k_enrollment.py @@ -155,7 +155,7 @@ class TestWin32kAutostart(MarionetteTestCase): self.setUpSession() def setUp(self): - super(TestWin32kAutostart, self).setUp() + super().setUp() # If we have configured marionette to require a particular value for # `win32k.autostart`, remove it as a forced pref until `tearDown`, and @@ -201,7 +201,7 @@ class TestWin32kAutostart(MarionetteTestCase): self.marionette.instance.required_prefs[Prefs.WIN32K] = self.win32kRequired self.marionette.restart(in_app=False, clean=True) - super(TestWin32kAutostart, self).tearDown() + super().tearDown() def test_1(self): # [D=F] Nothing [A#1] -> Enrolled Control [A S=DisabledByDefault SS=DisabledByDefa... diff --git a/toolkit/xre/test/marionette/test_win32k_enrollment.template.py b/toolkit/xre/test/marionette/test_win32k_enrollment.template.py @@ -155,7 +155,7 @@ class TestWin32kAutostart(MarionetteTestCase): self.setUpSession() def setUp(self): - super(TestWin32kAutostart, self).setUp() + super().setUp() # If we have configured marionette to require a particular value for # `win32k.autostart`, remove it as a forced pref until `tearDown`, and @@ -201,4 +201,4 @@ class TestWin32kAutostart(MarionetteTestCase): self.marionette.instance.required_prefs[Prefs.WIN32K] = self.win32kRequired self.marionette.restart(in_app=False, clean=True) - super(TestWin32kAutostart, self).tearDown() + super().tearDown() diff --git a/tools/lint/cpp/mingw-capitalization.py b/tools/lint/cpp/mingw-capitalization.py @@ -15,7 +15,7 @@ HEADERS_FILE = os.path.join(here, "mingw-headers.txt") class MinGWCapitalization(LineType): def __init__(self, *args, **kwargs): - super(MinGWCapitalization, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) with open(HEADERS_FILE) as fh: self.headers = fh.read().strip().splitlines() self.regex = re.compile(r"^#include\s*<(" + "|".join(self.headers) + ")>") diff --git a/tools/lint/fluent-lint/__init__.py b/tools/lint/fluent-lint/__init__.py @@ -142,7 +142,7 @@ class Linter(visitor.Visitor): # Only debug print the root node. self.debug_print_json = False - super(Linter, self).generic_visit(node) + super().generic_visit(node) def visit_Attribute(self, node): # Only visit values for Attribute nodes, the identifier comes from dom. diff --git a/tools/lint/perfdocs/framework_gatherers.py b/tools/lint/perfdocs/framework_gatherers.py @@ -281,9 +281,7 @@ class RaptorGatherer(FrameworkGatherer): :return str: A formatted string containing the reference link to the documented metric. """ - metric_heading = super(RaptorGatherer, self)._get_metric_heading( - metric, metrics_info - ) + metric_heading = super()._get_metric_heading(metric, metrics_info) return f"`{metric} <raptor-metrics.html#{metric_heading.lower().replace(' ', '-')}>`__" def get_test_list(self): diff --git a/tools/lint/python/l10n_lint.py b/tools/lint/python/l10n_lint.py @@ -197,13 +197,11 @@ class MozL10nLinter(L10nLinter): """Subclass linter to generate the right result type.""" def __init__(self, lintconfig): - super(MozL10nLinter, self).__init__() + super().__init__() self.lintconfig = lintconfig def lint(self, files, get_reference_and_tests): return [ result.from_config(self.lintconfig, **result_data) - for result_data in super(MozL10nLinter, self).lint( - files, get_reference_and_tests - ) + for result_data in super().lint(files, get_reference_and_tests) ]