diff --git a/browser/components/sessionstore/test/marionette/test_taskbartab_restore.py b/browser/components/sessionstore/test/marionette/test_taskbartab_restore.py index de6b8e2667a7..e332fef87cf1 100644 --- a/browser/components/sessionstore/test/marionette/test_taskbartab_restore.py +++ b/browser/components/sessionstore/test/marionette/test_taskbartab_restore.py @@ -75,13 +75,15 @@ class TestManualRestoreWithTaskbarTabs(SessionStoreTestCase): # meaning the window we opened should have # two tabs again. Wait(self.marionette).until( - lambda mn: mn.execute_script( - """ + lambda mn: ( + mn.execute_script( + """ let newWindow = BrowserWindowTracker.getTopWindow({ allowTaskbarTabs: false }); return newWindow.gBrowser.tabs.length; """ + ) + == 2 ) - == 2 ) @@ -118,11 +120,13 @@ class TestAutoRestoreWithTaskbarTabs(SessionStoreTestCase): # meaning the window we opened should have # the original two tabs plus the home page tab. Wait(self.marionette).until( - lambda mn: mn.execute_script( - """ + lambda mn: ( + mn.execute_script( + """ let newWindow = BrowserWindowTracker.getTopWindow({ allowTaskbarTabs: false }); return newWindow.gBrowser.tabs.length; """ + ) + == 3 ) - == 3 ) diff --git a/dom/cache/test/marionette/test_cacheapi_encryption_PBM.py b/dom/cache/test/marionette/test_cacheapi_encryption_PBM.py index b00f44f97bfe..14a7048154da 100644 --- a/dom/cache/test/marionette/test_cacheapi_encryption_PBM.py +++ b/dom/cache/test/marionette/test_cacheapi_encryption_PBM.py @@ -97,8 +97,10 @@ class CacheAPIEncryptionPBM(QuotaTestCase): def validateBodyFile(self, validator): # Ensure response bodies have been flushed to the disk self.ensureInvariantHolds( - lambda _: self.findDirObj(self.getCacheAPIStoragePath(), "morgue", False) - is not None + lambda _: ( + self.findDirObj(self.getCacheAPIStoragePath(), "morgue", False) + is not None + ) ) cacheResponseDir = self.findDirObj( @@ -115,8 +117,9 @@ class CacheAPIEncryptionPBM(QuotaTestCase): # Ensure bodies have been transferred to '.final' from '.tmp' self.ensureInvariantHolds( - lambda _: self.findDirObj(cacheResponseBodiesPath, ".final", True) - is not None + lambda _: ( + self.findDirObj(cacheResponseBodiesPath, ".final", True) is not None + ) ) cacheResponseBodyPath = self.findDirObj(cacheResponseBodiesPath, ".final", True) @@ -131,20 +134,24 @@ class CacheAPIEncryptionPBM(QuotaTestCase): def validateSqlite(self, validator): self.ensureInvariantHolds( - lambda _: self.findDirObj( - self.getCacheAPIStoragePath(), self.cacheDBJournalFileName, True + lambda _: ( + self.findDirObj( + self.getCacheAPIStoragePath(), self.cacheDBJournalFileName, True + ) + is not None ) - is not None ) dbJournalFile = self.findDirObj( self.getCacheAPIStoragePath(), self.cacheDBJournalFileName, True ) self.ensureInvariantHolds( - lambda _: self.findDirObj( - self.getCacheAPIStoragePath(), self.cacheDBFileName, True + lambda _: ( + self.findDirObj( + self.getCacheAPIStoragePath(), self.cacheDBFileName, True + ) + is not None ) - is not None ) dbFile = self.findDirObj( self.getCacheAPIStoragePath(), self.cacheDBFileName, True diff --git a/dom/indexedDB/test/marionette/test_IDB_encryption_PBM.py b/dom/indexedDB/test/marionette/test_IDB_encryption_PBM.py index f44dd1b27ac6..4c8ee3fd3a0e 100644 --- a/dom/indexedDB/test/marionette/test_IDB_encryption_PBM.py +++ b/dom/indexedDB/test/marionette/test_IDB_encryption_PBM.py @@ -90,8 +90,9 @@ class IDBEncryptionPBM(QuotaTestCase): def validateBlob(self, validator): self.ensureInvariantHolds(lambda _: self.sqliteWALReleased()) self.ensureInvariantHolds( - lambda _: self.findDirObj(self.getIDBStoragePath(), ".files", False) - is not None + lambda _: ( + self.findDirObj(self.getIDBStoragePath(), ".files", False) is not None + ) ) idbBlobDir = self.findDirObj(self.getIDBStoragePath(), ".files", False) @@ -113,8 +114,9 @@ class IDBEncryptionPBM(QuotaTestCase): def validateSqlite(self, validator): self.ensureInvariantHolds(lambda _: self.sqliteWALReleased()) self.ensureInvariantHolds( - lambda _: self.findDirObj(self.getIDBStoragePath(), ".sqlite", True) - is not None + lambda _: ( + self.findDirObj(self.getIDBStoragePath(), ".sqlite", True) is not None + ) ) sqliteDBFile = self.findDirObj(self.getIDBStoragePath(), ".sqlite", True) diff --git a/js/src/gdb/run-tests.py b/js/src/gdb/run-tests.py index 7474271e50a4..a848d029ca0d 100644 --- a/js/src/gdb/run-tests.py +++ b/js/src/gdb/run-tests.py @@ -252,7 +252,8 @@ def run_tests(tests, summary): # python 3.3 fixed a bug with concurrently writing .pyc files. # https://bugs.python.org/issue13146 embedded_version = ( - subprocess.check_output([ + subprocess + .check_output([ OPTIONS.gdb_executable, "--batch", "--ex", diff --git a/js/src/tests/test262-export.py b/js/src/tests/test262-export.py index b4dd0a8e257e..103cac11cd9e 100755 --- a/js/src/tests/test262-export.py +++ b/js/src/tests/test262-export.py @@ -534,7 +534,8 @@ def insertMeta(source: bytes, frontmatter: "dict[str, Any]") -> bytes: if key in ("description", "info"): lines.append(b"%s: |" % key.encode("ascii")) lines.append( - yaml.dump( + yaml + .dump( value, encoding="utf8", default_style="|", diff --git a/netwerk/test/marionette/test_beacon_on_pagehide_shutdown.py b/netwerk/test/marionette/test_beacon_on_pagehide_shutdown.py index db7ae27e343f..17a4ed902403 100644 --- a/netwerk/test/marionette/test_beacon_on_pagehide_shutdown.py +++ b/netwerk/test/marionette/test_beacon_on_pagehide_shutdown.py @@ -123,8 +123,10 @@ class BeaconOnPagehideShutdownTestCase(MarionetteTestCase): # Wait for navigation and any pending beacon requests Wait(self.marionette, timeout=10).until( - lambda _: self.marionette.execute_script("return document.readyState") - == "complete" + lambda _: ( + self.marionette.execute_script("return document.readyState") + == "complete" + ) ) time.sleep(2) # Give server time to process the beacon diff --git a/python/lldbutils/lldbutils/general.py b/python/lldbutils/lldbutils/general.py index 577b3847fadf..3d9a40e194e5 100644 --- a/python/lldbutils/lldbutils/general.py +++ b/python/lldbutils/lldbutils/general.py @@ -32,7 +32,8 @@ class TArraySyntheticChildrenProvider: def num_children(self): return ( - self.header.Dereference() + self.header + .Dereference() .GetChildMemberWithName("mLength") .GetValueAsUnsigned(0) ) @@ -85,7 +86,8 @@ def prefcnt(debugger, command, result, dict): ) elif refcnt_type == "mozilla::ThreadSafeAutoRefCnt": print( - field.GetChildMemberWithName("mValue") + field + .GetChildMemberWithName("mValue") .GetChildMemberWithName("mValue") .GetValueAsUnsigned(0) ) diff --git a/python/mach/mach/telemetry.py b/python/mach/mach/telemetry.py index 411d6fd6820e..2b70b3f75a2d 100644 --- a/python/mach/mach/telemetry.py +++ b/python/mach/mach/telemetry.py @@ -141,7 +141,8 @@ def resolve_is_employee_by_credentials(topsrcdir: Path): arcrc = json.load(arcrc_file) phabricator_token = ( - arcrc.get("hosts", {}) + arcrc + .get("hosts", {}) .get(urllib_parse.urljoin(phabricator_uri, "api/"), {}) .get("token") ) diff --git a/python/mozbuild/mozbuild/code_analysis/mach_commands.py b/python/mozbuild/mozbuild/code_analysis/mach_commands.py index b99830c95ae2..70fa3b5650e7 100644 --- a/python/mozbuild/mozbuild/code_analysis/mach_commands.py +++ b/python/mozbuild/mozbuild/code_analysis/mach_commands.py @@ -462,7 +462,8 @@ def _get_current_version(command_context, clang_paths): version_info = None try: version_info = ( - subprocess.check_output(cmd, stderr=subprocess.STDOUT) + subprocess + .check_output(cmd, stderr=subprocess.STDOUT) .decode("utf-8") .strip() ) diff --git a/python/mozbuild/mozbuild/nodeutil.py b/python/mozbuild/mozbuild/nodeutil.py index 48fbe01af33e..dd908f950cf7 100644 --- a/python/mozbuild/mozbuild/nodeutil.py +++ b/python/mozbuild/mozbuild/nodeutil.py @@ -83,9 +83,8 @@ def check_executable_version(exe, wrap_call_with_node=False): binary, _ = find_node_executable() if binary: out = ( - subprocess.check_output( - [binary, exe, "--version"], universal_newlines=True - ) + subprocess + .check_output([binary, exe, "--version"], universal_newlines=True) .lstrip("v") .rstrip() ) @@ -94,7 +93,8 @@ def check_executable_version(exe, wrap_call_with_node=False): # direct. if not out: out = ( - subprocess.check_output([exe, "--version"], universal_newlines=True) + subprocess + .check_output([exe, "--version"], universal_newlines=True) .lstrip("v") .rstrip() ) diff --git a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py index 3e4055c51ba2..f1c27bdf686b 100644 --- a/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py +++ b/python/mozbuild/mozbuild/test/configure/test_toolchain_helpers.py @@ -49,7 +49,8 @@ class CompilerPreprocessor(Preprocessor): def normalize_has_feature_or_builtin(expr): return ( - self.HAS_FEATURE_OR_BUILTIN.sub(r"\1\2", expr) + self.HAS_FEATURE_OR_BUILTIN + .sub(r"\1\2", expr) .replace("-", "_") .replace("+", "_") ) diff --git a/python/mozbuild/mozbuild/vendor/vendor_rust.py b/python/mozbuild/mozbuild/vendor/vendor_rust.py index 6a17268be101..d2f10057ed10 100644 --- a/python/mozbuild/mozbuild/vendor/vendor_rust.py +++ b/python/mozbuild/mozbuild/vendor/vendor_rust.py @@ -210,7 +210,8 @@ class VendorRust(MozbuildObject): def cargo_version(self, cargo): out = ( - subprocess.check_output([cargo, "--version"]) + subprocess + .check_output([cargo, "--version"]) .splitlines()[0] .decode("UTF-8") ) diff --git a/python/mozbuild/mozpack/packager/formats.py b/python/mozbuild/mozpack/packager/formats.py index 387c5f884a35..b8c5ab0257d7 100644 --- a/python/mozbuild/mozpack/packager/formats.py +++ b/python/mozbuild/mozpack/packager/formats.py @@ -229,7 +229,8 @@ class JarSubFormatter(PiecemealFormatter): basepath = mozpath.split(relpath)[0] chromepath = mozpath.join(base, basepath) entry = ( - entry.rebase(chromepath) + entry + .rebase(chromepath) .move(mozpath.join(base, "jar:%s.jar!" % basepath)) .rebase(base) ) diff --git a/python/mozbuild/mozpack/packager/unpack.py b/python/mozbuild/mozpack/packager/unpack.py index 5121b60a1cf5..32c6c44c8f04 100644 --- a/python/mozbuild/mozpack/packager/unpack.py +++ b/python/mozbuild/mozpack/packager/unpack.py @@ -170,7 +170,8 @@ class UnpackFinder(BaseFinder): base = entry.base jar, relpath = urlparse(relpath).path.split("!", 1) entry = ( - entry.rebase(mozpath.join(base, "jar:%s!" % jar)) + entry + .rebase(mozpath.join(base, "jar:%s!" % jar)) .move(mozpath.join(base, mozpath.splitext(jar)[0])) .rebase(base) ) diff --git a/python/mozbuild/mozpack/unify.py b/python/mozbuild/mozpack/unify.py index ca4d0017a994..b8d8a24f4fa7 100644 --- a/python/mozbuild/mozpack/unify.py +++ b/python/mozbuild/mozpack/unify.py @@ -245,11 +245,17 @@ class UnifiedBuildFinder(UnifiedFinder): # they exist, or strip them if only one file has a target platform. content1, content2 = ( FIND_TARGET_PLATFORM_ATTR.sub( - lambda m: m.group("tag") - + m.group("attrs") - + m.group("otherattrs") - + "<%stargetPlatform>%s" - % (m.group("ns") or "", m.group("platform"), m.group("ns") or ""), + lambda m: ( + m.group("tag") + + m.group("attrs") + + m.group("otherattrs") + + "<%stargetPlatform>%s" + % ( + m.group("ns") or "", + m.group("platform"), + m.group("ns") or "", + ) + ), f.open().read().decode("utf-8"), ) for f in (file1, file2) diff --git a/python/mozperftest/mozperftest/metrics/notebook/transformer.py b/python/mozperftest/mozperftest/metrics/notebook/transformer.py index 3c4deab98fba..1253b97aedb6 100644 --- a/python/mozperftest/mozperftest/metrics/notebook/transformer.py +++ b/python/mozperftest/mozperftest/metrics/notebook/transformer.py @@ -176,11 +176,13 @@ def get_transformer(path, ret_members=False): members = inspect.getmembers( module, - lambda c: inspect.isclass(c) - and hasattr(c, "transform") - and hasattr(c, "merge") - and callable(c.transform) - and callable(c.merge), + lambda c: ( + inspect.isclass(c) + and hasattr(c, "transform") + and hasattr(c, "merge") + and callable(c.transform) + and callable(c.merge) + ), ) if not members and not ret_members: diff --git a/python/mozperftest/mozperftest/test/shellscript.py b/python/mozperftest/mozperftest/test/shellscript.py index 314bc53b8ded..500a1873bab9 100644 --- a/python/mozperftest/mozperftest/test/shellscript.py +++ b/python/mozperftest/mozperftest/test/shellscript.py @@ -91,7 +91,8 @@ class ShellScriptRunner(Layer): parsed_metrics = [] for metrics in self.metrics: prepared_metrics = ( - metrics.replace("perfMetrics:", "") + metrics + .replace("perfMetrics:", "") .replace("{{", "{") .replace("}}", "}") .strip() diff --git a/taskcluster/docker/snap-coreXX-build/snap-tests/qa_tests.py b/taskcluster/docker/snap-coreXX-build/snap-tests/qa_tests.py index d50b2499f4b9..966cac19a31a 100644 --- a/taskcluster/docker/snap-coreXX-build/snap-tests/qa_tests.py +++ b/taskcluster/docker/snap-coreXX-build/snap-tests/qa_tests.py @@ -349,10 +349,12 @@ class QATests(SnapTestsBase): ) self._wait.until( - lambda d: d.execute_script( - 'return window.getComputedStyle(document.querySelector(".loadingInput.start"), "::after").getPropertyValue("visibility");' + lambda d: ( + d.execute_script( + 'return window.getComputedStyle(document.querySelector(".loadingInput.start"), "::after").getPropertyValue("visibility");' + ) + != "visible" ) - != "visible" ) # PDF.js can take time to settle and we don't have a nice way to wait # for an event on it @@ -652,11 +654,13 @@ class QATests(SnapTestsBase): if context_change: self._driver.set_context("chrome") self._wait.until( - lambda d: self._driver.execute_script( - "return Services.clipboard.hasDataMatchingFlavors([arguments[0]], Ci.nsIClipboard.kGlobalClipboard);", - mime_type, + lambda d: ( + self._driver.execute_script( + "return Services.clipboard.hasDataMatchingFlavors([arguments[0]], Ci.nsIClipboard.kGlobalClipboard);", + mime_type, + ) + is True ) - is True ) if context_change: self._driver.set_context("content") @@ -890,7 +894,8 @@ class QATests(SnapTestsBase): EC.presence_of_element_located((By.ID, "downloadFolder")) ) previous_folder = ( - download_folder.get_property("value") + download_folder + .get_property("value") .replace("\u2066", "") .replace("\u2069", "") ) diff --git a/taskcluster/gecko_taskgraph/transforms/balrog_submit.py b/taskcluster/gecko_taskgraph/transforms/balrog_submit.py index ff0632201bda..0772c7aa094b 100644 --- a/taskcluster/gecko_taskgraph/transforms/balrog_submit.py +++ b/taskcluster/gecko_taskgraph/transforms/balrog_submit.py @@ -81,7 +81,8 @@ def make_task_description(config, jobs): treeherder = job.get("treeherder", {}) treeherder.setdefault("symbol", "c-Up(N)") dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/beetmover.py b/taskcluster/gecko_taskgraph/transforms/beetmover.py index f5542316b529..bd5608ba90f0 100644 --- a/taskcluster/gecko_taskgraph/transforms/beetmover.py +++ b/taskcluster/gecko_taskgraph/transforms/beetmover.py @@ -65,7 +65,8 @@ def make_task_description(config, jobs): "symbol", replace_group(dep_job.task["extra"]["treeherder"]["symbol"], "BM") ) dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/beetmover_checksums.py b/taskcluster/gecko_taskgraph/transforms/beetmover_checksums.py index f3271c99268b..2099205ce8a3 100644 --- a/taskcluster/gecko_taskgraph/transforms/beetmover_checksums.py +++ b/taskcluster/gecko_taskgraph/transforms/beetmover_checksums.py @@ -62,7 +62,8 @@ def make_beetmover_checksums_description(config, jobs): replace_group(dep_job.task["extra"]["treeherder"]["symbol"], "BMcs"), ) dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/beetmover_geckoview.py b/taskcluster/gecko_taskgraph/transforms/beetmover_geckoview.py index 73ffa4187ffc..5416863cff5b 100644 --- a/taskcluster/gecko_taskgraph/transforms/beetmover_geckoview.py +++ b/taskcluster/gecko_taskgraph/transforms/beetmover_geckoview.py @@ -111,7 +111,8 @@ def make_task_description(config, jobs): treeherder = job.get("treeherder", {}) dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/beetmover_integration.py b/taskcluster/gecko_taskgraph/transforms/beetmover_integration.py index de25533e56e7..b7f32b884e29 100644 --- a/taskcluster/gecko_taskgraph/transforms/beetmover_integration.py +++ b/taskcluster/gecko_taskgraph/transforms/beetmover_integration.py @@ -58,7 +58,8 @@ def make_task_description(config, tasks): treeherder = task.get("treeherder", {}) dep_th_platform = ( - dep_task.task.get("extra", {}) + dep_task.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/beetmover_source_checksums.py b/taskcluster/gecko_taskgraph/transforms/beetmover_source_checksums.py index a13ac3e6980a..e2ce1af8f67c 100644 --- a/taskcluster/gecko_taskgraph/transforms/beetmover_source_checksums.py +++ b/taskcluster/gecko_taskgraph/transforms/beetmover_source_checksums.py @@ -59,7 +59,8 @@ def make_beetmover_checksums_description(config, jobs): treeherder = job.get("treeherder", {}) treeherder.setdefault("symbol", "BMcss(N)") dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/perftest.py b/taskcluster/gecko_taskgraph/transforms/perftest.py index 048039133225..1aee3a14e60b 100644 --- a/taskcluster/gecko_taskgraph/transforms/perftest.py +++ b/taskcluster/gecko_taskgraph/transforms/perftest.py @@ -391,7 +391,8 @@ def setup_regression_detector(config, jobs): base_project = None if ( - config.params.get("try_task_config", {}) + config.params + .get("try_task_config", {}) .get("env", {}) .get("PERF_BASE_REVISION", None) is not None diff --git a/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_beetmover.py b/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_beetmover.py index 9f5b1aedcaa1..865beb885211 100644 --- a/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_beetmover.py +++ b/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_beetmover.py @@ -65,7 +65,8 @@ def make_task_description(config, jobs): treeherder = job.get("treeherder", {}) treeherder.setdefault("symbol", "BM-SGenChcks") dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_signing.py b/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_signing.py index 1d533bb8b5f4..2256745737dd 100644 --- a/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_signing.py +++ b/taskcluster/gecko_taskgraph/transforms/release_generate_checksums_signing.py @@ -53,7 +53,8 @@ def make_release_generate_checksums_signing_description(config, jobs): treeherder = job.get("treeherder", {}) treeherder.setdefault("symbol", "SGenChcks") dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/signing.py b/taskcluster/gecko_taskgraph/transforms/signing.py index deb07e167e0e..b166d02a583e 100644 --- a/taskcluster/gecko_taskgraph/transforms/signing.py +++ b/taskcluster/gecko_taskgraph/transforms/signing.py @@ -121,7 +121,8 @@ def make_task_description(config, jobs): treeherder = job.get("treeherder", {}) dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/transforms/source_checksums_signing.py b/taskcluster/gecko_taskgraph/transforms/source_checksums_signing.py index a839952dc0ba..57f27687b0c6 100644 --- a/taskcluster/gecko_taskgraph/transforms/source_checksums_signing.py +++ b/taskcluster/gecko_taskgraph/transforms/source_checksums_signing.py @@ -52,7 +52,8 @@ def make_checksums_signing_description(config, jobs): treeherder = job.get("treeherder", {}) treeherder.setdefault("symbol", "css(N)") dep_th_platform = ( - dep_job.task.get("extra", {}) + dep_job.task + .get("extra", {}) .get("treeherder", {}) .get("machine", {}) .get("platform", "") diff --git a/taskcluster/gecko_taskgraph/util/attributes.py b/taskcluster/gecko_taskgraph/util/attributes.py index b5da46e6b3f0..f9973a1d7da8 100644 --- a/taskcluster/gecko_taskgraph/util/attributes.py +++ b/taskcluster/gecko_taskgraph/util/attributes.py @@ -85,8 +85,9 @@ RUN_ON_PROJECT_ALIASES = { "trunk-only": lambda params: params["project"] in TRUNK_PROJECTS, "autoland": lambda params: params["project"] in ("autoland", "toolchains"), "autoland-only": lambda params: params["project"] == "autoland", - "mozilla-central": lambda params: params["project"] - in ("mozilla-central", "toolchains"), + "mozilla-central": lambda params: ( + params["project"] in ("mozilla-central", "toolchains") + ), "mozilla-central-only": lambda params: params["project"] == "mozilla-central", } diff --git a/taskcluster/gecko_taskgraph/util/partials.py b/taskcluster/gecko_taskgraph/util/partials.py index 08cb49db93ad..e8032d23e025 100644 --- a/taskcluster/gecko_taskgraph/util/partials.py +++ b/taskcluster/gecko_taskgraph/util/partials.py @@ -85,7 +85,8 @@ def get_partials_artifacts_from_params(release_history, platform, locale): platform = _sanitize_platform(platform) return [ (artifact, details.get("previousVersion", None)) - for artifact, details in release_history.get(platform, {}) + for artifact, details in release_history + .get(platform, {}) .get(locale, {}) .items() ] diff --git a/taskcluster/scripts/misc/verify-devtools-bundle.py b/taskcluster/scripts/misc/verify-devtools-bundle.py index 901db0eb0869..0acaf5b8310f 100644 --- a/taskcluster/scripts/misc/verify-devtools-bundle.py +++ b/taskcluster/scripts/misc/verify-devtools-bundle.py @@ -28,7 +28,8 @@ hg_exclude = "devtools/client/debugger/bin/module-manifest.json" print("Run `hg status devtools/`") status = ( - subprocess.check_output(["hg", "status", "-n", "devtools/", "-X", hg_exclude]) + subprocess + .check_output(["hg", "status", "-n", "devtools/", "-X", hg_exclude]) .decode("utf-8") .split("\n") ) diff --git a/taskcluster/test/test_mach_try_auto.py b/taskcluster/test/test_mach_try_auto.py index fa9719913346..87a359d01f7d 100644 --- a/taskcluster/test/test_mach_try_auto.py +++ b/taskcluster/test/test_mach_try_auto.py @@ -77,8 +77,9 @@ def test_tasks_are_scheduled(optimized_task_graph, filter_tasks, func, min_expec "func", ( pytest.param( - lambda t: t.kind == "build" - and "shippable" in t.attributes["build_platform"], + lambda t: ( + t.kind == "build" and "shippable" in t.attributes["build_platform"] + ), id="no shippable builds", ), pytest.param( diff --git a/testing/android-test/mach_commands.py b/testing/android-test/mach_commands.py index 7b1bb71cd960..8e40ccd11160 100644 --- a/testing/android-test/mach_commands.py +++ b/testing/android-test/mach_commands.py @@ -16,7 +16,8 @@ def classname_for_test(test, test_path): # test_path = src/test/java # returns = mozilla.components.feature.addons.ui.PermissionsDialogFragmentTest return ( - os.path.normpath(test) + os.path + .normpath(test) .split(os.path.normpath(test_path))[-1] .removeprefix(os.path.sep) .replace(os.path.sep, ".") @@ -32,7 +33,8 @@ def project_for_test(test, prefix): # prefix = mobile/android # returns = android-components return ( - os.path.normpath(test) + os.path + .normpath(test) .split(os.path.normpath(prefix))[-1] .removeprefix(os.path.sep) .split(os.path.sep)[0] @@ -47,7 +49,8 @@ def project_for_ac(test, prefix, test_path): # test_path = src/test/java # returns = feature-addons return ( - os.path.normpath(test) + os.path + .normpath(test) .split(os.path.normpath(prefix))[-1] .split(os.path.normpath(test_path))[0] .removeprefix(os.path.sep) diff --git a/testing/manifest/clean_skipfails.py b/testing/manifest/clean_skipfails.py index 30ccc305ec3d..b7421e2ce475 100644 --- a/testing/manifest/clean_skipfails.py +++ b/testing/manifest/clean_skipfails.py @@ -57,7 +57,9 @@ class CleanSkipfails: def full_path(self, filename: str): """Returns full path for the relative filename""" - return os.path.join(self.topsrcdir, os.path.normpath(filename.split(":")[-1])) + return os.path.join( + self.topsrcdir, os.path.normpath(filename.rsplit(":", 1)[-1]) + ) def isdir(self, filename: str): """Returns True if filename is a directory""" diff --git a/testing/manifest/skipfails.py b/testing/manifest/skipfails.py index f98918f6ed32..9b7ca63b1951 100644 --- a/testing/manifest/skipfails.py +++ b/testing/manifest/skipfails.py @@ -2036,7 +2036,8 @@ class Skipfails: if not self.platform_permutations: self._fetch_platform_permutations() permutations = ( - self.platform_permutations.get(manifest, {}) + self.platform_permutations + .get(manifest, {}) .get(os, {}) .get(os_version, {}) .get(arch, None) diff --git a/testing/mochitest/mach_commands.py b/testing/mochitest/mach_commands.py index c50172e02fab..39afe6c195b5 100644 --- a/testing/mochitest/mach_commands.py +++ b/testing/mochitest/mach_commands.py @@ -611,7 +611,8 @@ def classname_for_test(test): "java", ) return ( - os.path.normpath(test) + os.path + .normpath(test) .split(os.path.normpath(test_path))[-1] .removeprefix(os.path.sep) .replace(os.path.sep, ".") diff --git a/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symbolication.py b/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symbolication.py index 8212e89e9f4e..bc3b9d184735 100644 --- a/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symbolication.py +++ b/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symbolication.py @@ -53,7 +53,8 @@ class OSXSymbolDumper: Find the list of architectures present in a Mach-O file. """ return ( - subprocess.Popen(["lipo", "-info", filename], stdout=subprocess.PIPE) + subprocess + .Popen(["lipo", "-info", filename], stdout=subprocess.PIPE) .communicate()[0] .split(b":")[2] .strip() diff --git a/testing/mozbase/mozinstall/mozinstall/mozinstall.py b/testing/mozbase/mozinstall/mozinstall/mozinstall.py index 6907596f7739..9aa727dc74e7 100644 --- a/testing/mozbase/mozinstall/mozinstall/mozinstall.py +++ b/testing/mozbase/mozinstall/mozinstall/mozinstall.py @@ -316,7 +316,8 @@ def _install_dmg(src, dest_app): # separators # Therefor, $3 should give us the mounted path app_dir = ( - subprocess.check_output( + subprocess + .check_output( f'hdiutil attach -noautoopen -nobrowse -readonly "{src}"' "| grep /Volumes/ | awk 'BEGIN{FS=\"\t\"} {print $3}'", shell=True, @@ -447,7 +448,8 @@ def _get_msix_install_location(pkg): # line. (Not in this comment, due to linting.) location = None for line in ( - subprocess.check_output(cmd) + subprocess + .check_output(cmd) .decode("utf-8") .splitlines() ): diff --git a/testing/mozbase/mozpower/mozpower/intel_power_gadget.py b/testing/mozbase/mozpower/mozpower/intel_power_gadget.py index c927dcda4dca..fdee67ff9a72 100644 --- a/testing/mozbase/mozpower/mozpower/intel_power_gadget.py +++ b/testing/mozbase/mozpower/mozpower/intel_power_gadget.py @@ -490,7 +490,8 @@ class IPGResultsHandler: # Make sure we don't have any bad line endings # contaminating the cleaned rows. fmt_row = [ - val.replace("\n", "") + val + .replace("\n", "") .replace("\t", "") .replace("\r", "") .replace("\\n", "") diff --git a/testing/mozharness/mozharness/base/vcs/mercurial.py b/testing/mozharness/mozharness/base/vcs/mercurial.py index c9ed3e3823a1..97cb05f34479 100755 --- a/testing/mozharness/mozharness/base/vcs/mercurial.py +++ b/testing/mozharness/mozharness/base/vcs/mercurial.py @@ -299,7 +299,8 @@ class MercurialVCS(ScriptMixin, LogMixin, TransferMixin): try: revs = [] for line in ( - self.get_output_from_command(cmd, cwd=src, throw_exception=True) + self + .get_output_from_command(cmd, cwd=src, throw_exception=True) .rstrip() .split("\n") ): diff --git a/testing/raptor/raptor/benchmark.py b/testing/raptor/raptor/benchmark.py index 4873de993852..cb869f025e1f 100644 --- a/testing/raptor/raptor/benchmark.py +++ b/testing/raptor/raptor/benchmark.py @@ -202,7 +202,8 @@ class Benchmark: try: # Get the default branch name, and check it if's been updated default_branch = ( - subprocess.check_output( + subprocess + .check_output( ["git", "rev-parse", "--abbrev-ref", "origin/HEAD"], cwd=external_repo_path, ) @@ -211,7 +212,8 @@ class Benchmark: .split("/")[-1] ) remote_default_branch = ( - subprocess.check_output( + subprocess + .check_output( ["git", "remote", "set-head", "origin", "-a"], cwd=external_repo_path, ) @@ -285,7 +287,8 @@ class Benchmark: else: # Make sure that the repo origin wasn't changed url = ( - subprocess.check_output( + subprocess + .check_output( ["git", "config", "--get", "remote.origin.url"], cwd=external_repo_path, ) diff --git a/testing/raptor/raptor/support_class_utils.py b/testing/raptor/raptor/support_class_utils.py index 815e7f3bcebd..e16058bf2582 100644 --- a/testing/raptor/raptor/support_class_utils.py +++ b/testing/raptor/raptor/support_class_utils.py @@ -27,9 +27,11 @@ def import_support_class(path): members = inspect.getmembers( module, - lambda c: inspect.isclass(c) - and c != BasePythonSupport - and issubclass(c, BasePythonSupport), + lambda c: ( + inspect.isclass(c) + and c != BasePythonSupport + and issubclass(c, BasePythonSupport) + ), ) if not members: diff --git a/testing/testinfo.py b/testing/testinfo.py index 73909d09e78a..9aff22f03016 100644 --- a/testing/testinfo.py +++ b/testing/testinfo.py @@ -1059,7 +1059,8 @@ class TestInfoReport(TestInfo): # skip tier-3 if ( - task.get("task", {}) + task + .get("task", {}) .get("extra", {}) .get("treeherder", {}) .get("tier", 3) diff --git a/testing/update/test_background_update.py b/testing/update/test_background_update.py index 4a5a573da9d5..459aceb159aa 100644 --- a/testing/update/test_background_update.py +++ b/testing/update/test_background_update.py @@ -93,10 +93,12 @@ class TestBackgroundUpdate(MarionetteTestCase): # Check that there is a green badge on hamburger menu Wait(self.marionette, timeout=100).until( - lambda _: self.marionette.find_element( - By.ID, "PanelUI-menu-button" - ).get_attribute("badge-status") - == "update-available" + lambda _: ( + self.marionette.find_element( + By.ID, "PanelUI-menu-button" + ).get_attribute("badge-status") + == "update-available" + ) ) # Click the update button in hamburger menu to download the update diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/input/perform_actions/pointer_mouse.py b/testing/web-platform/mozilla/tests/webdriver/bidi/input/perform_actions/pointer_mouse.py index e800b7effca8..3b6be41c92cf 100644 --- a/testing/web-platform/mozilla/tests/webdriver/bidi/input/perform_actions/pointer_mouse.py +++ b/testing/web-platform/mozilla/tests/webdriver/bidi/input/perform_actions/pointer_mouse.py @@ -47,7 +47,8 @@ async def test_click_in_display_none_frame( actions = Actions() ( - actions.add_pointer() + actions + .add_pointer() .pointer_move(x=0, y=0, origin=get_element_origin(button)) .pointer_down(button=0) .pointer_up(button=0) diff --git a/toolkit/components/gecko-trace/scripts/codegen.py b/toolkit/components/gecko-trace/scripts/codegen.py index ac3c153303a7..2f342c74bf01 100644 --- a/toolkit/components/gecko-trace/scripts/codegen.py +++ b/toolkit/components/gecko-trace/scripts/codegen.py @@ -38,7 +38,8 @@ def generate_cpp_events(output_fd, *inputs): # Generate a unique hash to prevent include guard conflicts when # multiple event files are generated and included together (e.g., in gtests). # This ensures each generated header has a distinct include guard. - input_hash=hashlib.sha256("".join(inputs).encode()) + input_hash=hashlib + .sha256("".join(inputs).encode()) .hexdigest() .upper()[:15], ) diff --git a/toolkit/components/telemetry/tests/marionette/tests/client/test_fog_user_activity.py b/toolkit/components/telemetry/tests/marionette/tests/client/test_fog_user_activity.py index 09cc44f595de..d1a21ce4e6f2 100644 --- a/toolkit/components/telemetry/tests/marionette/tests/client/test_fog_user_activity.py +++ b/toolkit/components/telemetry/tests/marionette/tests/client/test_fog_user_activity.py @@ -49,8 +49,10 @@ class TestClientActivity(FOGTestCase): [ping0, ping1] = self.wait_for_pings( self.restart_browser, - lambda ping: is_startup_baseline_ping(ping) - or ping["request_url"]["doc_type"] == "usage-reporting", + lambda ping: ( + is_startup_baseline_ping(ping) + or ping["request_url"]["doc_type"] == "usage-reporting" + ), 2, ping_server=self.fog_ping_server, ) diff --git a/toolkit/crashreporter/annotations/generate.py b/toolkit/crashreporter/annotations/generate.py index 61bec70da40a..6d4ed2c499f5 100644 --- a/toolkit/crashreporter/annotations/generate.py +++ b/toolkit/crashreporter/annotations/generate.py @@ -164,7 +164,8 @@ def emit_header(annotations, _output_name): def javadoc_sanitize(s): return ( - s.replace("<", "<") + s + .replace("<", "<") .replace(">", ">") .replace("@", "@") # Kotlin supports nested comments, so change anything that looks like the start of a block comment. diff --git a/tools/crashreporter/system-symbols/mac/PackageSymbolDumper.py b/tools/crashreporter/system-symbols/mac/PackageSymbolDumper.py index 09150fe2cedb..7eb5224cb235 100755 --- a/tools/crashreporter/system-symbols/mac/PackageSymbolDumper.py +++ b/tools/crashreporter/system-symbols/mac/PackageSymbolDumper.py @@ -141,8 +141,10 @@ def find_packages(path): @param path: root path to search for .pkg, .dmg and .zip files """ return filter_files( - lambda filename: os.path.splitext(filename)[1] in (".pkg", ".dmg", ".zip") - and not filename.startswith("._"), + lambda filename: ( + os.path.splitext(filename)[1] in (".pkg", ".dmg", ".zip") + and not filename.startswith("._") + ), path, ) diff --git a/tools/lint/android/lints.py b/tools/lint/android/lints.py index ac958c90e384..84001d0f8229 100644 --- a/tools/lint/android/lints.py +++ b/tools/lint/android/lints.py @@ -466,7 +466,8 @@ def read_lint_report(config, subdir, tasks=[], **lintargs): dir = os.path.join(topsrcdir, subdir) name = os.path.join( dir, - issue.get("locations", [{}])[0] + issue + .get("locations", [{}])[0] .get("physicalLocation", {}) .get("artifactLocation", {}) .get("uri"), @@ -490,11 +491,13 @@ def read_lint_report(config, subdir, tasks=[], **lintargs): err = { "rule": issue.get("ruleId"), "path": name, - "lineno": issue.get("locations", [{}])[0] + "lineno": issue + .get("locations", [{}])[0] .get("physicalLocation", {}) .get("region", {}) .get("startLine"), - "column": issue.get("locations", [{}])[0] + "column": issue + .get("locations", [{}])[0] .get("physicalLocation", {}) .get("region", {}) .get("startColumn"), diff --git a/tools/lint/eslint/__init__.py b/tools/lint/eslint/__init__.py index cc74e5312568..c0799d3f2317 100644 --- a/tools/lint/eslint/__init__.py +++ b/tools/lint/eslint/__init__.py @@ -142,9 +142,11 @@ def lint(paths, config, binary=None, fix=None, rules=[], setup=None, **lintargs) # as it doesn't understand those arguments. + list( filter( - lambda x: not x.startswith("--config") - and not x.startswith("--plugin") - and not x.startswith("--rule"), + lambda x: ( + not x.startswith("--config") + and not x.startswith("--plugin") + and not x.startswith("--rule") + ), [arg for arg in extra_args if bypass(arg)], ) ) diff --git a/tools/tryselect/selectors/perf.py b/tools/tryselect/selectors/perf.py index 152ddaeb569f..0f11347287ba 100644 --- a/tools/tryselect/selectors/perf.py +++ b/tools/tryselect/selectors/perf.py @@ -1648,10 +1648,12 @@ def run(**kwargs): PerfParser.run_category_checks() PerfParser.check_cached_revision([]) PerfParser.run( - profile=kwargs.get("try_config_params", {}) + profile=kwargs + .get("try_config_params", {}) .get("try_task_config", {}) .get("gecko-profile", False), - rebuild=kwargs.get("try_config_params", {}) + rebuild=kwargs + .get("try_config_params", {}) .get("try_task_config", {}) .get("rebuild", 1), **kwargs, diff --git a/tools/tryselect/selectors/perfselector/perfcomparators.py b/tools/tryselect/selectors/perfselector/perfcomparators.py index fce35fe56254..d0e1291813b6 100644 --- a/tools/tryselect/selectors/perfselector/perfcomparators.py +++ b/tools/tryselect/selectors/perfselector/perfcomparators.py @@ -242,9 +242,11 @@ def get_comparator(comparator): members = inspect.getmembers( module, - lambda c: inspect.isclass(c) - and issubclass(c, BasePerfComparator) - and c != BasePerfComparator, + lambda c: ( + inspect.isclass(c) + and issubclass(c, BasePerfComparator) + and c != BasePerfComparator + ), ) if not members: