diff --git a/build/mach_initialize.py b/build/mach_initialize.py index d05c2c170bfd..1624a0c0179f 100644 --- a/build/mach_initialize.py +++ b/build/mach_initialize.py @@ -14,7 +14,6 @@ if sys.version_info[0] < 3: class MetaPathFinder(object): pass - else: from importlib.abc import MetaPathFinder diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure index 3a321bfb9560..aa81199ab703 100644 --- a/build/moz.configure/memory.configure +++ b/build/moz.configure/memory.configure @@ -58,6 +58,7 @@ set_config("MOZ_REPLACE_MALLOC_STATIC", replace_malloc_static) # PHC (Probabilistic Heap Checker) # ============================================================== + # In general, it only makes sense for PHC to run on the platforms that have a # crash reporter. @depends( diff --git a/build/moz.configure/nspr.configure b/build/moz.configure/nspr.configure index 5c7358ca507c..182a508b735f 100644 --- a/build/moz.configure/nspr.configure +++ b/build/moz.configure/nspr.configure @@ -83,6 +83,7 @@ def pkgconf_requires_private(system_nspr, nspr_minver): set_config("PKGCONF_REQUIRES_PRIVATE", pkgconf_requires_private) + # pkg_check_modules takes care of NSPR_CFLAGS and NSPR_LIBS when using --with-system-nspr. @depends(build_environment, c_compiler, fold_libs, when=build_nspr) def nspr_config(build_env, c_compiler, fold_libs): diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index 680f8824def9..39b3bd7fa9a7 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -1033,6 +1033,7 @@ def sysroot(host_or_target, target_sysroot=None): opt = "--with-host-sysroot" env = "HOST_SYSROOT" when = depends(host)(lambda h: h.kernel == "Linux") + # Only bootstrap a host sysroot when using a bootstrapped target sysroot # or when the target doesn't use a bootstrapped sysroot in the first place. @depends(when, bootstrap_target_when, target_sysroot.bootstrapped) @@ -1731,7 +1732,6 @@ def select_linker_tmpl(host_or_target): @imports("os") @imports("shutil") def select_linker(linker, c_compiler, developer_options, toolchain_flags, target): - if linker: linker = linker[0] else: @@ -2500,6 +2500,7 @@ def cet_ldflags(c_compiler, target): set_config("MOZ_CETCOMPAT_LDFLAGS", cet_ldflags) + # Frame pointers # ============================================================== @depends(c_compiler) @@ -2785,6 +2786,7 @@ add_old_configure_assignment( "ENABLE_MOZSEARCH_PLUGIN", depends_if("--enable-mozsearch-plugin")(lambda _: True) ) + # Libstdc++ compatibility hacks # ============================================================== # @@ -2966,6 +2968,7 @@ add_old_configure_assignment("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags) # Shared library building # ============================================================== + # XXX: The use of makefile constructs in these variables is awful. @depends(target, c_compiler) def make_shared_library(target, compiler): diff --git a/build/moz.configure/update-programs.configure b/build/moz.configure/update-programs.configure index eb6818ad5670..3be098308d61 100644 --- a/build/moz.configure/update-programs.configure +++ b/build/moz.configure/update-programs.configure @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # Updater # ============================================================== @depends(build_project) diff --git a/build/unix/rewrite_sanitizer_dylib.py b/build/unix/rewrite_sanitizer_dylib.py index 2fa8a92b27f2..59198b13c8c8 100644 --- a/build/unix/rewrite_sanitizer_dylib.py +++ b/build/unix/rewrite_sanitizer_dylib.py @@ -60,7 +60,6 @@ def scan_directory(path): sys.exit(1) for file in path.rglob("*"): - if not file.is_file(): continue diff --git a/config/check_vanilla_allocations.py b/config/check_vanilla_allocations.py index 10bacd4fd3c1..32e313d38604 100644 --- a/config/check_vanilla_allocations.py +++ b/config/check_vanilla_allocations.py @@ -208,7 +208,7 @@ def main(): if f in ignored_files and (f, 2) in functions: fail(f"There should be only one {f} file") - for (filename, n) in sorted(functions): + for filename, n in sorted(functions): for fn in functions[(filename, n)]: # An allocation is present in a non-special file. Fail! fail("'" + fn + "' present in " + filename) diff --git a/config/mozunit/mozunit/mozunit.py b/config/mozunit/mozunit/mozunit.py index b295ad881f6a..28009425b636 100644 --- a/config/mozunit/mozunit/mozunit.py +++ b/config/mozunit/mozunit/mozunit.py @@ -219,7 +219,7 @@ class _MockOpen(_MockBaseOpen): content = six.ensure_binary(content or b"") return MockedBytesFile(self, name, content) else: - content = six.ensure_text(content or u"") + content = six.ensure_text(content or "") return MockedStringFile(self, name, content) diff --git a/config/tests/unit-nsinstall.py b/config/tests/unit-nsinstall.py index bfdf259e868c..7584b3827848 100644 --- a/config/tests/unit-nsinstall.py +++ b/config/tests/unit-nsinstall.py @@ -146,9 +146,9 @@ class TestNsinstall(unittest.TestCase): @unittest.skipIf(not RUN_NON_ASCII_TESTS, "Skipping non ascii tests") def test_nsinstall_non_ascii(self): "Test that nsinstall handles non-ASCII files" - filename = u"\u2325\u3452\u2415\u5081" + filename = "\u2325\u3452\u2415\u5081" testfile = self.touch(filename) - testdir = self.mkdirs(u"\u4241\u1D04\u1414") + testdir = self.mkdirs("\u4241\u1D04\u1414") self.assertEqual( nsinstall([testfile.encode("utf-8"), testdir.encode("utf-8")]), 0 ) @@ -162,9 +162,9 @@ class TestNsinstall(unittest.TestCase): ) def test_nsinstall_non_ascii_subprocess(self): "Test that nsinstall as a subprocess handles non-ASCII files" - filename = u"\u2325\u3452\u2415\u5081" + filename = "\u2325\u3452\u2415\u5081" testfile = self.touch(filename) - testdir = self.mkdirs(u"\u4241\u1D04\u1414") + testdir = self.mkdirs("\u4241\u1D04\u1414") # We don't use subprocess because it can't handle Unicode on # Windows . mozprocess calls # CreateProcessW directly so it's perfect. diff --git a/devtools/rename.py b/devtools/rename.py index 04d613742ecd..01383867e773 100644 --- a/devtools/rename.py +++ b/devtools/rename.py @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # Put the content of `filenames[0]` file into `output` file pointer def main(output, *filenames): with open(filenames[0], "r", encoding="utf-8") as f: diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index e80e9f728912..5273a76aef0f 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -381,7 +381,7 @@ def fill(template, **args): t, argModList = compile_fill_template(template) # Now apply argModList to args - for (name, modified_name, depth) in argModList: + for name, modified_name, depth in argModList: if not (args[name] == "" or args[name].endswith("\n")): raise ValueError( "Argument %s with value %r is missing a newline" % (name, args[name]) @@ -4372,7 +4372,7 @@ def InitUnforgeablePropertiesOnHolder( (defineUnforgeableAttrs, properties.unforgeableAttrs), (defineUnforgeableMethods, properties.unforgeableMethods), ] - for (template, array) in unforgeableMembers: + for template, array in unforgeableMembers: if array.hasNonChromeOnly(): unforgeables.append(CGGeneric(template % array.variableName(False))) if array.hasChromeOnly(): @@ -13021,7 +13021,6 @@ class CGUnionStruct(CGThing): return self.type.getDeps() def getStruct(self): - members = [ ClassMember("mType", "TypeOrUninit", body="eUninitialized"), ClassMember("mValue", "Value"), @@ -17065,7 +17064,6 @@ class CGDescriptor(CGThing): class CGNamespacedEnum(CGThing): def __init__(self, namespace, enumName, names, values, comment=""): - if not values: values = [] @@ -23425,7 +23423,6 @@ class GlobalGenRoots: @staticmethod def PrototypeList(config): - # Prototype ID enum. descriptorsWithPrototype = config.getDescriptors( hasInterfacePrototypeObject=True @@ -23613,7 +23610,6 @@ class GlobalGenRoots: @staticmethod def RegisterBindings(config): - curr = CGNamespace.build( ["mozilla", "dom"], CGGlobalNames(config.windowGlobalNames) ) @@ -23641,7 +23637,6 @@ class GlobalGenRoots: @staticmethod def RegisterWorkerBindings(config): - curr = CGRegisterWorkerBindings(config) # Wrap all of that in our namespaces. @@ -23668,7 +23663,6 @@ class GlobalGenRoots: @staticmethod def RegisterWorkerDebuggerBindings(config): - curr = CGRegisterWorkerDebuggerBindings(config) # Wrap all of that in our namespaces. @@ -23695,7 +23689,6 @@ class GlobalGenRoots: @staticmethod def RegisterWorkletBindings(config): - curr = CGRegisterWorkletBindings(config) # Wrap all of that in our namespaces. @@ -23722,7 +23715,6 @@ class GlobalGenRoots: @staticmethod def RegisterShadowRealmBindings(config): - curr = CGRegisterShadowRealmBindings(config) # Wrap all of that in our namespaces. diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index d7b14264d8f6..9ac55a72c4bd 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -248,7 +248,7 @@ class Configuration(DescriptorProvider): for m in t.flatMemberTypes: addUnions(m) - for (t, _) in getAllTypes(self.descriptors, self.dictionaries, self.callbacks): + for t, _ in getAllTypes(self.descriptors, self.dictionaries, self.callbacks): addUnions(t) for d in getDictionariesConvertedToJS( @@ -440,7 +440,7 @@ class Configuration(DescriptorProvider): name, ) ) - for (k, v) in firstExtAttrs.items(): + for k, v in firstExtAttrs.items(): if extAttrs[k] != v: raise TypeError( "%s on %s and %s on %s have different values for extended attribute %s, but they're using the same template %s." diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index b3976cafa067..8cad33318dcb 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -947,7 +947,6 @@ class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace): def validate(self): for member in self.members: - if member.isAttr(): if member.inherit: raise WebIDLError( @@ -3165,7 +3164,7 @@ class IDLUnionType(IDLType): return "MaybeShared" + type.name return type.name - for (i, type) in enumerate(self.memberTypes): + for i, type in enumerate(self.memberTypes): if not type.isComplete(): self.memberTypes[i] = type.complete(scope) @@ -3206,7 +3205,7 @@ class IDLUnionType(IDLType): continue i += 1 - for (i, t) in enumerate(self.flatMemberTypes[:-1]): + for i, t in enumerate(self.flatMemberTypes[:-1]): for u in self.flatMemberTypes[i + 1 :]: if not t.isDistinguishableFrom(u): raise WebIDLError( @@ -3619,7 +3618,6 @@ class IDLPromiseType(IDLParametrizedType): class IDLBuiltinType(IDLType): - Types = enum( # The integer types "byte", @@ -4287,7 +4285,7 @@ class IDLValue(IDLObject): ) elif self.type.isInteger() and type.isFloat(): # Convert an integer literal into float - if -(2 ** 24) <= self.value <= 2 ** 24: + if -(2**24) <= self.value <= 2**24: return IDLValue(self.location, type, float(self.value)) else: raise WebIDLError( @@ -4468,7 +4466,6 @@ class IDLUndefinedValue(IDLObject): class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins): - Tags = enum( "Const", "Attr", "Method", "MaplikeOrSetlike", "AsyncIterable", "Iterable" ) @@ -5791,7 +5788,7 @@ class IDLAttribute(IDLInterfaceMember): "CrossOriginWritable", "SetterThrows", ] - for (key, value) in self._extendedAttrDict.items(): + for key, value in self._extendedAttrDict.items(): if key in allowedExtAttrs: if value is not True: raise WebIDLError( @@ -5968,7 +5965,7 @@ class IDLCallback(IDLObjectWithScope): IDLObjectWithScope.__init__(self, location, parentScope, identifier) - for (returnType, arguments) in self.signatures(): + for returnType, arguments in self.signatures(): for argument in arguments: argument.resolve(self) @@ -6109,7 +6106,6 @@ class IDLMethodOverload: class IDLMethod(IDLInterfaceMember, IDLScope): - Special = enum( "Getter", "Setter", "Deleter", "LegacyCaller", base=IDLInterfaceMember.Special ) @@ -6292,7 +6288,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope): assert isinstance(parentScope, IDLScope) IDLObjectWithIdentifier.resolve(self, parentScope) IDLScope.__init__(self, self.location, parentScope, self.identifier) - for (returnType, arguments) in self.signatures(): + for returnType, arguments in self.signatures(): for argument in arguments: argument.resolve(self) @@ -6435,7 +6431,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope): variadicArgument = None arguments = overload.arguments - for (idx, argument) in enumerate(arguments): + for idx, argument in enumerate(arguments): assert argument.type.isComplete() if ( @@ -6568,8 +6564,8 @@ class IDLMethod(IDLInterfaceMember, IDLScope): def distinguishingIndexForArgCount(self, argc): def isValidDistinguishingIndex(idx, signatures): - for (firstSigIndex, (firstRetval, firstArgs)) in enumerate(signatures[:-1]): - for (secondRetval, secondArgs) in signatures[firstSigIndex + 1 :]: + for firstSigIndex, (firstRetval, firstArgs) in enumerate(signatures[:-1]): + for secondRetval, secondArgs in signatures[firstSigIndex + 1 :]: if idx < len(firstArgs): firstType = firstArgs[idx].type else: diff --git a/dom/bindings/parser/tests/test_attributes_on_types.py b/dom/bindings/parser/tests/test_attributes_on_types.py index d0a0c7a72ca5..cbd8bfb37ae4 100644 --- a/dom/bindings/parser/tests/test_attributes_on_types.py +++ b/dom/bindings/parser/tests/test_attributes_on_types.py @@ -337,7 +337,7 @@ def WebIDLTest(parser, harness): ), ] - for (name, template) in TEMPLATES: + for name, template in TEMPLATES: parser = parser.reset() threw = False try: @@ -346,7 +346,7 @@ def WebIDLTest(parser, harness): except Exception: threw = True harness.ok(not threw, "Template for %s parses without attributes" % name) - for (attribute, type) in ATTRIBUTES: + for attribute, type in ATTRIBUTES: parser = parser.reset() threw = False try: diff --git a/dom/bindings/parser/tests/test_callback_interface.py b/dom/bindings/parser/tests/test_callback_interface.py index 1396eb8a2493..cbc87e781180 100644 --- a/dom/bindings/parser/tests/test_callback_interface.py +++ b/dom/bindings/parser/tests/test_callback_interface.py @@ -94,7 +94,7 @@ def WebIDLTest(parser, harness): """ ) results = parser.finish() - for (i, iface) in enumerate(results): + for i, iface in enumerate(results): harness.check( iface.isSingleOperationInterface(), i < 4, diff --git a/dom/bindings/parser/tests/test_const.py b/dom/bindings/parser/tests/test_const.py index ea597d1ed203..22600a9946e6 100644 --- a/dom/bindings/parser/tests/test_const.py +++ b/dom/bindings/parser/tests/test_const.py @@ -64,7 +64,7 @@ def WebIDLTest(parser, harness): len(iface.members), len(expected), "Expect %s members" % len(expected) ) - for (const, (QName, name, type, value)) in zip(iface.members, expected): + for const, (QName, name, type, value) in zip(iface.members, expected): harness.ok(isinstance(const, WebIDL.IDLConst), "Should be an IDLConst") harness.ok(const.isConst(), "Const is a const") harness.ok(not const.isAttr(), "Const is not an attr") diff --git a/dom/bindings/parser/tests/test_constructor.py b/dom/bindings/parser/tests/test_constructor.py index 1e1382336ce5..84236565f644 100644 --- a/dom/bindings/parser/tests/test_constructor.py +++ b/dom/bindings/parser/tests/test_constructor.py @@ -87,7 +87,7 @@ def WebIDLTest(parser, harness): ) sigpairs = zip(method.signatures(), signatures) - for (gotSignature, expectedSignature) in sigpairs: + for gotSignature, expectedSignature in sigpairs: (gotRetType, gotArgs) = gotSignature (expectedRetType, expectedArgs) = expectedSignature diff --git a/dom/bindings/parser/tests/test_float_types.py b/dom/bindings/parser/tests/test_float_types.py index 5cb940469953..ca0b606434e7 100644 --- a/dom/bindings/parser/tests/test_float_types.py +++ b/dom/bindings/parser/tests/test_float_types.py @@ -55,7 +55,7 @@ def WebIDLTest(parser, harness): method = iface.members[6] harness.ok(isinstance(method, WebIDL.IDLMethod), "Should be an IDLMethod") argtypes = [a.type for a in method.signatures()[0][1]] - for (idx, type) in enumerate(argtypes): + for idx, type in enumerate(argtypes): harness.ok(type.isFloat(), "Type %d should be float" % idx) harness.check( type.isUnrestricted(), diff --git a/dom/bindings/parser/tests/test_method.py b/dom/bindings/parser/tests/test_method.py index e11044b74296..081190f33bc7 100644 --- a/dom/bindings/parser/tests/test_method.py +++ b/dom/bindings/parser/tests/test_method.py @@ -90,7 +90,7 @@ def WebIDLTest(parser, harness): ) sigpairs = zip(method.signatures(), signatures) - for (gotSignature, expectedSignature) in sigpairs: + for gotSignature, expectedSignature in sigpairs: (gotRetType, gotArgs) = gotSignature (expectedRetType, expectedArgs) = expectedSignature diff --git a/dom/bindings/parser/tests/test_observableArray.py b/dom/bindings/parser/tests/test_observableArray.py index 601f626bcf46..7fe9511e0749 100644 --- a/dom/bindings/parser/tests/test_observableArray.py +++ b/dom/bindings/parser/tests/test_observableArray.py @@ -4,7 +4,6 @@ def WebIDLTest(parser, harness): - # Test dictionary as inner type harness.should_throw( parser, diff --git a/dom/bindings/parser/tests/test_unenumerable_own_properties.py b/dom/bindings/parser/tests/test_unenumerable_own_properties.py index 37e016769610..e9cf1b4f55c9 100644 --- a/dom/bindings/parser/tests/test_unenumerable_own_properties.py +++ b/dom/bindings/parser/tests/test_unenumerable_own_properties.py @@ -1,5 +1,4 @@ def WebIDLTest(parser, harness): - parser.parse( """ interface Foo {}; diff --git a/dom/bindings/parser/tests/test_union.py b/dom/bindings/parser/tests/test_union.py index 675e2d026416..1991a1149c08 100644 --- a/dom/bindings/parser/tests/test_union.py +++ b/dom/bindings/parser/tests/test_union.py @@ -89,7 +89,7 @@ def WebIDLTest(parser, harness): interface PrepareForTest { """ ) - for (i, type) in enumerate(types): + for i, type in enumerate(types): interface += string.Template( """ readonly attribute ${type} attr${i}; @@ -155,7 +155,7 @@ def WebIDLTest(parser, harness): interface TestUnion { """ ) - for (i, type) in enumerate(validUnionTypes): + for i, type in enumerate(validUnionTypes): interface += string.Template( """ undefined method${i}(${type} arg); 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 index 4427d1c9c7d9..f1b9cee35b05 100644 --- a/dom/cache/test/marionette/test_caches_delete_cleanup_after_shutdown.py +++ b/dom/cache/test/marionette/test_caches_delete_cleanup_after_shutdown.py @@ -140,7 +140,6 @@ class CachesDeleteCleanupAtShutdownTestCase(MarionetteTestCase): beforeUsage = self.getUsage() def ensureCleanCallback(): - Wait(self.marionette, timeout=60).until( lambda x: (self.getUsage() - beforeUsage) < EXPECTED_CACHEDIR_SIZE_AFTER_CLEANUP, diff --git a/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py b/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py index b8f4264994b6..cfe19bf6eb19 100755 --- a/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py +++ b/dom/canvas/test/webgl-conf/generate-wrappers-and-manifest.py @@ -510,7 +510,7 @@ def LoadErrata(): ret = {} - for (sectionName, (sectionLineNum, sectionMap)) in iniMap.items(): + for sectionName, (sectionLineNum, sectionMap) in iniMap.items(): curLines = [] if sectionName is None: @@ -521,7 +521,7 @@ def LoadErrata(): sectionLineNum, sectionName ) - for (key, (lineNum, val)) in sectionMap.items(): + for key, (lineNum, val) in sectionMap.items(): assert key in ACCEPTABLE_ERRATA_KEYS, "Line {}: {}".format(lineNum, key) curLine = "{} = {}".format(key, val) diff --git a/dom/media/webrtc/transport/test/moz.build b/dom/media/webrtc/transport/test/moz.build index 69d3a587a501..a2b0bc2bc21a 100644 --- a/dom/media/webrtc/transport/test/moz.build +++ b/dom/media/webrtc/transport/test/moz.build @@ -7,7 +7,6 @@ include("/ipc/chromium/chromium-config.mozbuild") if CONFIG["OS_TARGET"] != "WINNT": - if CONFIG["OS_TARGET"] != "Android": SOURCES += [ "ice_unittest.cpp", diff --git a/dom/websocket/tests/file_websocket_wsh.py b/dom/websocket/tests/file_websocket_wsh.py index de69f747e888..65cfe39994dc 100644 --- a/dom/websocket/tests/file_websocket_wsh.py +++ b/dom/websocket/tests/file_websocket_wsh.py @@ -81,7 +81,7 @@ def web_socket_transfer_data(request): msgutil.send_message(request, six.ensure_text(resp)) elif request.ws_protocol == "test-12": msg = msgutil.receive_message(request) - if msg == u"a\ufffdb": + if msg == "a\ufffdb": # converted unpaired surrogate in UTF-16 to UTF-8 OK msgutil.send_message(request, "SUCCESS") else: diff --git a/gfx/angle/update-angle.py b/gfx/angle/update-angle.py index 57714e40d25b..029a81cbdb22 100755 --- a/gfx/angle/update-angle.py +++ b/gfx/angle/update-angle.py @@ -485,7 +485,7 @@ def export_target(target_full_name) -> Set[str]: append_arr(lines, "LOCAL_INCLUDES", fixup_paths(desc["include_dirs"])) append_arr_commented(lines, "CXXFLAGS", cxxflags) - for (config, v) in sorted_items(sources_by_config): + for config, v in sorted_items(sources_by_config): indent = 0 if config: lines.append("if {}:".format(config)) @@ -506,7 +506,7 @@ def export_target(target_full_name) -> Set[str]: append_arr(lines, "OS_LIBS", os_libs) append_arr_commented(lines, "LDFLAGS", ldflags) - for (k, v) in sorted(extras.items()): + for k, v in sorted(extras.items()): lines.append("{} = {}".format(k, v)) lib_type = desc["type"] diff --git a/gfx/thebes/gencjkcisvs.py b/gfx/thebes/gencjkcisvs.py index 1797f2be6c95..6a28e7d49208 100644 --- a/gfx/thebes/gencjkcisvs.py +++ b/gfx/thebes/gencjkcisvs.py @@ -35,7 +35,7 @@ f.close offsets = [] length = 10 + 11 * len(vsdict) -for (k, mappings) in sorted(vsdict.items()): +for k, mappings in sorted(vsdict.items()): offsets.append(length) length += 4 + 5 * len(mappings) @@ -69,10 +69,10 @@ for i, k in enumerate(sorted(vsdict.keys())): " U24(0x%04X), U32(0), U32(%d), // varSelectorRecord[%d]\n" % (k, offsets[i], i) ) -for (k, mappings) in sorted(vsdict.items()): +for k, mappings in sorted(vsdict.items()): f.write(" // 0x%04X\n" % k) f.write(" U32(%d), // numUVSMappings\n" % len(mappings)) - for (unified, compat) in sorted(mappings.items()): + for unified, compat in sorted(mappings.items()): f.write(" U24(0x%04X), GLYPH(0x%04X),\n" % (unified, compat)) f.write( """}; diff --git a/hal/moz.build b/hal/moz.build index bc13c596c0d1..f3faf43d395e 100644 --- a/hal/moz.build +++ b/hal/moz.build @@ -46,7 +46,6 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": "android/AndroidHal.cpp", ] elif CONFIG["OS_TARGET"] == "Linux": - UNIFIED_SOURCES += [ "fallback/FallbackScreenConfiguration.cpp", "fallback/FallbackSensor.cpp", diff --git a/ipc/ipdl/ipdl.py b/ipc/ipdl/ipdl.py index 1770416aaac9..230e0a213f72 100644 --- a/ipc/ipdl/ipdl.py +++ b/ipc/ipdl/ipdl.py @@ -234,7 +234,7 @@ enum IPCMessages { ) for protocol in sorted(allmessages.keys()): - for (msg, num) in allmessages[protocol].idnums: + for msg, num in allmessages[protocol].idnums: if num: print(" %s = %s," % (msg, num), file=ipc_msgtype_name) elif not msg.endswith("End"): @@ -256,7 +256,7 @@ const char* StringFromIPCMessageType(uint32_t aMessageType) ) for protocol in sorted(allmessages.keys()): - for (msg, num) in allmessages[protocol].idnums: + for msg, num in allmessages[protocol].idnums: if num or msg.endswith("End"): continue print( diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index 38ec6d1abba1..f1d51653f023 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -64,9 +64,9 @@ class LowerToCxx: def hashfunc(value): - h = hash_str(value) % 2 ** 32 + h = hash_str(value) % 2**32 if h < 0: - h += 2 ** 32 + h += 2**32 return h @@ -2275,7 +2275,7 @@ class _ParamTraits: # After non-pod data, bulk read/write pod data in member order. This has # to be done after the result has been constructed, so that we have # somewhere to read into. - for (size, fields) in itertools.groupby( + for size, fields in itertools.groupby( sd.fields_member_order(), lambda f: pod_size(f.ipdltype) ): if size != pod_size_sentinel: @@ -2517,7 +2517,7 @@ class _ComputeTypeDeps(TypeVisitor): def _fieldStaticAssertions(sd): staticasserts = [] - for (size, fields) in itertools.groupby( + for size, fields in itertools.groupby( sd.fields_member_order(), lambda f: pod_size(f.ipdltype) ): if size == pod_size_sentinel: diff --git a/ipc/ipdl/ipdl/type.py b/ipc/ipdl/ipdl/type.py index e063f2b8f940..c050b09345a0 100644 --- a/ipc/ipdl/ipdl/type.py +++ b/ipc/ipdl/ipdl/type.py @@ -1721,7 +1721,6 @@ class CheckTypes(TcheckVisitor): ) if mtype.compress and (not mtype.isAsync() or mtype.isCtor() or mtype.isDtor()): - if mtype.isCtor() or mtype.isDtor(): message_type = "constructor" if mtype.isCtor() else "destructor" error_message = ( diff --git a/ipc/pull-chromium.py b/ipc/pull-chromium.py index 4f9a7d2f7633..688098b511bc 100644 --- a/ipc/pull-chromium.py +++ b/ipc/pull-chromium.py @@ -20,11 +20,11 @@ from subprocess import check_call topsrcdir, chromiumtree, rev = sys.argv[1:] if not os.path.exists(os.path.join(topsrcdir, "client.py")): - print >>sys.stderr, "Incorrect topsrcdir" + print >> sys.stderr, "Incorrect topsrcdir" sys.exit(1) if not os.path.exists(os.path.join(chromiumtree, "src/DEPS")): - print >>sys.stderr, "Incorrect chromium directory, missing DEPS" + print >> sys.stderr, "Incorrect chromium directory, missing DEPS" sys.exit(1) check_call(["gclient", "sync", "--force", "--revision=src@%s" % rev], cwd=chromiumtree) diff --git a/js/ffi.configure b/js/ffi.configure index ec4e572c7a1b..a8a7ca1c7b9b 100644 --- a/js/ffi.configure +++ b/js/ffi.configure @@ -26,6 +26,7 @@ building_ffi = depends(system_ffi)(lambda v: v is None) set_config("MOZ_SYSTEM_FFI", depends_if(system_ffi)(lambda _: True)) + # Target selection, based on ffi/configure.ac. @depends(target, when=building_ffi) def ffi_target(target): diff --git a/js/moz.configure b/js/moz.configure index 4adc868069d6..f4a1f0dea5cd 100644 --- a/js/moz.configure +++ b/js/moz.configure @@ -173,6 +173,7 @@ def enable_decorators(value): set_config("ENABLE_DECORATORS", enable_decorators) set_define("ENABLE_DECORATORS", enable_decorators) + # JIT support # ======================================================= @depends(target, "--enable-record-tuple") @@ -506,6 +507,7 @@ set_config("JS_MASM_VERBOSE", depends_if("--enable-masm-verbose")(lambda _: True # Architecture feature flags # ======================================================= + # Apple silicon does not seem to have any way to query the OS for the JSCVT # flag stored in the ID_AA64ISAR1_EL1 system register. In the mean time, we # hard code the value of the JSCVT flag which guards the implementation of @@ -521,6 +523,7 @@ option( help="{Enable|Disable} static use of FJCVTZS instruction on Aarch64 targets.", ) + # The "ARM Architecture Reference Manual" for ARMv8 defines the JSCVT flag as # being a 4 bit integer (D12.2.52) and it can be manipulated using >= operator # (D12.1.4). @@ -549,6 +552,7 @@ def has_pthread_jit_write_protect_np(target): # JIT code write protection. set_define("JS_USE_APPLE_FAST_WX", True, when=has_pthread_jit_write_protect_np) + # CTypes # ======================================================= @depends(js_standalone) diff --git a/js/src/builtin/intl/make_intl_data.py b/js/src/builtin/intl/make_intl_data.py index ff631ce21975..7042c0a005d0 100755 --- a/js/src/builtin/intl/make_intl_data.py +++ b/js/src/builtin/intl/make_intl_data.py @@ -99,7 +99,7 @@ def writeMappingsVar(println, mapping, name, description, source, url): println("") writeMappingHeader(println, description, source, url) println("var {0} = {{".format(name)) - for (key, value) in sorted(mapping.items(), key=itemgetter(0)): + for key, value in sorted(mapping.items(), key=itemgetter(0)): println(' "{0}": "{1}",'.format(key, value)) println("};") @@ -173,7 +173,7 @@ def writeMappingsBinarySearchBody( # for the binary search, which only performs a single |memcmp| for multiple # of two subtag lengths. mappings_keys = mappings.keys() if type(mappings) == dict else mappings - for (length, subtags) in groupby(sorted(mappings_keys, key=len), len): + for length, subtags in groupby(sorted(mappings_keys, key=len), len): # Omit the length check if the current length is the maximum length. if length != tag_maxlength: println( @@ -318,7 +318,7 @@ void mozilla::intl::Locale::PerformComplexLanguageMappings() { # Merge duplicate language entries. language_aliases = {} - for (deprecated_language, (language, script, region)) in sorted( + for deprecated_language, (language, script, region) in sorted( complex_language_mappings.items(), key=itemgetter(0) ): key = (language, script, region) @@ -328,7 +328,7 @@ void mozilla::intl::Locale::PerformComplexLanguageMappings() { language_aliases[key].append(deprecated_language) first_language = True - for (deprecated_language, (language, script, region)) in sorted( + for deprecated_language, (language, script, region) in sorted( complex_language_mappings.items(), key=itemgetter(0) ): key = (language, script, region) @@ -422,7 +422,7 @@ void mozilla::intl::Locale::PerformComplexRegionMappings() { # Merge duplicate region entries. region_aliases = {} - for (deprecated_region, (default, non_default_replacements)) in sorted( + for deprecated_region, (default, non_default_replacements) in sorted( complex_region_mappings.items(), key=itemgetter(0) ): key = hash_key(default, non_default_replacements) @@ -432,7 +432,7 @@ void mozilla::intl::Locale::PerformComplexRegionMappings() { region_aliases[key].append(deprecated_region) first_region = True - for (deprecated_region, (default, non_default_replacements)) in sorted( + for deprecated_region, (default, non_default_replacements) in sorted( complex_region_mappings.items(), key=itemgetter(0) ): key = hash_key(default, non_default_replacements) @@ -587,7 +587,7 @@ bool mozilla::intl::Locale::PerformVariantMappings() { ) ) - for (deprecated_variant, (type, replacement)) in sorted( + for deprecated_variant, (type, replacement) in sorted( with_alias, key=itemgetter(0) ): println( @@ -730,7 +730,7 @@ bool mozilla::intl::Locale::UpdateLegacyMappings() { # Group the mappings by language. legacy_mappings_by_language = {} - for (type, replacement) in legacy_mappings.items(): + for type, replacement in legacy_mappings.items(): (language, _, _, _) = type legacy_mappings_by_language.setdefault(language, {})[type] = replacement @@ -820,7 +820,7 @@ bool mozilla::intl::Locale::UpdateLegacyMappings() { def hash_key(mappings): return str(sorted(mappings.items(), key=itemgetter(0))) - for (lang, mappings) in sorted( + for lang, mappings in sorted( legacy_mappings_by_language.items(), key=itemgetter(0) ): key = hash_key(mappings) @@ -848,10 +848,9 @@ bool mozilla::intl::Locale::UpdateLegacyMappings() { return len(k.split("-")) # Alias rules are applied by largest union size first. - for (size, mappings_by_size) in groupby( + for size, mappings_by_size in groupby( sorted(mappings.items(), key=variant_size, reverse=True), key=variant_size ): - # Convert grouper object to dict. mappings_by_size = dict(mappings_by_size) @@ -859,7 +858,7 @@ bool mozilla::intl::Locale::UpdateLegacyMappings() { chain_if = size == 1 # Alias rules are applied in alphabetical order - for (variants, r_language) in sorted( + for variants, r_language in sorted( mappings_by_size.items(), key=itemgetter(0) ): sorted_variants = sorted(variants.split("-")) @@ -868,7 +867,7 @@ bool mozilla::intl::Locale::UpdateLegacyMappings() { maybe_else = "else " if chain_if and not is_first else "" is_first = False - for (i, variant) in enumerate(sorted_variants): + for i, variant in enumerate(sorted_variants): println( f""" {" " * i}{maybe_else}if (auto* {variant} = findVariant("{variant}")) {{ @@ -1106,11 +1105,11 @@ def readSupplementalData(core_file): # Compute the transitive closure. # Any case which currently doesn't occur in the CLDR sources isn't supported # and will lead to throwing an error. - for (type, replacement) in rules.items(): + for type, replacement in rules.items(): (language, script, region, variants) = type (r_language, r_script, r_region, r_variants) = replacement - for (i_type, i_replacement) in rules.items(): + for i_type, i_replacement in rules.items(): (i_language, i_script, i_region, i_variants) = i_type (i_r_language, i_r_script, i_r_region, i_r_variants) = i_replacement @@ -1257,7 +1256,7 @@ def readSupplementalData(core_file): variant_mappings = {} # Preprocess all rules so we can perform a single lookup per subtag at runtime. - for (type, replacement) in rules.items(): + for type, replacement in rules.items(): (language, script, region, variants) = type (r_language, r_script, r_region, r_variants) = replacement @@ -1399,7 +1398,7 @@ def readSupplementalData(core_file): complex_region_mappings_final = {} - for (deprecated_region, replacements) in complex_region_mappings.items(): + for deprecated_region, replacements in complex_region_mappings.items(): # Find all likely subtag entries which don't already contain a region # subtag and whose target region is in the list of replacement regions. region_likely_subtags = [ @@ -2507,7 +2506,7 @@ def readICULegacyZones(icuDir): # A handful of non-IANA zones/links are not in icuzones and must be added # manually so that we won't invoke ICU with them. - for (zone, target) in otherICULegacyLinks().items(): + for zone, target in otherICULegacyLinks().items(): if zone in links: if links[zone] != target: raise KeyError( @@ -2712,7 +2711,7 @@ def processTimeZones( println("// Format:") println('// "ZoneName" // ICU-Name [time zone file]') println("const char* const ianaZonesTreatedAsLinksByICU[] = {") - for (zone, icuZone) in incorrectZones: + for zone, icuZone in incorrectZones: println(' "%s", // %s [%s]' % (zone, icuZone, zone.filename)) println("};") println("") @@ -2726,7 +2725,7 @@ def processTimeZones( println("};") println("") println("const LinkAndTarget ianaLinksCanonicalizedDifferentlyByICU[] = {") - for (zone, target, icuTarget) in incorrectLinks: + for zone, target, icuTarget in incorrectLinks: println( ' { "%s", "%s" }, // %s [%s]' % (zone, target, icuTarget, zone.filename) @@ -2796,7 +2795,7 @@ const tzMapper = [ println(description) println("const links = {") - for (zone, target) in sorted(links, key=itemgetter(0)): + for zone, target in sorted(links, key=itemgetter(0)): println(' "%s": "%s",' % (zone, target)) println("};") @@ -3150,10 +3149,10 @@ def writeCurrencyFile(published, currencies, out): */""" ) println("var currencyDigits = {") - for (currency, entries) in groupby( + for currency, entries in groupby( sorted(currencies, key=itemgetter(0)), itemgetter(0) ): - for (_, minorUnits, currencyName, countryName) in entries: + for _, minorUnits, currencyName, countryName in entries: println(" // {} ({})".format(currencyName, countryName)) println(" {}: {},".format(currency, minorUnits)) println("};") @@ -3319,7 +3318,7 @@ const char* mozilla::intl::Locale::Replace{0}ExtensionType( # Merge duplicate keys. key_aliases = {} - for (key, replacements) in sorted(mapping.items(), key=itemgetter(0)): + for key, replacements in sorted(mapping.items(), key=itemgetter(0)): hash_key = to_hash_key(replacements) if hash_key not in key_aliases: key_aliases[hash_key] = [] @@ -3327,7 +3326,7 @@ const char* mozilla::intl::Locale::Replace{0}ExtensionType( key_aliases[hash_key].append(key) first_key = True - for (key, replacements) in sorted(mapping.items(), key=itemgetter(0)): + for key, replacements in sorted(mapping.items(), key=itemgetter(0)): hash_key = to_hash_key(replacements) if key in key_aliases[hash_key]: continue @@ -3368,7 +3367,7 @@ const char* mozilla::intl::Locale::Replace{0}ExtensionType( ) ) else: - for (type, replacement) in replacements: + for type, replacement in replacements: println( """ if (Is{}Type(type, "{}")) {{ diff --git a/js/src/devtools/gc/gc-test.py b/js/src/devtools/gc/gc-test.py index 9b8fbc25b1e2..80a8d78b7700 100644 --- a/js/src/devtools/gc/gc-test.py +++ b/js/src/devtools/gc/gc-test.py @@ -166,7 +166,7 @@ if __name__ == "__main__": test_list = find_tests(test_dir) if not test_list: - print >>sys.stderr, "No tests found matching command line arguments." + print >> sys.stderr, "No tests found matching command line arguments." sys.exit(0) test_list = [Test.from_file(tst, name, OPTIONS) for tst, name in test_list] @@ -178,7 +178,7 @@ if __name__ == "__main__": except OSError: if not os.path.exists(JS): - print >>sys.stderr, "JS shell argument: file does not exist: '%s'" % JS + print >> sys.stderr, "JS shell argument: file does not exist: '%s'" % JS sys.exit(1) else: raise diff --git a/js/src/devtools/rootAnalysis/analyze.py b/js/src/devtools/rootAnalysis/analyze.py index ab1d04c2a801..dd37991d4100 100755 --- a/js/src/devtools/rootAnalysis/analyze.py +++ b/js/src/devtools/rootAnalysis/analyze.py @@ -212,7 +212,7 @@ JOBS = { # - item is command[j] def out_indexes(command): i = 0 - for (j, fragment) in enumerate(command): + for j, fragment in enumerate(command): if isinstance(fragment, Output): yield (i, j, fragment) i += 1 @@ -221,7 +221,7 @@ def out_indexes(command): def job_command_with_final_output_names(job): outfiles = job.get("outputs", []) command = list(job["command"]) - for (i, j, name) in out_indexes(job["command"]): + for i, j, name in out_indexes(job["command"]): command[j] = outfiles[i] return command @@ -256,7 +256,7 @@ def run_job(name, config): info["redirect"].close() # Rename the temporary files to their final names. - for (temp, final) in info["rename_map"].items(): + for temp, final in info["rename_map"].items(): try: if config["verbose"] > 1: print("Renaming %s -> %s" % (temp, final)) @@ -285,7 +285,7 @@ def spawn_command(cmdspec, job, name, config): # from those temp names to their actual final names that will be used # if the command succeeds. command = list(cmdspec) - for (i, j, raw_name) in out_indexes(cmdspec): + for i, j, raw_name in out_indexes(cmdspec): [name] = fill([raw_name], config) command[j] = "{}.tmp{}".format(name, config.get("i", "")) rename_map[command[j]] = outfiles[i] @@ -305,7 +305,7 @@ def spawn_command(cmdspec, job, name, config): # Default to conservatively assuming 4GB/job. -def max_parallel_jobs(job_size=4 * 2 ** 30): +def max_parallel_jobs(job_size=4 * 2**30): """Return the max number of parallel jobs we can run without overfilling memory, assuming heavyweight jobs.""" from_cores = int(subprocess.check_output(["nproc", "--ignore=1"]).strip()) @@ -434,7 +434,7 @@ for step in steps: elif "outputs" in job and "command" in job: outfiles = job["outputs"] num_outputs = 0 - for (i, j, name) in out_indexes(job["command"]): + for i, j, name in out_indexes(job["command"]): # Trim the {curly brackets} off of the output keys. data[name[1:-1]] = outfiles[i] num_outputs += 1 diff --git a/js/src/devtools/rootAnalysis/t/sixgill.py b/js/src/devtools/rootAnalysis/t/sixgill.py index 0b8c2c7073db..307f13fae579 100644 --- a/js/src/devtools/rootAnalysis/t/sixgill.py +++ b/js/src/devtools/rootAnalysis/t/sixgill.py @@ -35,7 +35,7 @@ class Body(dict): src, dst = edge["Index"] self["SrcPoint2Edges"][src].append(edge) self["Line2Edges"] = defaultdict(list) - for (src, edges) in self["SrcPoint2Edges"].items(): + for src, edges in self["SrcPoint2Edges"].items(): line = self["Points"][src] self["Line2Edges"][line].extend(edges) diff --git a/js/src/gdb/mozilla/CellHeader.py b/js/src/gdb/mozilla/CellHeader.py index cb667b3ad0ea..21dcba849d05 100644 --- a/js/src/gdb/mozilla/CellHeader.py +++ b/js/src/gdb/mozilla/CellHeader.py @@ -21,5 +21,5 @@ def get_header_length_and_flags(value, cache): # If we couldn't fetch the length directly, it must be stored # within `flags`. length = flags >> 32 - flags = flags % 2 ** 32 + flags = flags % 2**32 return length, flags diff --git a/js/src/gdb/mozilla/jsval.py b/js/src/gdb/mozilla/jsval.py index d01a5ceacc41..ffabf6004f16 100644 --- a/js/src/gdb/mozilla/jsval.py +++ b/js/src/gdb/mozilla/jsval.py @@ -120,7 +120,7 @@ class JSValueTypeCache(object): # the i'th magic value. d = gdb.types.make_enum_dict(gdb.lookup_type("JSWhyMagic")) self.magic_names = list(range(max(d.values()) + 1)) - for (k, v) in d.items(): + for k, v in d.items(): self.magic_names[v] = k # Choose an unboxing scheme for this architecture. diff --git a/js/src/gdb/mozilla/prettyprinters.py b/js/src/gdb/mozilla/prettyprinters.py index 130e7d847c65..b533d1f1f52f 100644 --- a/js/src/gdb/mozilla/prettyprinters.py +++ b/js/src/gdb/mozilla/prettyprinters.py @@ -137,7 +137,7 @@ def clear_module_printers(module_name): # should remove. (It's not safe to delete entries from a dictionary # while we're iterating over it.) to_delete = [] - for (k, v) in d.items(): + for k, v in d.items(): if v.__module__ == module_name: to_delete.append(k) remove_from_subprinter_list(v) @@ -250,7 +250,6 @@ class TypeCache(object): def implemented_types(t): - # Yield all types that follow |t|. def followers(t): if t.code == gdb.TYPE_CODE_TYPEDEF: @@ -346,7 +345,7 @@ def lookup_for_objfile(objfile): # to scan the whole list, so regexp printers should be used # sparingly. s = str(value.type) - for (r, f) in printers_by_regexp: + for r, f in printers_by_regexp: if f.enabled: m = r.match(s) if m: diff --git a/js/src/gdb/run-tests.py b/js/src/gdb/run-tests.py index e1d18dc71015..cb9501e90485 100644 --- a/js/src/gdb/run-tests.py +++ b/js/src/gdb/run-tests.py @@ -114,7 +114,6 @@ class Summary(object): self.bar.finish() if self.failures: - print("tests failed:") for test in self.failures: test.show(sys.stdout) diff --git a/js/src/tests/lib/jittests.py b/js/src/tests/lib/jittests.py index 9eaa0bf168dc..060b54f73f04 100755 --- a/js/src/tests/lib/jittests.py +++ b/js/src/tests/lib/jittests.py @@ -92,7 +92,6 @@ def extend_condition(condition, value): class JitTest: - VALGRIND_CMD = [] paths = (d for d in os.environ["PATH"].split(os.pathsep)) valgrinds = (os.path.join(d, "valgrind") for d in paths) @@ -488,7 +487,7 @@ def check_output(out, err, rc, timed_out, test, options): # Python 3 on Windows interprets process exit codes as unsigned # integers, where Python 2 used to allow signed integers. Account for # each possibility here. - if sys.platform == "win32" and rc in (3 - 2 ** 31, 3 + 2 ** 31): + if sys.platform == "win32" and rc in (3 - 2**31, 3 + 2**31): return True if sys.platform != "win32" and rc == -11: diff --git a/js/src/tests/lib/remote.py b/js/src/tests/lib/remote.py index 71cedf42ec8a..015a351a3b23 100644 --- a/js/src/tests/lib/remote.py +++ b/js/src/tests/lib/remote.py @@ -73,7 +73,7 @@ def init_device(options): context = MozbuildObject.from_environment() adb_path = get_adb_path(context) - except (ImportError): + except ImportError: adb_path = "adb" DEVICE = ADBDeviceFactory( diff --git a/js/src/tests/lib/results.py b/js/src/tests/lib/results.py index f90206035427..9c623b863fbf 100644 --- a/js/src/tests/lib/results.py +++ b/js/src/tests/lib/results.py @@ -80,7 +80,7 @@ class TestResult: harness_message = "Exit code reported crash" tests = [] else: - for (idx, line) in enumerate(stdout): + for idx, line in enumerate(stdout): if line.startswith("WPT OUTPUT: "): msg = line[len("WPT OUTPUT: ") :] data = [output.test.wpt.url] + json.loads(msg) diff --git a/js/src/tests/lib/tasks_unix.py b/js/src/tests/lib/tasks_unix.py index bf47695a7f94..36761f30f5a7 100644 --- a/js/src/tests/lib/tasks_unix.py +++ b/js/src/tests/lib/tasks_unix.py @@ -118,7 +118,7 @@ def read_input(tasks, timeout): try: readable, _, _ = select.select(rlist, [], exlist, timeout) except OverflowError: - print >>sys.stderr, "timeout value", timeout + print >> sys.stderr, "timeout value", timeout raise for fd in readable: diff --git a/js/src/tests/test262-export.py b/js/src/tests/test262-export.py index ebcb388a29be..477db883ea96 100755 --- a/js/src/tests/test262-export.py +++ b/js/src/tests/test262-export.py @@ -299,7 +299,7 @@ def insertMeta(source, frontmatter): lines.append("/*---") - for (key, value) in frontmatter.items(): + for key, value in frontmatter.items(): if key in ("description", "info"): lines.append("%s: |" % key) lines.append( @@ -336,7 +336,6 @@ def findAndCopyIncludes(dirPath, baseDir, includeDir): # we reach the base directory of shell.js include files. # Each directory will have a shell.js file to copy. while relPath: - # find the shell.js shellFile = os.path.join(baseDir, relPath, "shell.js") @@ -367,7 +366,6 @@ def findAndCopyIncludes(dirPath, baseDir, includeDir): def exportTest262(args): - outDir = os.path.abspath(args.out) providedSrcs = args.src includeShell = args.exportshellincludes @@ -384,15 +382,13 @@ def exportTest262(args): # Go through each source path for providedSrc in providedSrcs: - src = os.path.abspath(providedSrc) # the basename of the path will be used in case multiple "src" arguments # are passed in to create an output directory for each "src". basename = os.path.basename(src) # Process all test directories recursively. - for (dirPath, _, fileNames) in os.walk(src): - + for dirPath, _, fileNames in os.walk(src): # we need to make and get the unique set of includes for this filepath includes = [] if includeShell: diff --git a/js/src/tests/test262-update.py b/js/src/tests/test262-update.py index 5939c8936775..4027654c3c6c 100755 --- a/js/src/tests/test262-update.py +++ b/js/src/tests/test262-update.py @@ -511,7 +511,7 @@ def process_test262(test262Dir, test262OutDir, strictTests, externManifests): explicitIncludes[os.path.join("built-ins", "Temporal")] = ["temporalHelpers.js"] # Process all test directories recursively. - for (dirPath, dirNames, fileNames) in os.walk(testDir): + for dirPath, dirNames, fileNames in os.walk(testDir): relPath = os.path.relpath(dirPath, testDir) if relPath == ".": continue @@ -554,7 +554,7 @@ def process_test262(test262Dir, test262OutDir, strictTests, externManifests): test262parser, testSource, testName, includeSet, strictTests ) - for (newFileName, newSource, externRefTest) in convert: + for newFileName, newSource, externRefTest in convert: writeTestFile(test262OutDir, newFileName, newSource) if externRefTest is not None: diff --git a/js/src/util/make_unicode.py b/js/src/util/make_unicode.py index 617268fa9cb7..6ddecd6cbb44 100755 --- a/js/src/util/make_unicode.py +++ b/js/src/util/make_unicode.py @@ -202,7 +202,7 @@ def int_ranges(ints): """Yields consecutive ranges (inclusive) from integer values.""" (a, b) = tee(sorted(ints)) start = next(b) - for (curr, succ) in zip_longest(a, b): + for curr, succ in zip_longest(a, b): if curr + 1 != succ: yield (start, curr) start = succ @@ -280,7 +280,7 @@ def process_derived_core_properties(derived_core_properties): id_start = set() id_continue = set() - for (char, prop) in read_derived_core_properties(derived_core_properties): + for char, prop in read_derived_core_properties(derived_core_properties): if prop == "ID_Start": id_start.add(char) if prop == "ID_Continue": @@ -399,7 +399,7 @@ def process_case_folding(case_folding): folding_tests = [] folding_codes = set() - for (code, mapping) in read_case_folding(case_folding): + for code, mapping in read_case_folding(case_folding): folding_map[code] = mapping if mapping not in rev_folding_map: @@ -466,9 +466,7 @@ def process_special_casing(special_casing, table, index): (upper, lower, flags) = table[index[code]] return ((code + lower) & 0xFFFF, (code + upper) & 0xFFFF) - for (code, lower, upper, languages, contexts) in read_special_casing( - special_casing - ): + for code, lower, upper, languages, contexts in read_special_casing(special_casing): assert code <= MAX_BMP, "Unexpected character outside of BMP: %s" % code assert len(languages) <= 1, "Expected zero or one language ids: %s" % languages assert len(contexts) <= 1, ( @@ -686,7 +684,7 @@ def write_special_casing_methods(unconditional_toupper, codepoint_table, println def describe_range(ranges, depth): indent = depth * " " - for (start, end) in ranges: + for start, end in ranges: if start == end: println(indent, "// {}".format(codepoint_table.full_name(start))) else: @@ -715,7 +713,7 @@ def write_special_casing_methods(unconditional_toupper, codepoint_table, println def in_any_range(ranges, spaces): """Tests if the input character is included in any of the given ranges.""" lines = [[]] - for (start, end) in ranges: + for start, end in ranges: expr = in_range(start, end, parenthesize=True) line = " || ".join(lines[-1] + [expr]) if len(line) < (100 - len(spaces) - len(" ||")): @@ -836,9 +834,7 @@ def write_special_casing_methods(unconditional_toupper, codepoint_table, println println("{") println(" switch(ch) {") - for (code, converted) in sorted( - unconditional_toupper.items(), key=itemgetter(0) - ): + for code, converted in sorted(unconditional_toupper.items(), key=itemgetter(0)): println( " case {}: return {}; // {}".format( hexlit(code), len(converted), codepoint_table.name(code) @@ -860,9 +856,7 @@ def write_special_casing_methods(unconditional_toupper, codepoint_table, println println("{") println(" switch(ch) {") - for (code, converted) in sorted( - unconditional_toupper.items(), key=itemgetter(0) - ): + for code, converted in sorted(unconditional_toupper.items(), key=itemgetter(0)): println( " case {}: // {}".format(hexlit(code), codepoint_table.name(code)) ) @@ -1306,7 +1300,7 @@ def make_unicode_file( println("bool") println("js::unicode::{}(char32_t codePoint)".format(name)) println("{") - for (from_code, to_code) in int_ranges(group_set.keys()): + for from_code, to_code in int_ranges(group_set.keys()): println( " if (codePoint >= 0x{:X} && codePoint <= 0x{:X}) {{ // {} .. {}".format( from_code, @@ -1381,7 +1375,7 @@ def make_unicode_file( def getsize(data): """return smallest possible integer size for the given array""" maxdata = max(data) - assert maxdata < 2 ** 32 + assert maxdata < 2**32 if maxdata < 256: return 1 @@ -1421,7 +1415,7 @@ def splitbins(t): for shift in range(maxshift + 1): t1 = [] t2 = [] - size = 2 ** shift + size = 2**shift bincache = {} for i in range(0, len(t), size): @@ -1445,7 +1439,7 @@ def splitbins(t): dump(t1, t2, shift, bytes) # exhaustively verify that the decomposition is correct - mask = 2 ** shift - 1 + mask = 2**shift - 1 for i in range(len(t)): assert t[i] == t2[(t1[i >> shift] << shift) + (i & mask)] return best diff --git a/js/src/vm/jsopcode.py b/js/src/vm/jsopcode.py index dac69d2f60a5..269ce68dfe3b 100644 --- a/js/src/vm/jsopcode.py +++ b/js/src/vm/jsopcode.py @@ -139,7 +139,7 @@ class OpcodeInfo: def find_by_name(list, name): - for (n, body) in list: + for n, body in list: if n == name: return body diff --git a/js/src/vm/make_opcode_doc.py b/js/src/vm/make_opcode_doc.py index 11ce81a3ed59..f84cf63c660f 100755 --- a/js/src/vm/make_opcode_doc.py +++ b/js/src/vm/make_opcode_doc.py @@ -165,13 +165,13 @@ def print_doc(index): ) ) - for (category_name, types) in index: + for category_name, types in index: print( '

{name}

'.format( name=category_name, id=make_element_id(category_name) ) ) - for (type_name, opcodes) in types: + for type_name, opcodes in types: if type_name: print( '

{name}

'.format( diff --git a/layout/reftests/border-image/gen-refs.py b/layout/reftests/border-image/gen-refs.py index 029d46f2a899..1e8bc6c650f9 100644 --- a/layout/reftests/border-image/gen-refs.py +++ b/layout/reftests/border-image/gen-refs.py @@ -197,6 +197,7 @@ class Tile: # 3 4 5 # 6 7 8 + # Compute the source tiles' slice and border-width sizes def make_src_tiles(): tiles = [Tile() for i in range(9)] diff --git a/layout/reftests/fonts/gsubtest/makegsubfonts.py b/layout/reftests/fonts/gsubtest/makegsubfonts.py index 73d022e6be2b..8cd6476d9756 100644 --- a/layout/reftests/fonts/gsubtest/makegsubfonts.py +++ b/layout/reftests/fonts/gsubtest/makegsubfonts.py @@ -124,7 +124,6 @@ def makeLookup1(): # build the outline, hmtx and cmap data cp = baseCodepoint for index, tag in enumerate(features): - # tag.pass glyphName = "%s.pass" % tag glyphOrder.append(glyphName) @@ -303,7 +302,6 @@ def makeLookup3(): # build the outline, hmtx and cmap data cp = baseCodepoint for index, tag in enumerate(features): - # tag.pass glyphName = "%s.pass" % tag glyphOrder.append(glyphName) diff --git a/layout/reftests/fonts/mark-generate.py b/layout/reftests/fonts/mark-generate.py index 01e2d005480a..85f56a8a2e7f 100755 --- a/layout/reftests/fonts/mark-generate.py +++ b/layout/reftests/fonts/mark-generate.py @@ -20,7 +20,7 @@ import fontforge # generate a set of fonts, each with our special glyph at one codepoint, # and nothing else for codepoint in range(ord("A"), ord("D") + 1): - for (mark, width) in [("", 1500), ("2", 1800)]: + for mark, width in [("", 1500), ("2", 1800)]: charname = chr(codepoint) f = fontforge.font() n = "Mark" + mark + charname @@ -41,8 +41,8 @@ for codepoint in range(ord("A"), ord("D") + 1): for codepoint in range(ord("A"), ord("A") + 1): - for (mark, width) in [("", 1500), ("2", 1800)]: - for (uposname, upos) in [("low", -350), ("high", -50)]: + for mark, width in [("", 1500), ("2", 1800)]: + for uposname, upos in [("low", -350), ("high", -50)]: charname = chr(codepoint) f = fontforge.font() n = "Mark" + mark + charname diff --git a/layout/style/GenerateCSSPropsGenerated.py b/layout/style/GenerateCSSPropsGenerated.py index ed2be4fa945f..90ed79219439 100644 --- a/layout/style/GenerateCSSPropsGenerated.py +++ b/layout/style/GenerateCSSPropsGenerated.py @@ -62,7 +62,7 @@ def generate(output, dataFile): "const int32_t nsCSSProps::" "kIDLNameSortPositionTable[eCSSProperty_COUNT] = {\n" ) - for (p, position) in ps: + for p, position in ps: output.write(" {},\n".format(position)) output.write("};\n\n") diff --git a/layout/tools/reftest/mach_commands.py b/layout/tools/reftest/mach_commands.py index bd99ac439365..8cb116433252 100644 --- a/layout/tools/reftest/mach_commands.py +++ b/layout/tools/reftest/mach_commands.py @@ -134,7 +134,7 @@ class ReftestRunner(MozbuildObject): hyphenation_path = os.path.join(self.topsrcdir, "intl", "locales") - for (dirpath, dirnames, filenames) in os.walk(hyphenation_path): + for dirpath, dirnames, filenames in os.walk(hyphenation_path): for filename in filenames: if filename.endswith(".dic"): args.extraProfileFiles.append(os.path.join(dirpath, filename)) diff --git a/layout/tools/reftest/runreftest.py b/layout/tools/reftest/runreftest.py index 36af4acd858b..1c85d2a65b53 100644 --- a/layout/tools/reftest/runreftest.py +++ b/layout/tools/reftest/runreftest.py @@ -106,7 +106,6 @@ if sys.version_info[0] == 3: raise value_.with_traceback(tb_) raise value_ - else: exec("def reraise_(tp_, value_, tb_=None):\n raise tp_, value_, tb_\n") @@ -652,13 +651,13 @@ class RefTest(object): ] stepResults = {} - for (descr, step) in steps: + for descr, step in steps: stepResults[descr] = "not run / incomplete" startTime = datetime.now() maxTime = timedelta(seconds=options.verify_max_time) finalResult = "PASSED" - for (descr, step) in steps: + for descr, step in steps: if (datetime.now() - startTime) > maxTime: self.log.info("::: Test verification is taking too long: Giving up!") self.log.info( @@ -730,7 +729,7 @@ class RefTest(object): # First job is only needs-focus tests. Remaining jobs are # non-needs-focus and chunked. perProcessArgs[0].insert(-1, "--focus-filter-mode=needs-focus") - for (chunkNumber, jobArgs) in enumerate(perProcessArgs[1:], start=1): + for chunkNumber, jobArgs in enumerate(perProcessArgs[1:], start=1): jobArgs[-1:-1] = [ "--focus-filter-mode=non-needs-focus", "--total-chunks=%d" % jobsWithoutFocus, @@ -770,16 +769,16 @@ class RefTest(object): # Output the summaries that the ReftestThread filters suppressed. summaryObjects = [defaultdict(int) for s in summaryLines] for t in threads: - for (summaryObj, (text, categories)) in zip(summaryObjects, summaryLines): + for summaryObj, (text, categories) in zip(summaryObjects, summaryLines): threadMatches = t.summaryMatches[text] - for (attribute, description) in categories: + for attribute, description in categories: amount = int(threadMatches.group(attribute) if threadMatches else 0) summaryObj[attribute] += amount amount = int(threadMatches.group("total") if threadMatches else 0) summaryObj["total"] += amount print("REFTEST INFO | Result summary:") - for (summaryObj, (text, categories)) in zip(summaryObjects, summaryLines): + for summaryObj, (text, categories) in zip(summaryObjects, summaryLines): details = ", ".join( [ "%d %s" % (summaryObj[attribute], description) @@ -863,7 +862,6 @@ class RefTest(object): valgrindSuppFiles=None, **profileArgs ): - if cmdargs is None: cmdargs = [] cmdargs = cmdargs[:] diff --git a/media/highway/moz.build b/media/highway/moz.build index 67de5725f64a..58b4f96eef1d 100644 --- a/media/highway/moz.build +++ b/media/highway/moz.build @@ -9,7 +9,6 @@ LOCAL_INCLUDES += [ ] if CONFIG["CPU_ARCH"] == "ppc64" and CONFIG["OS_TARGET"] == "Linux": - DEFINES["TOOLCHAIN_MISS_ASM_HWCAP_H"] = True SOURCES += [ diff --git a/memory/replace/dmd/dmd.py b/memory/replace/dmd/dmd.py index ae772d15ff28..3e20d8d6bd94 100755 --- a/memory/replace/dmd/dmd.py +++ b/memory/replace/dmd/dmd.py @@ -859,6 +859,7 @@ def prettyPrintDmdJson(out, j): # Code for clamping addresses using conservative pointer analysis. ################################################################## + # Start is the address of the first byte of the block, while end is # the address of the first byte after the final byte in the block. class AddrRange: diff --git a/mobile/android/gradle.configure b/mobile/android/gradle.configure index 09c69e124a6c..557f16c4361e 100644 --- a/mobile/android/gradle.configure +++ b/mobile/android/gradle.configure @@ -555,6 +555,7 @@ set_config( @imports(_from="itertools", _import="chain") def gradle_android_dependencies_tasks(*tasks): """Gradle tasks run by |mach android dependencies|.""" + # The union, plus a bit more, of all of the Gradle tasks # invoked by the android-* automation jobs. def withoutGeckoBinaries(task): diff --git a/mobile/android/mach_commands.py b/mobile/android/mach_commands.py index b767f10f9a3d..1285095bd4bf 100644 --- a/mobile/android/mach_commands.py +++ b/mobile/android/mach_commands.py @@ -329,7 +329,6 @@ def android_geckoview_docs( javadoc_path, upload_message, ): - tasks = ( command_context.substs["GRADLE_ANDROID_GECKOVIEW_DOCS_ARCHIVE_TASKS"] if archive or upload diff --git a/modules/libpref/test/test_generate_static_pref_list.py b/modules/libpref/test/test_generate_static_pref_list.py index 2c8797099e65..ef4c9d28caa6 100644 --- a/modules/libpref/test/test_generate_static_pref_list.py +++ b/modules/libpref/test/test_generate_static_pref_list.py @@ -479,7 +479,7 @@ class TestGenerateStaticPrefList(unittest.TestCase): def test_bad(self): "Test various pieces of bad input." - for (input_string, expected) in bad_inputs: + for input_string, expected in bad_inputs: inp = StringIO(input_string) try: pref_list = yaml.safe_load(inp) diff --git a/moz.configure b/moz.configure index a934c814b92a..a970eed3cd4f 100755 --- a/moz.configure +++ b/moz.configure @@ -956,7 +956,6 @@ def save_cache(build_environment, configure_cache): @imports("glob") @imports(_from="os.path", _import="exists") def config_status_deps(build_env, build_project): - topsrcdir = build_env.topsrcdir topobjdir = build_env.topobjdir diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build index fe195739e2ee..5ad727554d52 100644 --- a/mozglue/build/moz.build +++ b/mozglue/build/moz.build @@ -58,7 +58,6 @@ if CONFIG["OS_TARGET"] == "WINNT": ] if CONFIG["MOZ_WIDGET_TOOLKIT"]: - if CONFIG["MOZ_MEMORY"] and FORCE_SHARED_LIB: pass # TODO: SHARED_LIBRARY_LIBS go here diff --git a/python/gdbpp/gdbpp/enumset.py b/python/gdbpp/gdbpp/enumset.py index c36e863627dd..71315389c1b7 100644 --- a/python/gdbpp/gdbpp/enumset.py +++ b/python/gdbpp/gdbpp/enumset.py @@ -21,7 +21,7 @@ class enumset_printer(object): return ( ("flag", gdb.Value(i).cast(self.enum_type)) for i in range(0, max_bit) - if ((bitfield & (2 ** i)) != 0) + if ((bitfield & (2**i)) != 0) ) def to_string(self): diff --git a/python/l10n/mozxchannel/projectconfig.py b/python/l10n/mozxchannel/projectconfig.py index 23d8120a3c5c..85515465417e 100644 --- a/python/l10n/mozxchannel/projectconfig.py +++ b/python/l10n/mozxchannel/projectconfig.py @@ -21,23 +21,23 @@ def process_config(toml_content): if not new_base: new_base = b"." # relpath to '.' is '', sadly base_line = b'\nbasepath = "%s"' % new_base - content1 = re.sub(br"^\s*basepath\s*=\s*.+", base_line, toml_content, flags=re.M) + content1 = re.sub(rb"^\s*basepath\s*=\s*.+", base_line, toml_content, flags=re.M) # process [[paths]] start = 0 content2 = b"" for m in re.finditer( - br"\[\[\s*paths\s*\]\].+?(?=\[|\Z)", content1, re.M | re.DOTALL + rb"\[\[\s*paths\s*\]\].+?(?=\[|\Z)", content1, re.M | re.DOTALL ): content2 += content1[start : m.start()] path_content = m.group() - l10n_line = re.search(br"^\s*l10n\s*=.*$", path_content, flags=re.M).group() + l10n_line = re.search(rb"^\s*l10n\s*=.*$", path_content, flags=re.M).group() # remove variable expansions - new_reference = re.sub(br"{\s*\S+\s*}", b"", l10n_line) + new_reference = re.sub(rb"{\s*\S+\s*}", b"", l10n_line) # make the l10n a reference line - new_reference = re.sub(br"^(\s*)l10n(\s*=)", br"\1reference\2", new_reference) + new_reference = re.sub(rb"^(\s*)l10n(\s*=)", rb"\1reference\2", new_reference) content2 += re.sub( - br"^\s*reference\s*=.*$", new_reference, path_content, flags=re.M + rb"^\s*reference\s*=.*$", new_reference, path_content, flags=re.M ) start = m.end() content2 += content1[start:] @@ -45,11 +45,11 @@ def process_config(toml_content): start = 0 content3 = b"" for m in re.finditer( - br"\[\[\s*includes\s*\]\].+?(?=\[|\Z)", content2, re.M | re.DOTALL + rb"\[\[\s*includes\s*\]\].+?(?=\[|\Z)", content2, re.M | re.DOTALL ): content3 += content2[start : m.start()] include_content = m.group() - m_ = re.search(br'^\s*path = "(.+?)"', include_content, flags=re.M) + m_ = re.search(rb'^\s*path = "(.+?)"', include_content, flags=re.M) content3 += ( include_content[: m_.start(1)] + generate_filename(m_.group(1)) diff --git a/python/mach/mach/commands/commandinfo.py b/python/mach/mach/commands/commandinfo.py index 12c4b240ea15..4b5671b035ce 100644 --- a/python/mach/mach/commands/commandinfo.py +++ b/python/mach/mach/commands/commandinfo.py @@ -452,7 +452,6 @@ def completion_fish(command_context, outfile): cmds_opts.append(comp) for sub in cmd.subcommands: - for opt_strs, description in sub.options.items(): comp = ( "complete -c mach -A -n '__fish_mach_complete_subcommand {} {}' " diff --git a/python/mach/mach/sentry.py b/python/mach/mach/sentry.py index 5008f8a40cc8..891ab33e665b 100644 --- a/python/mach/mach/sentry.py +++ b/python/mach/mach/sentry.py @@ -137,7 +137,7 @@ def _patch_absolute_paths(sentry_event, topsrcdir: Path): else: return value - for (target_path, replacement) in ( + for target_path, replacement in ( (get_state_dir(), ""), (str(topsrcdir), ""), (str(Path.home()), "~"), diff --git a/python/mozbuild/mozbuild/action/process_install_manifest.py b/python/mozbuild/mozbuild/action/process_install_manifest.py index faf1376dba96..89b2f89c0170 100644 --- a/python/mozbuild/mozbuild/action/process_install_manifest.py +++ b/python/mozbuild/mozbuild/action/process_install_manifest.py @@ -23,7 +23,6 @@ COMPLETE = ( def process_manifest(destdir, paths, track, no_symlinks=False, defines={}): - if os.path.exists(track): # We use the same format as install manifests for the tracking # data. diff --git a/python/mozbuild/mozbuild/action/tooltool.py b/python/mozbuild/mozbuild/action/tooltool.py index 350d35a21302..6b53db31e8cc 100755 --- a/python/mozbuild/mozbuild/action/tooltool.py +++ b/python/mozbuild/mozbuild/action/tooltool.py @@ -648,7 +648,6 @@ class FileRecordJSONDecoder(json.JSONDecoder): class Manifest(object): - valid_formats = ("json",) def __init__(self, file_records=None): diff --git a/python/mozbuild/mozbuild/action/xpccheck.py b/python/mozbuild/mozbuild/action/xpccheck.py index 4b59577cce96..b576ea4f6486 100644 --- a/python/mozbuild/mozbuild/action/xpccheck.py +++ b/python/mozbuild/mozbuild/action/xpccheck.py @@ -62,7 +62,6 @@ def verifyIniFile(initests, directory): found = False for f in files: - fname = f.split("/")[-1] if fname.endswith(".in"): fname = ".in".join(fname.split(".in")[:-1]) diff --git a/python/mozbuild/mozbuild/android_version_code.py b/python/mozbuild/mozbuild/android_version_code.py index aa13609a7a61..3b4025bec758 100644 --- a/python/mozbuild/mozbuild/android_version_code.py +++ b/python/mozbuild/mozbuild/android_version_code.py @@ -104,13 +104,13 @@ def android_version_code_v1(buildid, cpu_arch=None, min_sdk=0, max_sdk=0): "android:versionCode from build ID %s: hours underflow " "bits allotted!" % buildid ) - if base > 2 ** 17: + if base > 2**17: raise ValueError( "Something has gone horribly wrong: cannot calculate " "android:versionCode from build ID %s: hours overflow " "bits allotted!" % buildid ) - if base > 2 ** 17 - 366 * 24: + if base > 2**17 - 366 * 24: raise ValueError( "Running out of low order bits calculating " "android:versionCode from build ID %s: " diff --git a/python/mozbuild/mozbuild/artifact_commands.py b/python/mozbuild/mozbuild/artifact_commands.py index 8478c42addff..62406f406ab7 100644 --- a/python/mozbuild/mozbuild/artifact_commands.py +++ b/python/mozbuild/mozbuild/artifact_commands.py @@ -513,7 +513,6 @@ def artifact_toolchain( requests.exceptions.ChunkedEncodingError, requests.exceptions.ConnectionError, ) as e: - if isinstance(e, requests.exceptions.HTTPError): # The relengapi proxy likes to return error 400 bad request # which seems improbably to be due to our (simple) GET diff --git a/python/mozbuild/mozbuild/backend/common.py b/python/mozbuild/mozbuild/backend/common.py index 784e05e6b9a8..13c241863239 100644 --- a/python/mozbuild/mozbuild/backend/common.py +++ b/python/mozbuild/mozbuild/backend/common.py @@ -363,7 +363,6 @@ class CommonBackend(BuildBackend): ) def _handle_webidl_collection(self, webidls): - bindings_dir = mozpath.join(self.environment.topobjdir, "dom", "bindings") all_inputs = set(webidls.all_static_sources()) diff --git a/python/mozbuild/mozbuild/backend/configenvironment.py b/python/mozbuild/mozbuild/backend/configenvironment.py index eef1b62ee634..770db7333939 100644 --- a/python/mozbuild/mozbuild/backend/configenvironment.py +++ b/python/mozbuild/mozbuild/backend/configenvironment.py @@ -121,7 +121,6 @@ class ConfigEnvironment(object): source=None, mozconfig=None, ): - if not source: source = mozpath.join(topobjdir, "config.status") self.source = source diff --git a/python/mozbuild/mozbuild/backend/cpp_eclipse.py b/python/mozbuild/mozbuild/backend/cpp_eclipse.py index 413cca3f753e..f2bd5ecd851e 100644 --- a/python/mozbuild/mozbuild/backend/cpp_eclipse.py +++ b/python/mozbuild/mozbuild/backend/cpp_eclipse.py @@ -343,8 +343,8 @@ class CppEclipseBackend(CommonBackend): for i in args["includes"]: dirsettings += add_abs_include_path(i) for d in args["defines"]: - assert d[:2] == u"-D" or d[:2] == u"-U" - if d[:2] == u"-U": + assert d[:2] == "-D" or d[:2] == "-U" + if d[:2] == "-U": # gfx/harfbuzz/src uses -UDEBUG, at least on Mac # netwerk/sctp/src uses -U__APPLE__ on Mac # XXX We should make this code smart enough to remove existing defines. diff --git a/python/mozbuild/mozbuild/backend/fastermake.py b/python/mozbuild/mozbuild/backend/fastermake.py index 324db29866d5..c423e00c3240 100644 --- a/python/mozbuild/mozbuild/backend/fastermake.py +++ b/python/mozbuild/mozbuild/backend/fastermake.py @@ -225,7 +225,7 @@ class FasterMakeBackend(MakeBackend, PartialBackend): mk.create_rule([target]).add_dependencies( "%s" % d[0] for d in sorted(deps, key=itemgetter(0)) ) - for (merge, ref_file, l10n_file) in deps: + for merge, ref_file, l10n_file in deps: rule = mk.create_rule([merge]).add_dependencies( [ref_file, l10n_file] + python_deps ) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 8cd273032878..2b0a6cb5e9ae 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -873,7 +873,6 @@ class RecursiveMakeBackend(MakeBackend): unified_files_makefile_variable="unified_files", include_curdir_build_rules=True, ): - # In case it's a generator. unified_source_mapping = sorted(unified_source_mapping) diff --git a/python/mozbuild/mozbuild/backend/visualstudio.py b/python/mozbuild/mozbuild/backend/visualstudio.py index b9b30804b83c..ccf3c65a681d 100644 --- a/python/mozbuild/mozbuild/backend/visualstudio.py +++ b/python/mozbuild/mozbuild/backend/visualstudio.py @@ -441,7 +441,6 @@ class VisualStudioBackend(CommonBackend): def _create_natvis_type( self, doc, visualizer, name, displayString, stringView=None ): - t = visualizer.appendChild(doc.createElement("Type")) t.setAttribute("Name", name) @@ -593,7 +592,6 @@ class VisualStudioBackend(CommonBackend): headers=[], sources=[], ): - impl = getDOMImplementation() doc = impl.createDocument(MSBUILD_NAMESPACE, "Project", None) diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 3f5a6242f838..75eb76b459e5 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -751,7 +751,7 @@ class MozbuildObject(ProcessExecutionMixin): if not psutil or not job_size: num_jobs = cpus else: - mem_gb = psutil.virtual_memory().total / 1024 ** 3 + mem_gb = psutil.virtual_memory().total / 1024**3 from_mem = round(mem_gb / job_size) num_jobs = max(1, min(cpus, from_mem)) print( diff --git a/python/mozbuild/mozbuild/code_analysis/mach_commands.py b/python/mozbuild/mozbuild/code_analysis/mach_commands.py index ad6c3520219f..a65d35c3cfed 100644 --- a/python/mozbuild/mozbuild/code_analysis/mach_commands.py +++ b/python/mozbuild/mozbuild/code_analysis/mach_commands.py @@ -99,7 +99,6 @@ class StaticAnalysisMonitor(object): self._warnings_database = WarningsDatabase() def on_warning(warning): - # Output paths relative to repository root if the paths are under repo tree warning["filename"] = build_repo_relative_path( warning["filename"], self._srcdir @@ -542,7 +541,6 @@ def _get_clang_tidy_command( jobs, fix, ): - if checks == "-*": checks = ",".join(get_clang_tidy_config(command_context).checks) @@ -786,7 +784,6 @@ def autotest( error_code = ret_val if error_code != TOOLS_SUCCESS: - command_context.log( logging.INFO, "static-analysis", @@ -1560,7 +1557,6 @@ def get_clang_tools( download_if_needed=True, verbose=False, ): - rc, clang_paths = _set_clang_tools_paths(command_context) if rc != 0: @@ -1803,7 +1799,6 @@ def _copy_clang_format_for_show_diff( def _run_clang_format_path( command_context, clang_format, paths, output_file, output_format ): - # Run clang-format on files or directories directly from subprocess import CalledProcessError, check_output diff --git a/python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py b/python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py index d30c7f68cd5d..6c137a979bc0 100644 --- a/python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py +++ b/python/mozbuild/mozbuild/codecoverage/lcov_rewriter.py @@ -42,7 +42,6 @@ class LcovRecord(object): self.lines = {} def __iadd__(self, other): - # These shouldn't differ. self.source_file = other.source_file if hasattr(other, "test_name"): diff --git a/python/mozbuild/mozbuild/configure/__init__.py b/python/mozbuild/mozbuild/configure/__init__.py index 609d17103fae..002b5d6a400e 100644 --- a/python/mozbuild/mozbuild/configure/__init__.py +++ b/python/mozbuild/mozbuild/configure/__init__.py @@ -944,7 +944,6 @@ class ConfigureSandbox(dict): @imports(_from='mozpack', _import='path', _as='mozpath') """ for value, required in ((_import, True), (_from, False), (_as, False)): - if not isinstance(value, six.string_types) and ( required or value is not None ): diff --git a/python/mozbuild/mozbuild/controller/building.py b/python/mozbuild/mozbuild/controller/building.py index 5a4ef4f39732..aa753bf690c9 100644 --- a/python/mozbuild/mozbuild/controller/building.py +++ b/python/mozbuild/mozbuild/controller/building.py @@ -919,8 +919,8 @@ class CCacheStats(object): ABSOLUTE_KEYS = {"cache_files", "cache_size", "cache_max_size"} FORMAT_KEYS = {"cache_size", "cache_max_size"} - GiB = 1024 ** 3 - MiB = 1024 ** 2 + GiB = 1024**3 + MiB = 1024**2 KiB = 1024 def __init__(self, output=None, has_machine_format=False): diff --git a/python/mozbuild/mozbuild/controller/clobber.py b/python/mozbuild/mozbuild/controller/clobber.py index 3deba54d756c..e1be2d4bff80 100644 --- a/python/mozbuild/mozbuild/controller/clobber.py +++ b/python/mozbuild/mozbuild/controller/clobber.py @@ -80,7 +80,6 @@ class Clobberer(object): # Object directory clobber older than current is fine. if os.path.getmtime(self.src_clobber) <= os.path.getmtime(self.obj_clobber): - return False return True @@ -232,7 +231,7 @@ class Clobberer(object): self.remove_objdir(False) print("Successfully completed auto clobber.", file=fh) return True, True, None - except (IOError) as error: + except IOError as error: return ( True, False, diff --git a/python/mozbuild/mozbuild/doctor.py b/python/mozbuild/mozbuild/doctor.py index 649b50200d48..315a00e7c072 100644 --- a/python/mozbuild/mozbuild/doctor.py +++ b/python/mozbuild/mozbuild/doctor.py @@ -231,7 +231,7 @@ def memory(**kwargs) -> DoctorCheck: """Check the host machine has the recommended memory to develop Firefox.""" memory = psutil.virtual_memory().total # Convert to gigabytes. - memory_GB = memory / 1024 ** 3.0 + memory_GB = memory / 1024**3.0 if memory_GB < MEMORY_THRESHOLD: status = CheckStatus.WARNING desc = "%.1fGB of physical memory, <%.1fGB" % (memory_GB, MEMORY_THRESHOLD) @@ -266,8 +266,8 @@ def storage_freespace(topsrcdir: str, topobjdir: str, **kwargs) -> List[DoctorCh try: usage = psutil.disk_usage(mount) freespace, size = usage.free, usage.total - freespace_GB = freespace / 1024 ** 3 - size_GB = size / 1024 ** 3 + freespace_GB = freespace / 1024**3 + size_GB = size / 1024**3 if freespace_GB < FREESPACE_THRESHOLD: status = CheckStatus.WARNING desc.append( diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 1e241c56564c..fcc7400bfffd 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -490,7 +490,6 @@ class LinkFlags(BaseCompileFlags): not self._context.config.substs.get("MOZ_DEBUG"), ] ): - if self._context.config.substs.get("MOZ_OPTIMIZE"): flags.append("-OPT:REF,ICF") diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index f4100772418e..166fe6be798e 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -172,7 +172,6 @@ class TreeMetadataEmitter(LoggingMixin): yield o def _emit_libs_derived(self, contexts): - # First aggregate idl sources. webidl_attrs = [ ("GENERATED_EVENTS_WEBIDL_FILES", lambda c: c.generated_events_sources), @@ -1461,15 +1460,11 @@ class TreeMetadataEmitter(LoggingMixin): if mozpath.split(base)[0] == "res": has_resources = True for f in files: - if ( - var - in ( - "FINAL_TARGET_PP_FILES", - "OBJDIR_PP_FILES", - "LOCALIZED_PP_FILES", - ) - and not isinstance(f, SourcePath) - ): + if var in ( + "FINAL_TARGET_PP_FILES", + "OBJDIR_PP_FILES", + "LOCALIZED_PP_FILES", + ) and not isinstance(f, SourcePath): raise SandboxValidationError( ("Only source directory paths allowed in " + "%s: %s") % (var, f), @@ -1679,7 +1674,7 @@ class TreeMetadataEmitter(LoggingMixin): if not (generated_files or localized_generated_files): return - for (localized, gen) in ( + for localized, gen in ( (False, generated_files), (True, localized_generated_files), ): diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py index 26cdd26f55f0..97a4755dbc53 100644 --- a/python/mozbuild/mozbuild/frontend/reader.py +++ b/python/mozbuild/mozbuild/frontend/reader.py @@ -531,7 +531,6 @@ class BuildReaderError(Exception): other_error=None, sandbox_called_error=None, ): - self.file_stack = file_stack self.trace = trace self.sandbox_called_error = sandbox_called_error diff --git a/python/mozbuild/mozbuild/gn_processor.py b/python/mozbuild/mozbuild/gn_processor.py index b6c51ee010a8..8f372363cc80 100644 --- a/python/mozbuild/mozbuild/gn_processor.py +++ b/python/mozbuild/mozbuild/gn_processor.py @@ -297,7 +297,6 @@ def process_gn_config( # Process all targets from the given gn project and its dependencies. for target_fullname, spec in six.iteritems(targets): - target_path, target_name = target_info(target_fullname) context_attrs = {} @@ -396,7 +395,7 @@ def process_gn_config( ".mm": ("CMMFLAGS", ["cflags", "cflags_objcc"]), } variables = (suffix_map[e] for e in extensions if e in suffix_map) - for (var, flag_keys) in variables: + for var, flag_keys in variables: flags = [ _f for _k in flag_keys for _f in spec.get(_k, []) if _f in mozilla_flags ] @@ -522,7 +521,6 @@ def write_mozbuild( mozilla_flags, write_mozbuild_variables, ): - all_mozbuild_results = [] for gn_config in gn_configs: @@ -626,7 +624,6 @@ def write_mozbuild( ("OS_TARGET", "CPU_ARCH"), ("OS_TARGET", "CPU_ARCH", "MOZ_X11"), ): - conditions = set() for args in dirs_by_config.keys(): cond = tuple(((k, dict(args).get(k) or "") for k in attrs)) diff --git a/python/mozbuild/mozbuild/jar.py b/python/mozbuild/mozbuild/jar.py index f7d10f7fed98..1024b6f647a3 100644 --- a/python/mozbuild/mozbuild/jar.py +++ b/python/mozbuild/mozbuild/jar.py @@ -98,7 +98,6 @@ class DeprecatedJarManifest(Exception): class JarManifestParser(object): - ignore = re.compile("\s*(\#.*)?$") jarline = re.compile( """ @@ -210,7 +209,6 @@ class JarMaker(object): def __init__( self, outputFormat="flat", useJarfileManifest=True, useChromeManifest=False ): - self.outputFormat = outputFormat self.useJarfileManifest = useJarfileManifest self.useChromeManifest = useChromeManifest diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index c603195d5d45..6f834965c053 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -936,7 +936,6 @@ def gtest( debugger, debugger_args, ): - # We lazy build gtest because it's slow to link try: command_context.config_environment diff --git a/python/mozbuild/mozbuild/mozconfig.py b/python/mozbuild/mozbuild/mozconfig.py index 5cb5a5e859d8..960547eb8833 100644 --- a/python/mozbuild/mozbuild/mozconfig.py +++ b/python/mozbuild/mozbuild/mozconfig.py @@ -286,7 +286,6 @@ class MozconfigLoader(object): in_variable = None for line in output.splitlines(): - if not line: continue diff --git a/python/mozbuild/mozbuild/repackaging/dmg.py b/python/mozbuild/mozbuild/repackaging/dmg.py index 883927f214d8..5054fdec8e10 100644 --- a/python/mozbuild/mozbuild/repackaging/dmg.py +++ b/python/mozbuild/mozbuild/repackaging/dmg.py @@ -13,7 +13,6 @@ from mozbuild.repackaging.application_ini import get_application_ini_value def repackage_dmg(infile, output): - if not tarfile.is_tarfile(infile): raise Exception("Input file %s is not a valid tarfile." % infile) diff --git a/python/mozbuild/mozbuild/repackaging/msi.py b/python/mozbuild/mozbuild/repackaging/msi.py index b0b1b0998329..1884b05afeff 100644 --- a/python/mozbuild/mozbuild/repackaging/msi.py +++ b/python/mozbuild/mozbuild/repackaging/msi.py @@ -20,7 +20,6 @@ _MSI_ARCH = { def update_wsx(wfile, pvalues): - parsed = minidom.parse(wfile) # construct a dictinary for the pre-processing options diff --git a/python/mozbuild/mozbuild/repackaging/pkg.py b/python/mozbuild/mozbuild/repackaging/pkg.py index e7699ce5c4a3..c6e276a5d3a7 100644 --- a/python/mozbuild/mozbuild/repackaging/pkg.py +++ b/python/mozbuild/mozbuild/repackaging/pkg.py @@ -13,7 +13,6 @@ from mozbuild.bootstrap import bootstrap_toolchain def repackage_pkg(infile, output): - if not tarfile.is_tarfile(infile): raise Exception("Input file %s is not a valid tarfile." % infile) diff --git a/python/mozbuild/mozbuild/test/action/test_langpack_manifest.py b/python/mozbuild/mozbuild/test/action/test_langpack_manifest.py index 29e8642fc745..12750bdd3baf 100644 --- a/python/mozbuild/mozbuild/test/action/test_langpack_manifest.py +++ b/python/mozbuild/mozbuild/test/action/test_langpack_manifest.py @@ -154,7 +154,7 @@ langpack-contributors = { "" } self.assertEqual(len(description), 132) def test_get_version_maybe_buildid(self): - for (app_version, buildid, expected_version) in [ + for app_version, buildid, expected_version in [ ("109", "", "109"), ("109.0", "", "109.0"), ("109.0.0", "", "109.0.0"), diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index acbada060b1a..b7b5cd37fab4 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -1292,7 +1292,7 @@ class TestRecursiveMakeBackend(BackendTester): ("not-installed", "not-installed.prog"), ] prefix = "PROGRAM = " - for (subdir, expected_program) in expected: + for subdir, expected_program in expected: with io.open(os.path.join(env.topobjdir, subdir, "backend.mk"), "r") as fh: lines = fh.readlines() program = [ diff --git a/python/mozbuild/mozbuild/test/configure/data/included.configure b/python/mozbuild/mozbuild/test/configure/data/included.configure index 97166618ec8e..355d41c31a00 100644 --- a/python/mozbuild/mozbuild/test/configure/data/included.configure +++ b/python/mozbuild/mozbuild/test/configure/data/included.configure @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # For more complex and repetitive things, we can create templates @template def check_compiler_flag(flag): @@ -18,6 +19,7 @@ def check_compiler_flag(flag): check_compiler_flag("-Werror=foobar") + # Normal functions can be used in @depends functions. def fortytwo(): return 42 @@ -45,6 +47,7 @@ def check(value): set_config("TEMPLATE_VALUE_2", check) + # Normal functions can use @imports too to import modules. @imports("sys") def platform(): diff --git a/python/mozbuild/mozbuild/test/configure/data/moz.configure b/python/mozbuild/mozbuild/test/configure/data/moz.configure index 3a7d84b0e3a6..c7fd454eeb4d 100644 --- a/python/mozbuild/mozbuild/test/configure/data/moz.configure +++ b/python/mozbuild/mozbuild/test/configure/data/moz.configure @@ -38,6 +38,7 @@ option("--option", env="MOZ_OPTION", help="Option") # It is also possible to pass options through the environment only. option(env="CC", nargs=1, help="C Compiler") + # Call the function when the --enable-simple option is processed, with its # OptionValue as argument. @depends("--enable-simple") @@ -48,6 +49,7 @@ def simple(simple): set_config("ENABLED_SIMPLE", simple) + # There can be multiple functions depending on the same option. @depends("--enable-simple") def simple(simple): @@ -64,6 +66,7 @@ def with_env(with_env): set_config("WITH_ENV", with_env) + # It doesn't matter if the dependency is on --enable or --disable @depends("--disable-values") def with_env2(values): @@ -72,6 +75,7 @@ def with_env2(values): set_config("VALUES", with_env2) + # It is possible to @depends on environment-only options. @depends("CC") def is_gcc(cc): @@ -80,6 +84,7 @@ def is_gcc(cc): set_config("IS_GCC", is_gcc) + # It is possible to depend on the result from another function. @depends(with_env2) def with_env3(values): @@ -88,6 +93,7 @@ def with_env3(values): set_config("VALUES2", with_env3) + # @depends functions can also return results for use as input to another # @depends. @depends(with_env3) @@ -102,6 +108,7 @@ def with_env5(values): set_config("VALUES3", with_env5) + # The result from @depends functions can also be used as input to options. # The result must be returned, not implied. @depends("--enable-simple") @@ -195,6 +202,7 @@ include(include_path) # decorators. option("--with-imports", nargs="?", help="Imports") + # A limited set of functions from os.path are exposed by default. @depends("--with-imports") def with_imports(value): @@ -204,6 +212,7 @@ def with_imports(value): set_config("HAS_ABSPATH", with_imports) + # It is still possible to import the full set from os.path. # It is also possible to cherry-pick builtins. @depends("--with-imports") diff --git a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py index 37988d535f73..81a4badb9623 100644 --- a/python/mozbuild/mozbuild/test/configure/test_compile_checks.py +++ b/python/mozbuild/mozbuild/test/configure/test_compile_checks.py @@ -40,7 +40,6 @@ class BaseCompileChecks(unittest.TestCase): return mock_compiler def do_compile_test(self, command, expected_test_content=None, expected_flags=None): - paths = { os.path.abspath("/usr/bin/mockcc"): self.get_mock_compiler( expected_test_content=expected_test_content, @@ -350,7 +349,6 @@ class TestHeaderChecks(BaseCompileChecks): ) def test_check_headers_not_found(self): - cmd = textwrap.dedent( """\ baz_bar, quux_bar = check_headers('baz/foo-bar.h', 'baz-quux/foo-bar.h', diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 2157e69d0aaa..7a68a4323297 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -1454,7 +1454,6 @@ class TestEmitterBasic(unittest.TestCase): # Unified sources are not required if sources.have_unified_mapping: - for f in dict(sources.unified_source_mapping).keys(): self.assertIn( mozpath.join( diff --git a/python/mozbuild/mozbuild/testing.py b/python/mozbuild/mozbuild/testing.py index f951434f9798..ccbe9040b39c 100644 --- a/python/mozbuild/mozbuild/testing.py +++ b/python/mozbuild/mozbuild/testing.py @@ -124,7 +124,6 @@ class SupportFilesConverter(object): for field, seen in self._fields: value = test.get(field, "") for pattern in value.split(): - # We track uniqueness locally (per test) where duplicates are forbidden, # and globally, where they are permitted. If a support file appears multiple # times for a single test, there are unnecessary entries in the manifest. But diff --git a/python/mozlint/mozlint/cli.py b/python/mozlint/mozlint/cli.py index 02621733677f..d6613eaef300 100644 --- a/python/mozlint/mozlint/cli.py +++ b/python/mozlint/mozlint/cli.py @@ -357,7 +357,6 @@ def run( result = None try: - lint.read(linters_info["lint_paths"]) if check_exclude_list: diff --git a/python/mozlint/test/test_cli.py b/python/mozlint/test/test_cli.py index 01aeaa74b4b7..2ad12596ebf2 100644 --- a/python/mozlint/test/test_cli.py +++ b/python/mozlint/test/test_cli.py @@ -112,7 +112,6 @@ def test_cli_for_exclude_list(run, monkeypatch, capfd): def test_cli_run_with_wrong_linters(run, capfd): - run(["-l", "external", "-l", "foobar"]) out, err = capfd.readouterr() diff --git a/python/mozperftest/mozperftest/argparser.py b/python/mozperftest/mozperftest/argparser.py index 3ed5aab64765..bc92afd06084 100644 --- a/python/mozperftest/mozperftest/argparser.py +++ b/python/mozperftest/mozperftest/argparser.py @@ -26,7 +26,6 @@ FLAVORS = "desktop-browser", "mobile-browser", "doc", "xpcshell", "webpagetest" class Options: - general_args = { "--flavor": { "choices": FLAVORS, diff --git a/python/mozperftest/mozperftest/metrics/notebook/transformer.py b/python/mozperftest/mozperftest/metrics/notebook/transformer.py index 7ecbc40d8978..b4596d7ca6c8 100644 --- a/python/mozperftest/mozperftest/metrics/notebook/transformer.py +++ b/python/mozperftest/mozperftest/metrics/notebook/transformer.py @@ -216,7 +216,7 @@ def get_transformers(dirpath=None): for file in tfm_files: members = get_transformer(file.resolve().as_posix(), True) - for (name, tfm_class) in members: + for name, tfm_class in members: if name in ret: raise NotebookDuplicateTransformsError( f"Duplicated transformer {name} " diff --git a/python/mozperftest/mozperftest/test/browsertime/runner.py b/python/mozperftest/mozperftest/test/browsertime/runner.py index 54a9ace44a70..468dcd1a4596 100644 --- a/python/mozperftest/mozperftest/test/browsertime/runner.py +++ b/python/mozperftest/mozperftest/test/browsertime/runner.py @@ -148,7 +148,6 @@ class BrowsertimeRunner(NodeRunner): "browsertime", "package.json", ).open() as package: - return json.load(package) def _get_browsertime_resolved(self): @@ -362,7 +361,6 @@ class BrowsertimeRunner(NodeRunner): cycles = self.get_arg("cycles", 1) for cycle in range(1, cycles + 1): - # Build an output directory output = self.get_arg("output") if output is None: diff --git a/python/mozperftest/mozperftest/test/browsertime/visualtools.py b/python/mozperftest/mozperftest/test/browsertime/visualtools.py index d25cb131d383..f96a51f7e00f 100644 --- a/python/mozperftest/mozperftest/test/browsertime/visualtools.py +++ b/python/mozperftest/mozperftest/test/browsertime/visualtools.py @@ -58,63 +58,108 @@ def get_plat(): NUMPY = { - ("linux64", "3.10",): ( + ( + "linux64", + "3.10", + ): ( "88/cc/92815174c345015a326e3fff8beddcb951b3ef0f7c8296fcc22c622add7c" "/numpy-1.23.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" ), - ("linux64", "3.9",): ( + ( + "linux64", + "3.9", + ): ( "8d/d6/cc2330e512936a904a4db1629b71d697fb309115f6d2ede94d183cdfe185" "/numpy-1.23.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" ), - ("linux64", "3.8",): ( + ( + "linux64", + "3.8", + ): ( "86/c9/9f9d6812fa8a031a568c2c1c49f207a0a4030ead438644c887410fc49c8a" "/numpy-1.23.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" ), - ("linux64", "3.7",): ( + ( + "linux64", + "3.7", + ): ( "d6/2e/a2dbcff6f46bb65645d18538d67183a1cf56b006ba96a12575c282a976bc/" "numpy-1.19.2-cp37-cp37m-manylinux1_x86_64.whl" ), - ("linux64", "3.6",): ( + ( + "linux64", + "3.6", + ): ( "b8/e5/a64ef44a85397ba3c377f6be9c02f3cb3e18023f8c89850dd319e7945521/" "numpy-1.19.2-cp36-cp36m-manylinux1_x86_64.whl" ), - ("darwin", "3.10",): ( + ( + "darwin", + "3.10", + ): ( "c0/c2/8d58f3ccd1aa3b1eaa5c333a6748e225b45cf8748b13f052cbb3c811c996" "/numpy-1.23.1-cp310-cp310-macosx_10_9_x86_64.whl" ), - ("darwin", "3.9",): ( + ( + "darwin", + "3.9", + ): ( "e5/43/b1b80cbcea9f2d0e6adadd27a8da2c71b751d5670a846b444087fab408a1" "/numpy-1.23.1-cp39-cp39-macosx_10_9_x86_64.whl" ), - ("darwin", "3.8",): ( + ( + "darwin", + "3.8", + ): ( "71/08/bc1e4fb7392aa0721f299c444e8c99fa97c8cb41fe33791eca8e26364639" "/numpy-1.23.1-cp38-cp38-macosx_10_9_x86_64.whl" ), - ("darwin", "3.7",): ( + ( + "darwin", + "3.7", + ): ( "c1/a9/f04a5b7db30cc30b41fe516b8914c5049264490a34a49d977937606fbb23/" "numpy-1.19.2-cp37-cp37m-macosx_10_9_x86_64.whl" ), - ("darwin", "3.6",): ( + ( + "darwin", + "3.6", + ): ( "be/8e/800113bd3a0c9195b24574b8922ad92be96278028833c389b69a8b14f657/" "numpy-1.19.2-cp36-cp36m-macosx_10_9_x86_64.whl" ), - ("win64", "3.10",): ( + ( + "win64", + "3.10", + ): ( "8b/11/75a93826457f94a4c857a38ea3f178915f27ff38ffee1753e36994be7810" "/numpy-1.23.1-cp310-cp310-win_amd64.whl" ), - ("win64", "3.9",): ( + ( + "win64", + "3.9", + ): ( "bd/dd/0610fb49c433fe5987ae312fe672119080fd77be484b5698d6fa7554148b" "/numpy-1.23.1-cp39-cp39-win_amd64.whl" ), - ("win64", "3.8",): ( + ( + "win64", + "3.8", + ): ( "d0/19/6e81ed6fe30271ebcf25e5e2a0bdf1fa06ddee03a8cb82625503826970db" "/numpy-1.23.1-cp38-cp38-win_amd64.whl" ), - ("win64", "3.7",): ( + ( + "win64", + "3.7", + ): ( "82/4e/61764556b7ec13f5bd441b04530e2f9f11bb164308ef0e6951919bb846cb/" "numpy-1.19.2-cp37-cp37m-win_amd64.whl" ), - ("win64", "3.6",): ( + ( + "win64", + "3.6", + ): ( "dc/8e/a78d4e4a28adadbf693a9c056a0d5955a906889fa0dc3768b88deb236e22/" "numpy-1.19.2-cp36-cp36m-win_amd64.whl" ), @@ -122,43 +167,73 @@ NUMPY = { SCIPY = { - ("linux64", "3.10",): ( + ( + "linux64", + "3.10", + ): ( "bc/fe/72b611ba221c3367b06163992af4807515d6e0e09b3b9beee8ec22162d6f" "/scipy-1.8.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" ), - ("linux64", "3.9",): ( + ( + "linux64", + "3.9", + ): ( "25/82/da07cc3bb40554f1f82d7e24bfa7ffbfb05b50c16eb8d738ebb74b68af8f" "/scipy-1.8.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" ), - ("linux64", "3.8",): ( + ( + "linux64", + "3.8", + ): ( "cf/28/5ac0afe5fb473a934ef6bc7953a98a3d2eacf9a8f456524f035f3a844ca4" "/scipy-1.8.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl" ), - ("linux64", "3.7",): ( + ( + "linux64", + "3.7", + ): ( "65/f9/f7a7e5009711579c72da2725174825e5056741bf4001815d097eef1b2e17" "/scipy-1.5.2-cp37-cp37m-manylinux1_x86_64.whl" ), - ("linux64", "3.6",): ( + ( + "linux64", + "3.6", + ): ( "2b/a8/f4c66eb529bb252d50e83dbf2909c6502e2f857550f22571ed8556f62d95" "/scipy-1.5.2-cp36-cp36m-manylinux1_x86_64.whl" ), - ("darwin", "3.10",): ( + ( + "darwin", + "3.10", + ): ( "7c/f3/47b882f8b7a4dbc38e8bc5d7befe3ad2da582ae2229745e1eac77217f3e4" "/scipy-1.8.1-cp310-cp310-macosx_10_9_x86_64.whl" ), - ("darwin", "3.9",): ( + ( + "darwin", + "3.9", + ): ( "b0/de/e8d273063e1b21ec82e4a09a9654c4dcbc3215abbd59b7038c4ff4272e9e" "/scipy-1.8.1-cp39-cp39-macosx_10_9_x86_64.whl" ), - ("darwin", "3.8",): ( + ( + "darwin", + "3.8", + ): ( "dd/cc/bb5a9705dd30e7f558358168c793084f80de7cca88b06c82dca9d765b225" "/scipy-1.8.1-cp38-cp38-macosx_10_9_x86_64.whl" ), - ("darwin", "3.7",): ( + ( + "darwin", + "3.7", + ): ( "bc/47/e71e7f198a0b547fe861520a0240e3171256822dae81fcc97a36b772303e" "/scipy-1.5.2-cp37-cp37m-macosx_10_9_x86_64.whl" ), - ("darwin", "3.6",): ( + ( + "darwin", + "3.6", + ): ( "00/c0/ddf03baa7ee2a3540d8fbab0fecff7cdd0595dffd91cda746caa95cb686d" "/scipy-1.5.2-cp36-cp36m-macosx_10_9_x86_64.whl" ), @@ -174,11 +249,17 @@ SCIPY = { "8d/3e/e6f6fa6458e03ecd456ae6178529d4bd610a7c4999189f34d0668e4e69a6" "/scipy-1.8.1-cp38-cp38-win_amd64.whl" ), - ("win64", "3.7",): ( + ( + "win64", + "3.7", + ): ( "66/80/d8a5050df5b4d8229e018f3222fe603ce7f92c026b78f4e05d69c3a6c43b" "/scipy-1.5.2-cp37-cp37m-win_amd64.whl" ), - ("win64", "3.6",): ( + ( + "win64", + "3.6", + ): ( "fc/f6/3d455f8b376a0faf1081dbba38bbd594c074292bdec08feaac589f53bc06" "/scipy-1.5.2-cp36-cp36m-win_amd64.whl" ), diff --git a/python/mozperftest/mozperftest/tests/conftest.py b/python/mozperftest/mozperftest/tests/conftest.py index 19435c5369bd..9de1150c9e90 100644 --- a/python/mozperftest/mozperftest/tests/conftest.py +++ b/python/mozperftest/mozperftest/tests/conftest.py @@ -143,7 +143,6 @@ def ptnb(standarized_data): @pytest.fixture(scope="function", autouse=True) def perftestetl_plugin(): - ret = HERE / "data" / "perftestetl_plugin" os.environ["PERFTESTETL_PLUGIN"] = ret.resolve().as_posix() diff --git a/python/mozperftest/mozperftest/tests/test_argparser.py b/python/mozperftest/mozperftest/tests/test_argparser.py index b65a0809f8c7..35051772b1f4 100644 --- a/python/mozperftest/mozperftest/tests/test_argparser.py +++ b/python/mozperftest/mozperftest/tests/test_argparser.py @@ -60,7 +60,6 @@ def test_test_date_today(): def test_perfherder_metrics(): - parser = PerftestArgumentParser() args = [ "test_one.js", diff --git a/python/mozperftest/mozperftest/tests/test_notebookupload.py b/python/mozperftest/mozperftest/tests/test_notebookupload.py index 9defae8ad2c6..0e69f969f3b2 100644 --- a/python/mozperftest/mozperftest/tests/test_notebookupload.py +++ b/python/mozperftest/mozperftest/tests/test_notebookupload.py @@ -27,7 +27,6 @@ def setup_env(options): @pytest.mark.parametrize("no_filter", [True, False]) @mock.patch("mozperftest.metrics.notebookupload.PerftestNotebook") def test_notebookupload_with_filter(notebook, no_filter): - options = { "notebook-metrics": [], "notebook-prefix": "", diff --git a/python/mozperftest/mozperftest/tests/test_perftestnotebook.py b/python/mozperftest/mozperftest/tests/test_perftestnotebook.py index 55c3acabe178..58debe9343a0 100644 --- a/python/mozperftest/mozperftest/tests/test_perftestnotebook.py +++ b/python/mozperftest/mozperftest/tests/test_perftestnotebook.py @@ -26,7 +26,6 @@ def test_get_notebook_section_unknown_analysis(ptnb): @pytest.mark.parametrize("analysis", [["scatterplot"], None]) def test_post_to_iodide(ptnb, standarized_data, analysis): - opener = mock.mock_open() def mocked_open(self, *args, **kwargs): diff --git a/python/mozperftest/mozperftest/tests/test_utils.py b/python/mozperftest/mozperftest/tests/test_utils.py index 75c4a431a6e9..013dc0767974 100644 --- a/python/mozperftest/mozperftest/tests/test_utils.py +++ b/python/mozperftest/mozperftest/tests/test_utils.py @@ -41,7 +41,7 @@ def test_host_platform(): if sys.platform.startswith("darwin"): assert plat == "darwin" else: - if sys.maxsize > 2 ** 32: + if sys.maxsize > 2**32: assert "64" in plat else: assert "64" not in plat @@ -166,7 +166,6 @@ class ImportMe: def test_load_class(): - with pytest.raises(ImportError): load_class("notimportable") diff --git a/python/mozperftest/mozperftest/utils.py b/python/mozperftest/mozperftest/utils.py index ff2c0b5faa92..3667f683f7bc 100644 --- a/python/mozperftest/mozperftest/utils.py +++ b/python/mozperftest/mozperftest/utils.py @@ -90,7 +90,7 @@ def simple_platform(): def host_platform(): - is_64bits = sys.maxsize > 2 ** 32 + is_64bits = sys.maxsize > 2**32 if sys.platform.startswith("win"): if is_64bits: diff --git a/python/mozrelease/test/test_buglist_creator.py b/python/mozrelease/test/test_buglist_creator.py index 13a530bb977c..03c76b1d8a05 100644 --- a/python/mozrelease/test/test_buglist_creator.py +++ b/python/mozrelease/test/test_buglist_creator.py @@ -117,36 +117,36 @@ def test_parse_tag_version(tag, version): def test_get_previous_tag_version(version, tag, previous_tag): product = "firefox" ff_48_tags = [ - u"FIREFOX_BETA_48_END", - u"FIREFOX_RELEASE_48_END", - u"FIREFOX_48_0_2_RELEASE", - u"FIREFOX_48_0_2_BUILD1", - u"FIREFOX_48_0_1_RELEASE", - u"FIREFOX_48_0_1_BUILD3", - u"FIREFOX_48_0_RELEASE", - u"FIREFOX_48_0_BUILD2", - u"FIREFOX_RELEASE_48_BASE", - u"FIREFOX_48_0b10_RELEASE", - u"FIREFOX_48_0b10_BUILD1", - u"FIREFOX_48_0b9_RELEASE", - u"FIREFOX_48_0b9_BUILD1", - u"FIREFOX_48_0b7_RELEASE", - u"FIREFOX_48_0b7_BUILD1", - u"FIREFOX_48_0b6_RELEASE", - u"FIREFOX_48_0b6_BUILD1", - u"FIREFOX_48_0b5_RELEASE", - u"FIREFOX_48_0b5_BUILD1", - u"FIREFOX_48_0b4_RELEASE", - u"FIREFOX_48_0b4_BUILD1", - u"FIREFOX_48_0b3_RELEASE", - u"FIREFOX_48_0b3_BUILD1", - u"FIREFOX_48_0b2_RELEASE", - u"FIREFOX_48_0b2_BUILD2", - u"FIREFOX_48_0b1_RELEASE", - u"FIREFOX_48_0b1_BUILD2", - u"FIREFOX_AURORA_48_END", - u"FIREFOX_BETA_48_BASE", - u"FIREFOX_AURORA_48_BASE", + "FIREFOX_BETA_48_END", + "FIREFOX_RELEASE_48_END", + "FIREFOX_48_0_2_RELEASE", + "FIREFOX_48_0_2_BUILD1", + "FIREFOX_48_0_1_RELEASE", + "FIREFOX_48_0_1_BUILD3", + "FIREFOX_48_0_RELEASE", + "FIREFOX_48_0_BUILD2", + "FIREFOX_RELEASE_48_BASE", + "FIREFOX_48_0b10_RELEASE", + "FIREFOX_48_0b10_BUILD1", + "FIREFOX_48_0b9_RELEASE", + "FIREFOX_48_0b9_BUILD1", + "FIREFOX_48_0b7_RELEASE", + "FIREFOX_48_0b7_BUILD1", + "FIREFOX_48_0b6_RELEASE", + "FIREFOX_48_0b6_BUILD1", + "FIREFOX_48_0b5_RELEASE", + "FIREFOX_48_0b5_BUILD1", + "FIREFOX_48_0b4_RELEASE", + "FIREFOX_48_0b4_BUILD1", + "FIREFOX_48_0b3_RELEASE", + "FIREFOX_48_0b3_BUILD1", + "FIREFOX_48_0b2_RELEASE", + "FIREFOX_48_0b2_BUILD2", + "FIREFOX_48_0b1_RELEASE", + "FIREFOX_48_0b1_BUILD2", + "FIREFOX_AURORA_48_END", + "FIREFOX_BETA_48_BASE", + "FIREFOX_AURORA_48_BASE", ] mock_hg_json = {"tags": [{"tag": ff_48_tag} for ff_48_tag in ff_48_tags]} @@ -160,18 +160,18 @@ def test_get_bugs_in_changeset(): bugs, backouts = get_bugs_in_changeset(changeset_data) assert bugs == { - u"1356563", - u"1348409", - u"1341190", - u"1360626", - u"1332731", - u"1328762", - u"1355870", - u"1358089", - u"1354911", - u"1354038", + "1356563", + "1348409", + "1341190", + "1360626", + "1332731", + "1328762", + "1355870", + "1358089", + "1354911", + "1354038", } - assert backouts == {u"1337861", u"1320072"} + assert backouts == {"1337861", "1320072"} if __name__ == "__main__": diff --git a/remote/mach_commands.py b/remote/mach_commands.py index 35b31a2776d5..7de03c9dfda6 100644 --- a/remote/mach_commands.py +++ b/remote/mach_commands.py @@ -634,7 +634,6 @@ def puppeteer_test( product="firefox", **kwargs, ): - logger = mozlog.commandline.setup_logging( "puppeteer-test", kwargs, {"mach": sys.stdout} ) diff --git a/security/manager/ssl/tests/unit/sign_app.py b/security/manager/ssl/tests/unit/sign_app.py index a2767c54ebaa..5b57e73c4d18 100755 --- a/security/manager/ssl/tests/unit/sign_app.py +++ b/security/manager/ssl/tests/unit/sign_app.py @@ -71,7 +71,7 @@ def coseSignature(payload, algorithm, signingKey, signingCertificate, bodyProtec # external_aad : nil # payload : bstr # ] - sigStructure = [u"Signature", bodyProtected, protectedEncoded, None, payload] + sigStructure = ["Signature", bodyProtected, protectedEncoded, None, payload] sigStructureEncoded = dumps(sigStructure) pykeyHash = coseAlgorithmToPykeyHash(algorithm) signature = signingKey.signRaw(sigStructureEncoded, pykeyHash) @@ -97,7 +97,7 @@ def coseSig(payload, intermediates, signatures): protected = {KID: intermediates} protectedEncoded = dumps(protected) coseSignatures = [] - for (algorithm, signingKey, signingCertificate) in signatures: + for algorithm, signingKey, signingCertificate in signatures: coseSignatures.append( coseSignature( payload, algorithm, signingKey, signingCertificate, protectedEncoded @@ -128,7 +128,7 @@ def addManifestEntry(filename, hashes, contents, entries): pairs to use, the contents of the file, and the current list of manifest entries.""" entry = "Name: %s\n" % filename - for (hashFunc, name) in hashes: + for hashFunc, name in hashes: base64hash = b64encode(hashFunc(contents).digest()).decode("ascii") entry += "%s-Digest: %s\n" % (name, base64hash) entries.append(entry) @@ -230,7 +230,7 @@ def signZip( mfEntries.append("") with zipfile.ZipFile(outputFile, "w", zipfile.ZIP_DEFLATED) as outZip: - for (fullPath, internalPath) in walkDirectory(appDirectory): + for fullPath, internalPath in walkDirectory(appDirectory): with open(fullPath, "rb") as inputFile: contents = inputFile.read() outZip.writestr(internalPath, contents) @@ -276,7 +276,7 @@ def signZip( if len(pkcs7Hashes) != 0 or emptySignerInfos: mfContents = "\n".join(mfEntries) sfContents = "Signature-Version: 1.0\n" - for (hashFunc, name) in signatureHashes: + for hashFunc, name in signatureHashes: hashed = hashFunc(six.ensure_binary(mfContents)).digest() base64hash = b64encode(hashed).decode("ascii") sfContents += "%s-Digest-Manifest: %s\n" % (name, base64hash) diff --git a/servo/components/style/properties/data.py b/servo/components/style/properties/data.py index 1f3b6536921c..23ead614b9ae 100644 --- a/servo/components/style/properties/data.py +++ b/servo/components/style/properties/data.py @@ -733,7 +733,7 @@ class PropertiesData(object): # FIXME Servo's DOM architecture doesn't support vendor-prefixed properties. # See servo/servo#14941. if self.engine == "gecko": - for (prefix, pref) in property.extra_prefixes: + for prefix, pref in property.extra_prefixes: property.aliases.append(("-%s-%s" % (prefix, property.name), pref)) def declare_longhand(self, name, engines=None, **kwargs): diff --git a/taskcluster/gecko_taskgraph/actions/merge_automation.py b/taskcluster/gecko_taskgraph/actions/merge_automation.py index 8b9455536b68..264383dd66ac 100644 --- a/taskcluster/gecko_taskgraph/actions/merge_automation.py +++ b/taskcluster/gecko_taskgraph/actions/merge_automation.py @@ -70,7 +70,6 @@ def is_release_promotion_available(parameters): }, ) def merge_automation_action(parameters, graph_config, input, task_group_id, task_id): - # make parameters read-write parameters = dict(parameters) diff --git a/taskcluster/gecko_taskgraph/actions/retrigger_custom.py b/taskcluster/gecko_taskgraph/actions/retrigger_custom.py index 677cb00a11b1..bf5365ed7a62 100644 --- a/taskcluster/gecko_taskgraph/actions/retrigger_custom.py +++ b/taskcluster/gecko_taskgraph/actions/retrigger_custom.py @@ -164,7 +164,7 @@ def handle_custom_retrigger(parameters, graph_config, input, task_group_id, task custom_mach_command += ["--repeat", str(input.get("repeat", 30))] # add any custom gecko preferences - for (key, val) in input.get("preferences", {}).items(): + for key, val in input.get("preferences", {}).items(): custom_mach_command += ["--setpref", f"{key}={val}"] custom_mach_command += [input["path"]] diff --git a/taskcluster/gecko_taskgraph/docker.py b/taskcluster/gecko_taskgraph/docker.py index 2927b8302512..f8cbe6ac5fbd 100644 --- a/taskcluster/gecko_taskgraph/docker.py +++ b/taskcluster/gecko_taskgraph/docker.py @@ -134,7 +134,6 @@ def load_image(url, imageName=None, imageTag=None): req.raise_for_status() with zstd.ZstdDecompressor().stream_reader(req.raw) as ifh: - tarin = tarfile.open( mode="r|", fileobj=ifh, diff --git a/taskcluster/gecko_taskgraph/optimize/strategies.py b/taskcluster/gecko_taskgraph/optimize/strategies.py index 4d0d23a5acf4..35f91fc4f3b1 100644 --- a/taskcluster/gecko_taskgraph/optimize/strategies.py +++ b/taskcluster/gecko_taskgraph/optimize/strategies.py @@ -4,17 +4,75 @@ import logging +from datetime import datetime import mozpack.path as mozpath from mozbuild.base import MozbuildObject from mozbuild.util import memoize from taskgraph.optimize.base import OptimizationStrategy, register_strategy +from taskgraph.util.taskcluster import find_task_id from gecko_taskgraph import files_changed +from gecko_taskgraph.util.taskcluster import status_task logger = logging.getLogger(__name__) +@register_strategy("index-search") +class IndexSearch(OptimizationStrategy): + # A task with no dependencies remaining after optimization will be replaced + # if artifacts exist for the corresponding index_paths. + # Otherwise, we're in one of the following cases: + # - the task has un-optimized dependencies + # - the artifacts have expired + # - some changes altered the index_paths and new artifacts need to be + # created. + # In every of those cases, we need to run the task to create or refresh + # artifacts. + + fmt = "%Y-%m-%dT%H:%M:%S.%fZ" + + def should_replace_task(self, task, params, deadline, index_paths): + "Look for a task with one of the given index paths" + for index_path in index_paths: + try: + task_id = find_task_id(index_path) + status = status_task(task_id) + # status can be `None` if we're in `testing` mode + # (e.g. test-action-callback) + if not status or status.get("state") in ("exception", "failed"): + continue + + if deadline and datetime.strptime( + status["expires"], self.fmt + ) < datetime.strptime(deadline, self.fmt): + continue + + return task_id + except KeyError: + # 404 will end up here and go on to the next index path + pass + + return False + + +@register_strategy("skip-unless-changed") +class SkipUnlessChanged(OptimizationStrategy): + def should_remove_task(self, task, params, file_patterns): + # pushlog_id == -1 - this is the case when run from a cron.yml job + if params.get("pushlog_id") == -1: + return False + + changed = files_changed.check(params, file_patterns) + if not changed: + logger.debug( + "no files found matching a pattern in `skip-unless-changed` for " + + task.label + ) + return True + return False + + @register_strategy("skip-unless-schedules") class SkipUnlessSchedules(OptimizationStrategy): @memoize diff --git a/taskcluster/gecko_taskgraph/test/conftest.py b/taskcluster/gecko_taskgraph/test/conftest.py index 09231c5ab2cb..254db85fe471 100644 --- a/taskcluster/gecko_taskgraph/test/conftest.py +++ b/taskcluster/gecko_taskgraph/test/conftest.py @@ -194,7 +194,6 @@ def maketgg(monkeypatch): @pytest.fixture def run_transform(): - graph_config = fake_load_graph_config("/root") kind = FakeKind.create("fake", {}, graph_config) @@ -208,7 +207,6 @@ def run_transform(): @pytest.fixture def run_full_config_transform(): - graph_config = fake_load_graph_config("/root") kind = FakeKind.create("fullfake", {}, graph_config) diff --git a/taskcluster/gecko_taskgraph/test/test_decision.py b/taskcluster/gecko_taskgraph/test/test_decision.py index 81be7e0c4428..8440b8e13f59 100644 --- a/taskcluster/gecko_taskgraph/test/test_decision.py +++ b/taskcluster/gecko_taskgraph/test/test_decision.py @@ -53,7 +53,6 @@ class TestDecision(unittest.TestCase): class TestGetDecisionParameters(unittest.TestCase): - ttc_file = os.path.join(os.getcwd(), "try_task_config.json") def setUp(self): diff --git a/taskcluster/gecko_taskgraph/test/test_util_runnable_jobs.py b/taskcluster/gecko_taskgraph/test/test_util_runnable_jobs.py index 993521b83002..d1d7b0c06aea 100644 --- a/taskcluster/gecko_taskgraph/test/test_util_runnable_jobs.py +++ b/taskcluster/gecko_taskgraph/test/test_util_runnable_jobs.py @@ -14,7 +14,6 @@ from gecko_taskgraph.decision import full_task_graph_to_runnable_jobs class TestRunnableJobs(unittest.TestCase): - tasks = [ { "kind": "build", diff --git a/taskcluster/gecko_taskgraph/transforms/beetmover_repackage_partner.py b/taskcluster/gecko_taskgraph/transforms/beetmover_repackage_partner.py index 65b6921cc78f..62215115d647 100644 --- a/taskcluster/gecko_taskgraph/transforms/beetmover_repackage_partner.py +++ b/taskcluster/gecko_taskgraph/transforms/beetmover_repackage_partner.py @@ -181,7 +181,6 @@ def generate_upstream_artifacts( partner_path, repack_stub_installer=False, ): - upstream_artifacts = [] artifact_prefix = get_artifact_prefix(job) diff --git a/taskcluster/gecko_taskgraph/transforms/job/__init__.py b/taskcluster/gecko_taskgraph/transforms/job/__init__.py index 7ce02c0c72bc..56f3c49e6751 100644 --- a/taskcluster/gecko_taskgraph/transforms/job/__init__.py +++ b/taskcluster/gecko_taskgraph/transforms/job/__init__.py @@ -286,7 +286,7 @@ def use_fetches(config, jobs): for task in config.kind_dependencies_tasks.values() if task.kind in ("fetch", "toolchain") ) - for (kind, task) in tasks: + for kind, task in tasks: get_attribute( artifact_names, task["label"], task["attributes"], f"{kind}-artifact" ) diff --git a/taskcluster/gecko_taskgraph/transforms/perftest.py b/taskcluster/gecko_taskgraph/transforms/perftest.py index 5c579b48b5c7..2eb2a08e7493 100644 --- a/taskcluster/gecko_taskgraph/transforms/perftest.py +++ b/taskcluster/gecko_taskgraph/transforms/perftest.py @@ -289,7 +289,6 @@ def setup_perftest_test_date(config, jobs): def setup_regression_detector(config, jobs): for job in jobs: if "change-detector" in job.get("name"): - tasks_to_analyze = [] for task in config.params["try_task_config"].get("tasks", []): # Explicitly skip these tasks since they're diff --git a/taskcluster/gecko_taskgraph/transforms/release_msix_push.py b/taskcluster/gecko_taskgraph/transforms/release_msix_push.py index 817341f92c73..22b356d5a20d 100644 --- a/taskcluster/gecko_taskgraph/transforms/release_msix_push.py +++ b/taskcluster/gecko_taskgraph/transforms/release_msix_push.py @@ -38,7 +38,6 @@ transforms.add_validate(push_msix_description_schema) @transforms.add def make_task_description(config, jobs): for job in jobs: - job["worker"]["upstream-artifacts"] = generate_upstream_artifacts( job["dependencies"] ) diff --git a/taskcluster/gecko_taskgraph/transforms/repackage_signing_partner.py b/taskcluster/gecko_taskgraph/transforms/repackage_signing_partner.py index 103424074dfa..e3940fd84669 100644 --- a/taskcluster/gecko_taskgraph/transforms/repackage_signing_partner.py +++ b/taskcluster/gecko_taskgraph/transforms/repackage_signing_partner.py @@ -58,10 +58,13 @@ def make_repackage_signing_description(config, jobs): label = dep_job.label.replace("repackage-", "repackage-signing-") # Linux label = label.replace("chunking-dummy-", "repackage-signing-") - description = "Signing of repackaged artifacts for partner repack id '{repack_id}' for build '" "{build_platform}/{build_type}'".format( # NOQA: E501 - repack_id=repack_id, - build_platform=attributes.get("build_platform"), - build_type=attributes.get("build_type"), + description = ( + "Signing of repackaged artifacts for partner repack id '{repack_id}' for build '" + "{build_platform}/{build_type}'".format( # NOQA: E501 + repack_id=repack_id, + build_platform=attributes.get("build_platform"), + build_type=attributes.get("build_type"), + ) ) if "linux" in build_platform: diff --git a/taskcluster/gecko_taskgraph/transforms/scriptworker_canary.py b/taskcluster/gecko_taskgraph/transforms/scriptworker_canary.py index 43735f3dcefc..5df2113da3f0 100644 --- a/taskcluster/gecko_taskgraph/transforms/scriptworker_canary.py +++ b/taskcluster/gecko_taskgraph/transforms/scriptworker_canary.py @@ -29,7 +29,6 @@ def build_command(config, jobs): return for job in jobs: - command = ["release", "push-scriptworker-canary"] for scriptworker in scriptworkers: command.extend(["--scriptworker", scriptworker]) diff --git a/taskcluster/gecko_taskgraph/transforms/test/raptor.py b/taskcluster/gecko_taskgraph/transforms/test/raptor.py index 1e8dad1747cb..f322207f188a 100644 --- a/taskcluster/gecko_taskgraph/transforms/test/raptor.py +++ b/taskcluster/gecko_taskgraph/transforms/test/raptor.py @@ -135,7 +135,6 @@ def split_raptor_subtests(config, tests): continue for chunk_number, subtest in enumerate(subtests): - # Create new test job chunked = copy_task(test) chunked["chunk-number"] = 1 + chunk_number diff --git a/taskcluster/gecko_taskgraph/transforms/test/variant.py b/taskcluster/gecko_taskgraph/transforms/test/variant.py index d9e30d9d051a..bda91b2f2567 100644 --- a/taskcluster/gecko_taskgraph/transforms/test/variant.py +++ b/taskcluster/gecko_taskgraph/transforms/test/variant.py @@ -60,7 +60,6 @@ def split_variants(config, tasks): today = datetime.datetime.today() for variant in variants: - expiration = variants[variant]["expiration"] if len(expiration.split("-")) == 1: continue diff --git a/taskcluster/gecko_taskgraph/try_option_syntax.py b/taskcluster/gecko_taskgraph/try_option_syntax.py index cf68a26211f9..9059ad759d25 100644 --- a/taskcluster/gecko_taskgraph/try_option_syntax.py +++ b/taskcluster/gecko_taskgraph/try_option_syntax.py @@ -530,10 +530,8 @@ class TryOptionSyntax: # This might be somewhat confusing but we parse the string _backwards_ so # there is no ambiguity over what state we are in. for char in reversed(input_str): - # , indicates exiting a state if char == ",": - # Exit a particular platform. if in_platforms: add_platform(token) diff --git a/taskcluster/scripts/misc/summarize-tgdiff.py b/taskcluster/scripts/misc/summarize-tgdiff.py index f3a265ed6614..68db9bbdc7e1 100644 --- a/taskcluster/scripts/misc/summarize-tgdiff.py +++ b/taskcluster/scripts/misc/summarize-tgdiff.py @@ -17,7 +17,6 @@ def filter_changes(line): def run(): - parser = argparse.ArgumentParser( description="Classify output of taskgraph for CI analsyis" ) @@ -35,7 +34,6 @@ def run(): out = {"files": {}, "status": "OK", "threshold": args.threshold} for path in args.path.glob("*.txt"): - with path.open() as f: nb = len(list(filter(filter_changes, f.readlines()))) diff --git a/testing/awsy/awsy/parse_about_memory.py b/testing/awsy/awsy/parse_about_memory.py index 9d86d0e25edc..e98b0e4f9b56 100644 --- a/testing/awsy/awsy/parse_about_memory.py +++ b/testing/awsy/awsy/parse_about_memory.py @@ -157,13 +157,13 @@ if __name__ == "__main__": totals = calculate_memory_report_values(args.report, args.prefix, args.proc_filter) sorted_totals = sorted(totals.items(), key=lambda item: (-item[1], item[0])) - for (k, v) in sorted_totals: + for k, v in sorted_totals: if v: print("{0}\t".format(k)), print("") bytes_per_mebibyte = 1024.0 * 1024.0 - for (k, v) in sorted_totals: + for k, v in sorted_totals: if v: if args.mebi: print("{0:.2f} MiB".format(v / bytes_per_mebibyte)), diff --git a/testing/condprofile/condprof/progress.py b/testing/condprofile/condprof/progress.py index 764db75074d8..097af53a8ce1 100644 --- a/testing/condprofile/condprof/progress.py +++ b/testing/condprofile/condprof/progress.py @@ -206,7 +206,6 @@ def mill(it, label="", hide=None, expected_size=None, every=1): if (_i % every) == 0 or ( # True every "every" updates _i == count ): # And when we're done - STREAM.write(MILL_TEMPLATE % (label, _mill_char(_i), _i, count)) STREAM.flush() diff --git a/testing/condprofile/condprof/util.py b/testing/condprofile/condprof/util.py index 5c09c928a2e5..8f20326b84bf 100644 --- a/testing/condprofile/condprof/util.py +++ b/testing/condprofile/condprof/util.py @@ -274,7 +274,6 @@ def extract_from_dmg(dmg, target): @contextlib.contextmanager def latest_nightly(binary=None): - if binary is None: # we want to use the latest nightly nightly_archive = get_firefox_download_link() @@ -333,7 +332,7 @@ def get_current_platform(): e.g. macosx64, win32, linux64, etc.. """ - arch = sys.maxsize == 2 ** 63 - 1 and "64" or "32" + arch = sys.maxsize == 2**63 - 1 and "64" or "32" plat = platform.system().lower() if plat == "windows": plat = "win" diff --git a/testing/firefox-ui/tests/functional/safebrowsing/test_initial_download.py b/testing/firefox-ui/tests/functional/safebrowsing/test_initial_download.py index ec973af67484..4013c51d5bff 100644 --- a/testing/firefox-ui/tests/functional/safebrowsing/test_initial_download.py +++ b/testing/firefox-ui/tests/functional/safebrowsing/test_initial_download.py @@ -10,7 +10,6 @@ from marionette_harness import MarionetteTestCase class TestSafeBrowsingInitialDownload(MarionetteTestCase): - v2_file_extensions = [ "vlpset", "sbstore", diff --git a/testing/marionette/client/docs/conf.py b/testing/marionette/client/docs/conf.py index b388f9864cb1..692545faa942 100644 --- a/testing/marionette/client/docs/conf.py +++ b/testing/marionette/client/docs/conf.py @@ -45,8 +45,8 @@ source_suffix = ".rst" master_doc = "index" # General information about the project. -project = u"Marionette Python Client" -copyright = u"2013, Mozilla Automation and Tools and individual contributors" +project = "Marionette Python Client" +copyright = "2013, Mozilla Automation and Tools and individual contributors" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -202,8 +202,8 @@ latex_documents = [ ( "index", "MarionettePythonClient.tex", - u"Marionette Python Client Documentation", - u"Mozilla Automation and Tools team", + "Marionette Python Client Documentation", + "Mozilla Automation and Tools team", "manual", ), ] @@ -237,8 +237,8 @@ man_pages = [ ( "index", "marionettepythonclient", - u"Marionette Python Client Documentation", - [u"Mozilla Automation and Tools team"], + "Marionette Python Client Documentation", + ["Mozilla Automation and Tools team"], 1, ) ] diff --git a/testing/marionette/client/marionette_driver/errors.py b/testing/marionette/client/marionette_driver/errors.py index 09dc9f24efbd..27e1928a73b0 100644 --- a/testing/marionette/client/marionette_driver/errors.py +++ b/testing/marionette/client/marionette_driver/errors.py @@ -39,17 +39,17 @@ class MarionetteException(Exception): if self.cause: if type(self.cause) is tuple: - msg += u", caused by {0!r}".format(self.cause[0]) + msg += ", caused by {0!r}".format(self.cause[0]) tb = self.cause[2] else: - msg += u", caused by {}".format(self.cause) + msg += ", caused by {}".format(self.cause) if self.stacktrace: - st = u"".join(["\t{}\n".format(x) for x in self.stacktrace.splitlines()]) - msg += u"\nstacktrace:\n{}".format(st) + st = "".join(["\t{}\n".format(x) for x in self.stacktrace.splitlines()]) + msg += "\nstacktrace:\n{}".format(st) if tb: - msg += u": " + u"".join(traceback.format_tb(tb)) + msg += ": " + "".join(traceback.format_tb(tb)) return six.text_type(msg) diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py index e06f1f9728ff..694d47b70f71 100644 --- a/testing/marionette/client/marionette_driver/geckoinstance.py +++ b/testing/marionette/client/marionette_driver/geckoinstance.py @@ -261,9 +261,7 @@ class GeckoInstance(object): if isinstance(profile_path, six.string_types): profile_args["path_from"] = profile_path profile_args["path_to"] = tempfile.mkdtemp( - suffix=u".{}".format( - profile_name or os.path.basename(profile_path) - ), + suffix=".{}".format(profile_name or os.path.basename(profile_path)), dir=self.workspace, ) # The target must not exist yet @@ -274,7 +272,7 @@ class GeckoInstance(object): # Otherwise create a new profile else: profile_args["profile"] = tempfile.mkdtemp( - suffix=u".{}".format(profile_name or "mozrunner"), + suffix=".{}".format(profile_name or "mozrunner"), dir=self.workspace, ) profile = Profile(**profile_args) diff --git a/testing/marionette/client/marionette_driver/keys.py b/testing/marionette/client/marionette_driver/keys.py index c53829b14940..18b547caa737 100644 --- a/testing/marionette/client/marionette_driver/keys.py +++ b/testing/marionette/client/marionette_driver/keys.py @@ -19,70 +19,69 @@ class Keys(object): + NULL = "\ue000" + CANCEL = "\ue001" # ^break + HELP = "\ue002" + BACK_SPACE = "\ue003" + TAB = "\ue004" + CLEAR = "\ue005" + RETURN = "\ue006" + ENTER = "\ue007" + SHIFT = "\ue008" + LEFT_SHIFT = "\ue008" # alias + CONTROL = "\ue009" + LEFT_CONTROL = "\ue009" # alias + ALT = "\ue00a" + LEFT_ALT = "\ue00a" # alias + PAUSE = "\ue00b" + ESCAPE = "\ue00c" + SPACE = "\ue00d" + PAGE_UP = "\ue00e" + PAGE_DOWN = "\ue00f" + END = "\ue010" + HOME = "\ue011" + LEFT = "\ue012" + ARROW_LEFT = "\ue012" # alias + UP = "\ue013" + ARROW_UP = "\ue013" # alias + RIGHT = "\ue014" + ARROW_RIGHT = "\ue014" # alias + DOWN = "\ue015" + ARROW_DOWN = "\ue015" # alias + INSERT = "\ue016" + DELETE = "\ue017" + SEMICOLON = "\ue018" + EQUALS = "\ue019" - NULL = u"\ue000" - CANCEL = u"\ue001" # ^break - HELP = u"\ue002" - BACK_SPACE = u"\ue003" - TAB = u"\ue004" - CLEAR = u"\ue005" - RETURN = u"\ue006" - ENTER = u"\ue007" - SHIFT = u"\ue008" - LEFT_SHIFT = u"\ue008" # alias - CONTROL = u"\ue009" - LEFT_CONTROL = u"\ue009" # alias - ALT = u"\ue00a" - LEFT_ALT = u"\ue00a" # alias - PAUSE = u"\ue00b" - ESCAPE = u"\ue00c" - SPACE = u"\ue00d" - PAGE_UP = u"\ue00e" - PAGE_DOWN = u"\ue00f" - END = u"\ue010" - HOME = u"\ue011" - LEFT = u"\ue012" - ARROW_LEFT = u"\ue012" # alias - UP = u"\ue013" - ARROW_UP = u"\ue013" # alias - RIGHT = u"\ue014" - ARROW_RIGHT = u"\ue014" # alias - DOWN = u"\ue015" - ARROW_DOWN = u"\ue015" # alias - INSERT = u"\ue016" - DELETE = u"\ue017" - SEMICOLON = u"\ue018" - EQUALS = u"\ue019" + NUMPAD0 = "\ue01a" # numbe pad keys + NUMPAD1 = "\ue01b" + NUMPAD2 = "\ue01c" + NUMPAD3 = "\ue01d" + NUMPAD4 = "\ue01e" + NUMPAD5 = "\ue01f" + NUMPAD6 = "\ue020" + NUMPAD7 = "\ue021" + NUMPAD8 = "\ue022" + NUMPAD9 = "\ue023" + MULTIPLY = "\ue024" + ADD = "\ue025" + SEPARATOR = "\ue026" + SUBTRACT = "\ue027" + DECIMAL = "\ue028" + DIVIDE = "\ue029" - NUMPAD0 = u"\ue01a" # numbe pad keys - NUMPAD1 = u"\ue01b" - NUMPAD2 = u"\ue01c" - NUMPAD3 = u"\ue01d" - NUMPAD4 = u"\ue01e" - NUMPAD5 = u"\ue01f" - NUMPAD6 = u"\ue020" - NUMPAD7 = u"\ue021" - NUMPAD8 = u"\ue022" - NUMPAD9 = u"\ue023" - MULTIPLY = u"\ue024" - ADD = u"\ue025" - SEPARATOR = u"\ue026" - SUBTRACT = u"\ue027" - DECIMAL = u"\ue028" - DIVIDE = u"\ue029" + F1 = "\ue031" # function keys + F2 = "\ue032" + F3 = "\ue033" + F4 = "\ue034" + F5 = "\ue035" + F6 = "\ue036" + F7 = "\ue037" + F8 = "\ue038" + F9 = "\ue039" + F10 = "\ue03a" + F11 = "\ue03b" + F12 = "\ue03c" - F1 = u"\ue031" # function keys - F2 = u"\ue032" - F3 = u"\ue033" - F4 = u"\ue034" - F5 = u"\ue035" - F6 = u"\ue036" - F7 = u"\ue037" - F8 = u"\ue038" - F9 = u"\ue039" - F10 = u"\ue03a" - F11 = u"\ue03b" - F12 = u"\ue03c" - - META = u"\ue03d" - COMMAND = u"\ue03d" + META = "\ue03d" + COMMAND = "\ue03d" diff --git a/testing/marionette/client/marionette_driver/transport.py b/testing/marionette/client/marionette_driver/transport.py index aa63a690233a..cbaac8ea2cd8 100644 --- a/testing/marionette/client/marionette_driver/transport.py +++ b/testing/marionette/client/marionette_driver/transport.py @@ -251,7 +251,7 @@ class TcpTransport(object): else: if body_length <= 0: err = "expected a positive integer" - elif body_length > 2 ** 32 - 1: + elif body_length > 2**32 - 1: err = "expected a 32 bit integer" if err is not None: raise ValueError( diff --git a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py index 32c36967bb91..f1b3233850c6 100644 --- a/testing/marionette/harness/marionette_harness/marionette_test/testcases.py +++ b/testing/marionette/harness/marionette_harness/marionette_test/testcases.py @@ -82,7 +82,6 @@ class MetaParameterized(type): @six.add_metaclass(MetaParameterized) class CommonTestCase(unittest.TestCase): - match_re = None failureException = AssertionError pydebugger = None @@ -337,7 +336,6 @@ class CommonTestCase(unittest.TestCase): class MarionetteTestCase(CommonTestCase): - match_re = re.compile(r"test_(.*)\.py$") def __init__( diff --git a/testing/marionette/harness/marionette_harness/runner/base.py b/testing/marionette/harness/marionette_harness/runner/base.py index 5ba8a37bd26f..bcfd94d8ef0a 100644 --- a/testing/marionette/harness/marionette_harness/runner/base.py +++ b/testing/marionette/harness/marionette_harness/runner/base.py @@ -57,7 +57,6 @@ class MarionetteTest(TestResult): class MarionetteTestResult(StructuredTestResult, TestResultCollection): - resultClass = MarionetteTest def __init__(self, *args, **kwargs): @@ -233,7 +232,6 @@ class MarionetteTestResult(StructuredTestResult, TestResultCollection): class MarionetteTextTestRunner(StructuredTestRunner): - resultclass = MarionetteTestResult def __init__(self, **kwargs): @@ -603,7 +601,6 @@ class Fixtures(object): class BaseMarionetteTestRunner(object): - textrunnerclass = MarionetteTextTestRunner driverclass = Marionette diff --git a/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py b/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py index be79f24086de..2fadf225afea 100644 --- a/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py +++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/conftest.py @@ -35,7 +35,7 @@ def mach_parsed_kwargs(logger): "app_args": [], "avd": None, "avd_home": None, - "binary": u"/path/to/firefox", + "binary": "/path/to/firefox", "browsermob_port": None, "browsermob_script": None, "device_serial": None, @@ -72,7 +72,7 @@ def mach_parsed_kwargs(logger): "startup_timeout": 60, "symbols_path": None, "test_tags": None, - "tests": [u"/path/to/unit-tests.ini"], + "tests": ["/path/to/unit-tests.ini"], "testvars": None, "this_chunk": None, "timeout": None, diff --git a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py index c68a840f792d..2a03d0d03c73 100644 --- a/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py +++ b/testing/marionette/harness/marionette_harness/tests/harness_unit/test_marionette_runner.py @@ -68,7 +68,7 @@ def expected_driver_args(runner): class ExpectedDict(dict): def assert_matches(self, actual): - for (k, v) in self.items(): + for k, v in self.items(): assert actual[k] == v def assert_keys_not_in(self, actual): @@ -85,7 +85,7 @@ class ManifestFixture: def __init__( self, name="mock_manifest", - tests=[{"path": u"test_something.py", "expected": "pass"}], + tests=[{"path": "test_something.py", "expected": "pass"}], ): self.filepath = "/path/to/fake/manifest.ini" self.n_disabled = len([t for t in tests if "disabled" in t]) @@ -111,13 +111,13 @@ def manifest_with_tests(request): included = [] if "enabled" in request.param: included += [ - (u"test_expected_pass.py", "pass"), - (u"test_expected_fail.py", "fail"), + ("test_expected_pass.py", "pass"), + ("test_expected_fail.py", "fail"), ] if "disabled" in request.param: included += [ - (u"test_pass_disabled.py", "pass", "skip-if: true"), - (u"test_fail_disabled.py", "fail", "skip-if: true"), + ("test_pass_disabled.py", "pass", "skip-if: true"), + ("test_fail_disabled.py", "fail", "skip-if: true"), ] keys = ("path", "expected", "disabled") active_tests = [dict(list(zip(keys, values))) for values in included] @@ -423,12 +423,12 @@ def test_reset_test_stats(mock_runner): mock_runner.failed = 1 mock_runner.failures.append(["TEST-UNEXPECTED-FAIL"]) assert not reset_successful(mock_runner) - mock_runner.run_tests([u"test_fake_thing.py"]) + mock_runner.run_tests(["test_fake_thing.py"]) assert reset_successful(mock_runner) def test_initialize_test_run(mock_runner): - tests = [u"test_fake_thing.py"] + tests = ["test_fake_thing.py"] mock_runner.reset_test_stats = Mock() mock_runner.run_tests(tests) assert mock_runner.reset_test_stats.called @@ -447,7 +447,7 @@ def test_add_tests(mock_runner): fake_tests = ["test_" + i + ".py" for i in "abc"] mock_runner.run_tests(fake_tests) assert len(mock_runner.tests) == 3 - for (test_name, added_test) in zip(fake_tests, mock_runner.tests): + for test_name, added_test in zip(fake_tests, mock_runner.tests): assert added_test["filepath"].endswith(test_name) @@ -481,15 +481,15 @@ def test_run_until_failure(mock_runner): def test_catch_invalid_test_names(runner): - good_tests = [u"test_ok.py", u"test_is_ok.py"] + good_tests = ["test_ok.py", "test_is_ok.py"] bad_tests = [ - u"bad_test.py", - u"testbad.py", - u"_test_bad.py", - u"test_bad.notpy", - u"test_bad", - u"test.py", - u"test_.py", + "bad_test.py", + "testbad.py", + "_test_bad.py", + "test_bad.notpy", + "test_bad", + "test.py", + "test_.py", ] with pytest.raises(Exception) as exc: runner._add_tests(good_tests + bad_tests) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py index b740eedf4636..0cdaf8343f43 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_capabilities.py @@ -195,7 +195,7 @@ class TestCapabilityMatching(MarionetteTestCase): self.delete_session() - timeouts = {"implicit": 0, "pageLoad": 2.0, "script": 2 ** 53 - 1} + timeouts = {"implicit": 0, "pageLoad": 2.0, "script": 2**53 - 1} self.marionette.start_session({"timeouts": timeouts}) self.assertIn("timeouts", self.marionette.session_capabilities) self.assertDictEqual(self.marionette.session_capabilities["timeouts"], timeouts) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py b/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py index 933a743513cf..b413adda0d1e 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_crash.py @@ -62,7 +62,6 @@ class MockMozCrash(object): class BaseCrashTestCase(MarionetteTestCase): - # Reduce the timeout for faster processing of the tests socket_timeout = 10 diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_errors.py b/testing/marionette/harness/marionette_harness/tests/unit/test_errors.py index 1fb1c888c525..53984dba4849 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_errors.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_errors.py @@ -19,7 +19,7 @@ def fake_cause(): message = "foo" -unicode_message = u"\u201Cfoo" +unicode_message = "\u201Cfoo" cause = fake_cause() stacktrace = "first\nsecond" @@ -93,7 +93,7 @@ class TestLookup(marionette_test.MarionetteTestCase): def test_by_known_unicode_string(self): self.assertEqual( - errors.NoSuchElementException, errors.lookup(u"no such element") + errors.NoSuchElementException, errors.lookup("no such element") ) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py b/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py index ca9cea3a0da4..c3a66d930a70 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_prefs.py @@ -174,7 +174,6 @@ class TestPreferences(MarionetteTestCase): pref_not_existent: "existent", } ): - self.assertTrue(self.marionette.get_pref(self.prefs["bool"]), True) self.assertEqual(self.marionette.get_pref(self.prefs["int"]), 24) self.assertEqual(self.marionette.get_pref(self.prefs["string"]), "def") diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py b/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py index dbe31b29afd6..1420b8815729 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_profile_management.py @@ -182,20 +182,20 @@ class TestSwitchProfileWithoutWorkspace(ExternalProfileMixin, BaseProfileManagem def test_new_named_profile_unicode(self): """Test using unicode string with 1-4 bytes encoding works.""" - self.marionette.instance.switch_profile(u"$¢€🍪") + self.marionette.instance.switch_profile("$¢€🍪") self.marionette.start_session() self.assertNotEqual(self.profile_path, self.orig_profile_path) - self.assertIn(u"$¢€🍪", self.profile_path) + self.assertIn("$¢€🍪", self.profile_path) self.assertFalse(os.path.exists(self.orig_profile_path)) def test_new_named_profile_unicode_escape_characters(self): """Test using escaped unicode string with 1-4 bytes encoding works.""" - self.marionette.instance.switch_profile(u"\u0024\u00A2\u20AC\u1F36A") + self.marionette.instance.switch_profile("\u0024\u00A2\u20AC\u1F36A") self.marionette.start_session() self.assertNotEqual(self.profile_path, self.orig_profile_path) - self.assertIn(u"\u0024\u00A2\u20AC\u1F36A", self.profile_path) + self.assertIn("\u0024\u00A2\u20AC\u1F36A", self.profile_path) self.assertFalse(os.path.exists(self.orig_profile_path)) def test_clone_existing_profile(self): diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py b/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py index 9e2951e2ea84..e173e5a96324 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_reftest.py @@ -46,11 +46,11 @@ class TestReftest(MarionetteTestCase): ) self.marionette._send_message("reftest:teardown", {}) expected = { - u"value": { - u"extra": {}, - u"message": u"Testing about:blank == about:blank\n", - u"stack": None, - u"status": u"PASS", + "value": { + "extra": {}, + "message": "Testing about:blank == about:blank\n", + "stack": None, + "status": "PASS", } } self.assertEqual(expected, rv) @@ -70,7 +70,7 @@ class TestReftest(MarionetteTestCase): }, ) self.marionette._send_message("reftest:teardown", {}) - self.assertEqual(u"PASS", rv[u"value"][u"status"]) + self.assertEqual("PASS", rv["value"]["status"]) def test_cache_multiple_sizes(self): teal = self.fixtures.where_is("reftest/teal-700x700.html") @@ -88,7 +88,7 @@ class TestReftest(MarionetteTestCase): "height": 600, }, ) - self.assertEqual(u"PASS", rv[u"value"][u"status"]) + self.assertEqual("PASS", rv["value"]["status"]) rv = self.marionette._send_message( "reftest:run", @@ -101,5 +101,5 @@ class TestReftest(MarionetteTestCase): "height": 700, }, ) - self.assertEqual(u"FAIL", rv[u"value"][u"status"]) + self.assertEqual("FAIL", rv["value"]["status"]) self.marionette._send_message("reftest:teardown", {}) diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_skip_setup.py b/testing/marionette/harness/marionette_harness/tests/unit/test_skip_setup.py index d423567eee13..e3cac5947fc8 100644 --- a/testing/marionette/harness/marionette_harness/tests/unit/test_skip_setup.py +++ b/testing/marionette/harness/marionette_harness/tests/unit/test_skip_setup.py @@ -6,7 +6,6 @@ from marionette_harness import MarionetteTestCase, SkipTest class TestSetUpSkipped(MarionetteTestCase): - testVar = {"test": "SkipTest"} def setUp(self): @@ -21,7 +20,6 @@ class TestSetUpSkipped(MarionetteTestCase): class TestSetUpNotSkipped(MarionetteTestCase): - testVar = {"test": "SkipTest"} def setUp(self): diff --git a/testing/mochitest/bisection.py b/testing/mochitest/bisection.py index 044be2354216..45c9a0cdf5c6 100644 --- a/testing/mochitest/bisection.py +++ b/testing/mochitest/bisection.py @@ -4,7 +4,6 @@ import mozinfo class Bisect(object): - "Class for creating, bisecting and summarizing for --bisect-chunk option." def __init__(self, harness): diff --git a/testing/mochitest/runjunit.py b/testing/mochitest/runjunit.py index 346a116234b5..66df0688c99d 100644 --- a/testing/mochitest/runjunit.py +++ b/testing/mochitest/runjunit.py @@ -264,7 +264,7 @@ class JUnitTestRunner(MochitestDesktop): for [key, value] in [p.split("=", 1) for p in self.options.add_env]: env[key] = value - for (env_count, (env_key, env_val)) in enumerate(six.iteritems(env)): + for env_count, (env_key, env_val) in enumerate(six.iteritems(env)): cmd = cmd + " -e env%d %s=%s" % (env_count, env_key, env_val) # runner cmd = cmd + " %s/%s" % (self.options.app, self.options.runner) diff --git a/testing/mochitest/runtests.py b/testing/mochitest/runtests.py index 242550d0eb9a..214f10b08edb 100644 --- a/testing/mochitest/runtests.py +++ b/testing/mochitest/runtests.py @@ -442,7 +442,6 @@ if mozinfo.isWin: finally: ctypes.windll.kernel32.CloseHandle(pHandle) - else: import errno @@ -473,7 +472,6 @@ else: class MochitestServer(object): - "Web server used to serve Mochitests, for closer fidelity to the real web." instance_count = 0 @@ -635,7 +633,6 @@ class MochitestServer(object): class WebSocketServer(object): - "Class which encapsulates the mod_pywebsocket server" def __init__(self, options, scriptdir, logger, debuggerInfo=None): @@ -1307,7 +1304,7 @@ class MochitestDesktop(object): paths.append(test) # Generate test by schemes - for (scheme, grouped_tests) in self.groupTestsByScheme(paths).items(): + for scheme, grouped_tests in self.groupTestsByScheme(paths).items(): # Bug 883865 - add this functionality into manifestparser with open( os.path.join(SCRIPT_DIR, options.testRunManifestFile), "w" @@ -3292,13 +3289,13 @@ toolbar#nav-bar { ] stepResults = {} - for (descr, step) in steps: + for descr, step in steps: stepResults[descr] = "not run / incomplete" startTime = datetime.now() maxTime = timedelta(seconds=options.verify_max_time) finalResult = "PASSED" - for (descr, step) in steps: + for descr, step in steps: if (datetime.now() - startTime) > maxTime: self.log.info("::: Test verification is taking too long: Giving up!") self.log.info( @@ -3683,7 +3680,7 @@ toolbar#nav-bar { # testsToFilter parameter is used to filter out the test list that # is sent to getTestsByScheme - for (scheme, tests) in self.getTestsByScheme( + for scheme, tests in self.getTestsByScheme( options, testsToFilter, True, manifestToFilter ): # read the number of tests here, if we are not going to run any, diff --git a/testing/mozbase/docs/conf.py b/testing/mozbase/docs/conf.py index dd451e253dc5..7855e250b894 100644 --- a/testing/mozbase/docs/conf.py +++ b/testing/mozbase/docs/conf.py @@ -54,8 +54,8 @@ source_suffix = ".rst" master_doc = "index" # General information about the project. -project = u"MozBase" -copyright = u"2012, Mozilla Automation and Tools team" +project = "MozBase" +copyright = "2012, Mozilla Automation and Tools team" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -208,8 +208,8 @@ latex_documents = [ ( "index", "MozBase.tex", - u"MozBase Documentation", - u"Mozilla Automation and Tools team", + "MozBase Documentation", + "Mozilla Automation and Tools team", "manual", ), ] @@ -243,8 +243,8 @@ man_pages = [ ( "index", "mozbase", - u"MozBase Documentation", - [u"Mozilla Automation and Tools team"], + "MozBase Documentation", + ["Mozilla Automation and Tools team"], 1, ) ] @@ -262,8 +262,8 @@ texinfo_documents = [ ( "index", "MozBase", - u"MozBase Documentation", - u"Mozilla Automation and Tools team", + "MozBase Documentation", + "Mozilla Automation and Tools team", "MozBase", "One line description of project.", "Miscellaneous", diff --git a/testing/mozbase/manifestparser/manifestparser/cli.py b/testing/mozbase/manifestparser/manifestparser/cli.py index 2fefca33e709..8dd2c3f0cd8d 100644 --- a/testing/mozbase/manifestparser/manifestparser/cli.py +++ b/testing/mozbase/manifestparser/manifestparser/cli.py @@ -155,7 +155,6 @@ class WriteCLI(CLICommand): usage = "%prog [options] write manifest -tag1 -tag2 --key1=value1 --key2=value2 ..." def __call__(self, options, args): - # parse the arguments try: kwargs, tags, args = parse_args(args) diff --git a/testing/mozbase/manifestparser/manifestparser/ini.py b/testing/mozbase/manifestparser/manifestparser/ini.py index 941f26fa36a3..fb0c56a24a1e 100644 --- a/testing/mozbase/manifestparser/manifestparser/ini.py +++ b/testing/mozbase/manifestparser/manifestparser/ini.py @@ -57,8 +57,7 @@ def read_ini( current_section = {} current_section_name = "" key_indent = 0 - for (linenum, line) in enumerate(fp.read().splitlines(), start=1): - + for linenum, line in enumerate(fp.read().splitlines(), start=1): stripped = line.strip() # ignore blank lines diff --git a/testing/mozbase/manifestparser/manifestparser/manifestparser.py b/testing/mozbase/manifestparser/manifestparser/manifestparser.py index 311f54eae866..fe475617ee8b 100644 --- a/testing/mozbase/manifestparser/manifestparser/manifestparser.py +++ b/testing/mozbase/manifestparser/manifestparser/manifestparser.py @@ -835,7 +835,6 @@ class ManifestParser(object): # walk the directories, generating manifests def callback(directory, dirpath, dirnames, filenames): - # absolute paths filenames = [os.path.join(dirpath, filename) for filename in filenames] # ensure new manifest isn't added diff --git a/testing/mozbase/manifestparser/tests/test_default_overrides.py b/testing/mozbase/manifestparser/tests/test_default_overrides.py index 0afe9bfdd45a..34140f9447ba 100755 --- a/testing/mozbase/manifestparser/tests/test_default_overrides.py +++ b/testing/mozbase/manifestparser/tests/test_default_overrides.py @@ -23,7 +23,6 @@ class TestDefaultSkipif(unittest.TestCase): """Tests applying a skip-if condition in [DEFAULT] and || with the value for the test""" def test_defaults(self): - default = os.path.join(here, "default-skipif.ini") parser = ManifestParser(manifests=(default,), use_toml=False) for test in parser.tests: @@ -52,7 +51,6 @@ class TestDefaultSkipif(unittest.TestCase): ) def test_defaults_toml(self): - default = os.path.join(here, "default-skipif.toml") parser = ManifestParser(manifests=(default,), use_toml=True) for test in parser.tests: @@ -81,7 +79,6 @@ class TestDefaultSkipif(unittest.TestCase): ) def test_defaults_toml_multiline(self): - default = os.path.join(here, "default-skipif-multiline.toml") parser = ManifestParser(manifests=(default,), use_toml=True) for test in parser.tests: @@ -114,7 +111,6 @@ class TestDefaultSupportFiles(unittest.TestCase): """Tests combining support-files field in [DEFAULT] with the value for a test""" def test_defaults(self): - default = os.path.join(here, "default-suppfiles.ini") parser = ManifestParser(manifests=(default,), use_toml=False) expected_supp_files = { @@ -127,7 +123,6 @@ class TestDefaultSupportFiles(unittest.TestCase): self.assertEqual(test["support-files"], expected) def test_defaults_toml(self): - default = os.path.join(here, "default-suppfiles.toml") parser = ManifestParser(manifests=(default,), use_toml=True) expected_supp_files = { diff --git a/testing/mozbase/manifestparser/tests/test_expressionparser.py b/testing/mozbase/manifestparser/tests/test_expressionparser.py index 806f2347efb1..2d0eb1be0791 100755 --- a/testing/mozbase/manifestparser/tests/test_expressionparser.py +++ b/testing/mozbase/manifestparser/tests/test_expressionparser.py @@ -10,7 +10,6 @@ class ExpressionParserTest(unittest.TestCase): """Test the conditional expression parser.""" def test_basic(self): - self.assertEqual(parse("1"), 1) self.assertEqual(parse("100"), 100) self.assertEqual(parse("true"), True) @@ -23,7 +22,6 @@ class ExpressionParserTest(unittest.TestCase): self.assertEqual(parse("abc123", abc123="xyz"), "xyz") def test_equality(self): - self.assertTrue(parse("true == true")) self.assertTrue(parse("false == false")) self.assertTrue(parse("1 == 1")) diff --git a/testing/mozbase/manifestparser/tests/test_manifestparser.py b/testing/mozbase/manifestparser/tests/test_manifestparser.py index 708a17172920..ab6cf5d79471 100755 --- a/testing/mozbase/manifestparser/tests/test_manifestparser.py +++ b/testing/mozbase/manifestparser/tests/test_manifestparser.py @@ -734,7 +734,6 @@ yellow = submarine self.assertFalse("test_0202_app_launch_apply_update_dirlocked.js" in names) def test_verifyDirectory(self): - directory = os.path.join(here, "verifyDirectory") # correct manifest @@ -758,7 +757,6 @@ yellow = submarine self.assertEqual(missing, (set([missing_test]), set())) def test_verifyDirectory_toml(self): - directory = os.path.join(here, "verifyDirectory") # correct manifest diff --git a/testing/mozbase/mozcrash/mozcrash/mozcrash.py b/testing/mozbase/mozcrash/mozcrash/mozcrash.py index 8b5e14caeb20..8adaf7cd11db 100644 --- a/testing/mozbase/mozcrash/mozcrash/mozcrash.py +++ b/testing/mozbase/mozcrash/mozcrash/mozcrash.py @@ -768,7 +768,6 @@ if mozinfo.isWin: "kill_pid(): unable to get handle for pid %d: %d" % (pid, err) ) - else: def kill_pid(pid): diff --git a/testing/mozbase/mozcrash/tests/conftest.py b/testing/mozbase/mozcrash/tests/conftest.py index 482751572317..7b6dcea496f6 100644 --- a/testing/mozbase/mozcrash/tests/conftest.py +++ b/testing/mozbase/mozcrash/tests/conftest.py @@ -59,7 +59,7 @@ def minidump_files(request, tmpdir): extra = tmpdir.join("{}.extra".format(name)) extra.write_text( - u""" + """ { "ContentSandboxLevel":"2", "TelemetryEnvironment":"{🍪}", @@ -119,7 +119,7 @@ def mock_popen(monkeypatch): self.returncode = 0 def communicate(self): - return (u"Stackwalk command: {}".format(" ".join(self.args)), "") + return ("Stackwalk command: {}".format(" ".join(self.args)), "") def wait(self): return self.returncode diff --git a/testing/mozbase/mozcrash/tests/test_basic.py b/testing/mozbase/mozcrash/tests/test_basic.py index 84fb2587eb39..384aba62dcd4 100644 --- a/testing/mozbase/mozcrash/tests/test_basic.py +++ b/testing/mozbase/mozcrash/tests/test_basic.py @@ -21,22 +21,22 @@ def test_dump_directory_unicode(request, check_for_crashes, tmpdir, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" from conftest import minidump_files - tmpdir = tmpdir.ensure(u"🍪", dir=1) + tmpdir = tmpdir.ensure("🍪", dir=1) minidump_files = minidump_files(request, tmpdir) assert 1 == check_for_crashes(dump_directory=fspath(tmpdir), quiet=False) out, _ = capsys.readouterr() assert fspath(minidump_files[0]["dmp"]) in out - assert u"🍪" in out + assert "🍪" in out def test_test_name_unicode(check_for_crashes, minidump_files, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" - assert 1 == check_for_crashes(test_name=u"🍪", quiet=False) + assert 1 == check_for_crashes(test_name="🍪", quiet=False) out, err = capsys.readouterr() - assert u"| 🍪" in out + assert "| 🍪" in out if __name__ == "__main__": diff --git a/testing/mozbase/mozcrash/tests/test_java_exception.py b/testing/mozbase/mozcrash/tests/test_java_exception.py index f48ce2cc3ef2..00c8d3c46a32 100644 --- a/testing/mozbase/mozcrash/tests/test_java_exception.py +++ b/testing/mozbase/mozcrash/tests/test_java_exception.py @@ -44,7 +44,7 @@ def test_unchecked_exception(check_for_java_exception, test_log): def test_test_name_unicode(check_for_java_exception, test_log): """Test that check_for_crashes can handle unicode in dump_directory.""" - assert 1 == check_for_java_exception(test_log, test_name=u"🍪", quiet=False) + assert 1 == check_for_java_exception(test_log, test_name="🍪", quiet=False) if __name__ == "__main__": diff --git a/testing/mozbase/mozcrash/tests/test_stackwalk.py b/testing/mozbase/mozcrash/tests/test_stackwalk.py index 7be2d82c102c..3292e4fdf122 100644 --- a/testing/mozbase/mozcrash/tests/test_stackwalk.py +++ b/testing/mozbase/mozcrash/tests/test_stackwalk.py @@ -28,7 +28,7 @@ def test_stackwalk_envvar(check_for_crashes, minidump_files, stackwalk): def test_stackwalk_unicode(check_for_crashes, minidump_files, tmpdir, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" - stackwalk = tmpdir.mkdir(u"🍪").join("stackwalk") + stackwalk = tmpdir.mkdir("🍪").join("stackwalk") stackwalk.write("fake binary") stackwalk.chmod(0o744) diff --git a/testing/mozbase/mozcrash/tests/test_symbols_path.py b/testing/mozbase/mozcrash/tests/test_symbols_path.py index 9aa281bd31fa..644302c947cd 100644 --- a/testing/mozbase/mozcrash/tests/test_symbols_path.py +++ b/testing/mozbase/mozcrash/tests/test_symbols_path.py @@ -17,7 +17,7 @@ def test_symbols_path_not_present(check_for_crashes, minidump_files): def test_symbols_path_unicode(check_for_crashes, minidump_files, tmpdir, capsys): """Test that check_for_crashes can handle unicode in dump_directory.""" - symbols_path = tmpdir.mkdir(u"🍪") + symbols_path = tmpdir.mkdir("🍪") assert 1 == check_for_crashes(symbols_path=fspath(symbols_path), quiet=False) diff --git a/testing/mozbase/mozdevice/mozdevice/adb.py b/testing/mozbase/mozdevice/mozdevice/adb.py index cf1b78064e20..700a2471fa49 100644 --- a/testing/mozbase/mozdevice/mozdevice/adb.py +++ b/testing/mozbase/mozdevice/mozdevice/adb.py @@ -4135,7 +4135,7 @@ class ADBDevice(ADBCommand): # against bool prior to testing it against int in order to # prevent falsely identifying a bool value as an int. if extras: - for (key, val) in extras.items(): + for key, val in extras.items(): if isinstance(val, bool): extra_type_param = "--ez" elif isinstance(val, int): @@ -4196,7 +4196,7 @@ class ADBDevice(ADBCommand): if moz_env: # moz_env is expected to be a dictionary of environment variables: # Fennec itself will set them when launched - for (env_count, (env_key, env_val)) in enumerate(moz_env.items()): + for env_count, (env_key, env_val) in enumerate(moz_env.items()): extras["env" + str(env_count)] = env_key + "=" + env_val # Additional command line arguments that fennec will read and use (e.g. @@ -4261,13 +4261,13 @@ class ADBDevice(ADBCommand): if moz_env: # moz_env is expected to be a dictionary of environment variables: # geckoview_example itself will set them when launched - for (env_count, (env_key, env_val)) in enumerate(moz_env.items()): + for env_count, (env_key, env_val) in enumerate(moz_env.items()): extras["env" + str(env_count)] = env_key + "=" + env_val # Additional command line arguments that the app will read and use (e.g. # with a custom profile) if extra_args: - for (arg_count, arg) in enumerate(extra_args): + for arg_count, arg in enumerate(extra_args): extras["arg" + str(arg_count)] = arg extras["use_multiprocess"] = e10s @@ -4329,13 +4329,13 @@ class ADBDevice(ADBCommand): if moz_env: # moz_env is expected to be a dictionary of environment variables: # geckoview_example itself will set them when launched - for (env_count, (env_key, env_val)) in enumerate(moz_env.items()): + for env_count, (env_key, env_val) in enumerate(moz_env.items()): extras["env" + str(env_count)] = env_key + "=" + env_val # Additional command line arguments that the app will read and use (e.g. # with a custom profile) if extra_args: - for (arg_count, arg) in enumerate(extra_args): + for arg_count, arg in enumerate(extra_args): extras["arg" + str(arg_count)] = arg extras["use_multiprocess"] = e10s diff --git a/testing/mozbase/mozfile/mozfile/mozfile.py b/testing/mozbase/mozfile/mozfile/mozfile.py index 1f4ffa74af9c..9fd8794ae25c 100644 --- a/testing/mozbase/mozfile/mozfile/mozfile.py +++ b/testing/mozbase/mozfile/mozfile/mozfile.py @@ -387,7 +387,6 @@ def tree(directory, sort_key=lambda x: x.lower()): top = depth(directory) for dirpath, dirnames, filenames in os.walk(directory, topdown=True): - abspath = os.path.abspath(dirpath) basename = os.path.basename(abspath) parent = os.path.dirname(abspath) @@ -540,7 +539,6 @@ class NamedTemporaryFile(object): def __init__( self, mode="w+b", bufsize=-1, suffix="", prefix="tmp", dir=None, delete=True ): - import tempfile fd, path = tempfile.mkstemp(suffix, prefix, dir, "t" in mode) diff --git a/testing/mozbase/mozfile/tests/test_tree.py b/testing/mozbase/mozfile/tests/test_tree.py index eba7d34a6b1c..556c1b91391b 100644 --- a/testing/mozbase/mozfile/tests/test_tree.py +++ b/testing/mozbase/mozfile/tests/test_tree.py @@ -16,12 +16,12 @@ class TestTree(unittest.TestCase): def test_unicode_paths(self): """Test creating tree structure from a Unicode path.""" try: - tmpdir = tempfile.mkdtemp(suffix=u"tmp🍪") - os.mkdir(os.path.join(tmpdir, u"dir🍪")) - with open(os.path.join(tmpdir, u"file🍪"), "w") as f: + tmpdir = tempfile.mkdtemp(suffix="tmp🍪") + os.mkdir(os.path.join(tmpdir, "dir🍪")) + with open(os.path.join(tmpdir, "file🍪"), "w") as f: f.write("foo") - self.assertEqual(u"{}\n├file🍪\n└dir🍪".format(tmpdir), tree(tmpdir)) + self.assertEqual("{}\n├file🍪\n└dir🍪".format(tmpdir), tree(tmpdir)) finally: shutil.rmtree(tmpdir) diff --git a/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symFileManager.py b/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symFileManager.py index e93cbc7b0253..92cfcf323011 100644 --- a/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symFileManager.py +++ b/testing/mozbase/mozgeckoprofiler/mozgeckoprofiler/symFileManager.py @@ -248,7 +248,7 @@ class SymFileManager: self.sCacheLock.acquire() try: for pdbName in symDirsToInspect: - for (mtime, symbolDirPath) in symDirsToInspect[pdbName]: + for mtime, symbolDirPath in symDirsToInspect[pdbName]: pdbId = os.path.basename(symbolDirPath) if pdbName in self.sCache and pdbId in self.sCache[pdbName]: symDirsToInspect[pdbName].remove((mtime, symbolDirPath)) @@ -262,7 +262,7 @@ class SymFileManager: # The corresponding symbol file name ends with .sym symFileName = re.sub(r"\.[^\.]+$", ".sym", pdbName) - for (mtime, symbolDirPath) in symDirsToInspect[pdbName]: + for mtime, symbolDirPath in symDirsToInspect[pdbName]: pdbId = os.path.basename(symbolDirPath) symbolFilePath = symbolDirPath + os.sep + symFileName symbolInfo = self.FetchSymbolsFromFile(symbolFilePath) @@ -285,7 +285,7 @@ class SymFileManager: # Make room for the new symbols self.MaybeEvict(fetchedCount) - for (pdbName, pdbId) in fetchedSymbols: + for pdbName, pdbId in fetchedSymbols: if pdbName not in self.sCache: self.sCache[pdbName] = {} @@ -333,7 +333,7 @@ class SymFileManager: # Evict symbols until evict quota is met, starting with least recently # used - for (pdbName, pdbId) in reversed(self.sMruSymbols): + for pdbName, pdbId in reversed(self.sMruSymbols): if numToEvict <= 0: break diff --git a/testing/mozbase/mozgeckoprofiler/tests/test_view_gecko_profiler.py b/testing/mozbase/mozgeckoprofiler/tests/test_view_gecko_profiler.py index c22b16fe1840..76dd0f4594f8 100644 --- a/testing/mozbase/mozgeckoprofiler/tests/test_view_gecko_profiler.py +++ b/testing/mozbase/mozgeckoprofiler/tests/test_view_gecko_profiler.py @@ -52,12 +52,11 @@ class TestViewGeckoProfile(unittest.TestCase): self.response = [None] def test_view_gecko_profile(self): - # Create a temporary fake performance profile. temp_dir = tempfile.mkdtemp() profile_path = os.path.join(temp_dir, "fakeprofile.json") with io.open(profile_path, "w") as f: - f.write(u"FAKE_PROFILE") + f.write("FAKE_PROFILE") # Mock the open_new_tab function so that we know when the view_gecko_profile # function has done all of its work, and we can assert ressult of the diff --git a/testing/mozbase/mozhttpd/mozhttpd/mozhttpd.py b/testing/mozbase/mozhttpd/mozhttpd/mozhttpd.py index 91066c0deb96..dd4e606a5553 100755 --- a/testing/mozbase/mozhttpd/mozhttpd/mozhttpd.py +++ b/testing/mozbase/mozhttpd/mozhttpd/mozhttpd.py @@ -67,7 +67,6 @@ class Request(object): class RequestHandler(SimpleHTTPRequestHandler): - docroot = os.getcwd() # current working directory at time of import proxy_host_dirs = False request_log = [] @@ -94,7 +93,7 @@ class RequestHandler(SimpleHTTPRequestHandler): self.request, *m.groups() ) self.send_response(response_code) - for (keyword, value) in iteritems(headerdict): + for keyword, value in iteritems(headerdict): self.send_header(keyword, value) self.end_headers() self.wfile.write(ensure_binary(data)) diff --git a/testing/mozbase/mozinfo/mozinfo/mozinfo.py b/testing/mozbase/mozinfo/mozinfo/mozinfo.py index e1fffbb5fc39..0736356e197a 100755 --- a/testing/mozbase/mozinfo/mozinfo/mozinfo.py +++ b/testing/mozbase/mozinfo/mozinfo/mozinfo.py @@ -349,7 +349,6 @@ __all__ += [ def main(args=None): - # parse the command line from optparse import OptionParser diff --git a/testing/mozbase/mozinfo/tests/test.py b/testing/mozbase/mozinfo/tests/test.py index 14e516b7fcb1..f1d971d3179a 100644 --- a/testing/mozbase/mozinfo/tests/test.py +++ b/testing/mozbase/mozinfo/tests/test.py @@ -164,8 +164,8 @@ def test_compare_to_string(): assert b > a # Make sure we can compare against unicode (for python 2). - assert a == u"1.2.5a" - assert u"1.2.5a" == a + assert a == "1.2.5a" + assert "1.2.5a" == a def test_to_string(): diff --git a/testing/mozbase/mozlog/mozlog/formatters/grouping.py b/testing/mozbase/mozlog/mozlog/formatters/grouping.py index 36993b5595ef..89f5d2478315 100644 --- a/testing/mozbase/mozlog/mozlog/formatters/grouping.py +++ b/testing/mozbase/mozlog/mozlog/formatters/grouping.py @@ -11,8 +11,8 @@ import six from mozlog.formatters import base -DEFAULT_MOVE_UP_CODE = u"\x1b[A" -DEFAULT_CLEAR_EOL_CODE = u"\x1b[K" +DEFAULT_MOVE_UP_CODE = "\x1b[A" +DEFAULT_CLEAR_EOL_CODE = "\x1b[K" class GroupingFormatter(base.BaseFormatter): @@ -145,11 +145,11 @@ class GroupingFormatter(base.BaseFormatter): self.start_time = data["time"] if self.number_of_tests == 0: - return "Running tests in %s\n\n" % data[u"source"] + return "Running tests in %s\n\n" % data["source"] else: return "Running %i tests in %s\n\n" % ( self.number_of_tests, - data[u"source"], + data["source"], ) def test_start(self, data): @@ -159,11 +159,11 @@ class GroupingFormatter(base.BaseFormatter): def wrap_and_indent_lines(self, lines, indent): assert len(lines) > 0 - output = indent + u"\u25B6 %s\n" % lines[0] + output = indent + "\u25B6 %s\n" % lines[0] for line in lines[1:-1]: - output += indent + u"\u2502 %s\n" % line + output += indent + "\u2502 %s\n" % line if len(lines) > 1: - output += indent + u"\u2514 %s\n" % lines[-1] + output += indent + "\u2514 %s\n" % lines[-1] return output def get_lines_for_unexpected_result( @@ -174,13 +174,13 @@ class GroupingFormatter(base.BaseFormatter): test_name = test_name.encode("unicode-escape").decode("utf-8") if expected: - expected_text = u" [expected %s]" % expected + expected_text = " [expected %s]" % expected else: - expected_text = u"" + expected_text = "" - lines = [u"%s%s %s" % (status, expected_text, test_name)] + lines = ["%s%s %s" % (status, expected_text, test_name)] if message: - lines.append(u" \u2192 %s" % message) + lines.append(" \u2192 %s" % message) if stack: lines.append("") lines += [stackline for stackline in stack.splitlines()] @@ -197,7 +197,7 @@ class GroupingFormatter(base.BaseFormatter): known_intermittent, ) lines += [ - u"%s%s %s%s" + "%s%s %s%s" % ( status, expected, @@ -222,7 +222,7 @@ class GroupingFormatter(base.BaseFormatter): ) def make_subtests_failure(test_name, subtests, stack=None): - lines = [u"Unexpected subtest result in %s:" % test_name] + lines = ["Unexpected subtest result in %s:" % test_name] for subtest in subtests[:-1]: add_subtest_failure(lines, subtest, None) add_subtest_failure(lines, subtests[-1], stack) @@ -240,7 +240,7 @@ class GroupingFormatter(base.BaseFormatter): else: failures_by_stack[failure["stack"]].append(failure) - for (stack, failures) in six.iteritems(failures_by_stack): + for stack, failures in six.iteritems(failures_by_stack): output += make_subtests_failure(test_name, failures, stack) return output @@ -311,43 +311,43 @@ class GroupingFormatter(base.BaseFormatter): self.end_time = data["time"] if not self.interactive: - output = u"\n" + output = "\n" else: output = "" - output += u"Ran %i tests finished in %.1f seconds.\n" % ( + output += "Ran %i tests finished in %.1f seconds.\n" % ( self.completed_tests, (self.end_time - self.start_time) / 1000.0, ) - output += u" \u2022 %i ran as expected. %i tests skipped.\n" % ( + output += " \u2022 %i ran as expected. %i tests skipped.\n" % ( sum(self.expected.values()), self.expected["SKIP"], ) if self.known_intermittent_results: - output += u" \u2022 %i known intermittent results.\n" % ( + output += " \u2022 %i known intermittent results.\n" % ( len(self.known_intermittent_results) ) def text_for_unexpected_list(text, section): tests = self.unexpected_tests[section] if not tests: - return u"" - return u" \u2022 %i tests %s\n" % (len(tests), text) + return "" + return " \u2022 %i tests %s\n" % (len(tests), text) - output += text_for_unexpected_list(u"crashed unexpectedly", "CRASH") - output += text_for_unexpected_list(u"had errors unexpectedly", "ERROR") - output += text_for_unexpected_list(u"failed unexpectedly", "FAIL") + output += text_for_unexpected_list("crashed unexpectedly", "CRASH") + output += text_for_unexpected_list("had errors unexpectedly", "ERROR") + output += text_for_unexpected_list("failed unexpectedly", "FAIL") output += text_for_unexpected_list( - u"precondition failed unexpectedly", "PRECONDITION_FAILED" + "precondition failed unexpectedly", "PRECONDITION_FAILED" ) - output += text_for_unexpected_list(u"timed out unexpectedly", "TIMEOUT") - output += text_for_unexpected_list(u"passed unexpectedly", "PASS") - output += text_for_unexpected_list(u"unexpectedly okay", "OK") + output += text_for_unexpected_list("timed out unexpectedly", "TIMEOUT") + output += text_for_unexpected_list("passed unexpectedly", "PASS") + output += text_for_unexpected_list("unexpectedly okay", "OK") num_with_failing_subtests = len(self.tests_with_failing_subtests) if num_with_failing_subtests: output += ( - u" \u2022 %i tests had unexpected subtest results\n" + " \u2022 %i tests had unexpected subtest results\n" % num_with_failing_subtests ) output += "\n" @@ -355,13 +355,13 @@ class GroupingFormatter(base.BaseFormatter): # Repeat failing test output, so that it is easier to find, since the # non-interactive version prints all the test names. if not self.interactive and self.test_failure_text: - output += u"Tests with unexpected results:\n" + self.test_failure_text + output += "Tests with unexpected results:\n" + self.test_failure_text if self.known_intermittent_results: results = self.get_lines_for_known_intermittents( self.known_intermittent_results ) - output += u"Tests with known intermittent results:\n" + results + output += "Tests with known intermittent results:\n" + results return self.generate_output(text=output, new_display="") diff --git a/testing/mozbase/mozlog/mozlog/formatters/html/html.py b/testing/mozbase/mozlog/mozlog/formatters/html/html.py index c2cb0d5acc2c..d1b053e6a4f3 100755 --- a/testing/mozbase/mozlog/mozlog/formatters/html/html.py +++ b/testing/mozbase/mozlog/mozlog/formatters/html/html.py @@ -340,4 +340,4 @@ class HTMLFormatter(base.BaseFormatter): ), ) - return u"\n" + doc.unicode(indent=2) + return "\n" + doc.unicode(indent=2) diff --git a/testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py b/testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py index 933958b9f1b2..eda2d8d36a29 100644 --- a/testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py +++ b/testing/mozbase/mozlog/mozlog/formatters/html/xmlgen.py @@ -35,7 +35,6 @@ if sys.version_info >= (3, 0): return x.__unicode__() return str(x) - else: def u(s): @@ -255,7 +254,6 @@ class SimpleUnicodeVisitor(object): class HtmlVisitor(SimpleUnicodeVisitor): - single = dict( [ (x, 1) diff --git a/testing/mozbase/mozlog/mozlog/formatters/process.py b/testing/mozbase/mozlog/mozlog/formatters/process.py index 4b978acf56d0..012c7a080383 100644 --- a/testing/mozbase/mozlog/mozlog/formatters/process.py +++ b/testing/mozbase/mozlog/mozlog/formatters/process.py @@ -27,7 +27,6 @@ def strsig(n): and k != "SIGCLD" and k != "SIGPOLL" ): - _SIG_NAME[getattr(signal, k)] = k # Realtime signals mostly have no names @@ -52,7 +51,7 @@ def strstatus(status): if os.name != "posix": # Windows error codes are easier to look up if printed in hexadecimal if status < 0: - status += 2 ** 32 + status += 2**32 return "exit %x" % status elif status >= 0: return "exit %d" % status diff --git a/testing/mozbase/mozlog/mozlog/handlers/base.py b/testing/mozbase/mozlog/mozlog/handlers/base.py index 59fc05cc1f89..064b1dee0b96 100644 --- a/testing/mozbase/mozlog/mozlog/handlers/base.py +++ b/testing/mozbase/mozlog/mozlog/handlers/base.py @@ -111,7 +111,7 @@ class StreamHandler(BaseHandler): # consequences for the executed tests, anyways). try: self.stream.write(formatted) - except (UnicodeEncodeError): + except UnicodeEncodeError: return else: if isinstance(formatted, six.text_type): diff --git a/testing/mozbase/mozlog/mozlog/handlers/valgrindhandler.py b/testing/mozbase/mozlog/mozlog/handlers/valgrindhandler.py index 49bb4b5b9eaa..0f9b06e8f79b 100644 --- a/testing/mozbase/mozlog/mozlog/handlers/valgrindhandler.py +++ b/testing/mozbase/mozlog/mozlog/handlers/valgrindhandler.py @@ -120,14 +120,14 @@ class ValgrindFilter(object): # fields from the incoming message, since there's nowhere # else to get them from. output_message = { # Mandatory fields - u"action": "valgrind_error", - u"time": msg["time"], - u"thread": msg["thread"], - u"pid": msg["pid"], - u"source": msg["source"], + "action": "valgrind_error", + "time": msg["time"], + "thread": msg["thread"], + "pid": msg["pid"], + "source": msg["source"], # valgrind_error specific fields - u"primary": self.curr_failure_msg, - u"secondary": self.buffered_lines, + "primary": self.curr_failure_msg, + "secondary": self.buffered_lines, } self.curr_failure_msg = "" self.buffered_lines = [] diff --git a/testing/mozbase/mozlog/tests/test_capture.py b/testing/mozbase/mozlog/tests/test_capture.py index 4adbda41801d..6e14e155aa03 100644 --- a/testing/mozbase/mozlog/tests/test_capture.py +++ b/testing/mozbase/mozlog/tests/test_capture.py @@ -30,7 +30,7 @@ class TestCaptureIO(unittest.TestCase): self.assertIn("STDOUT: message 1", messages) self.assertIn("STDOUT: message 2", messages) self.assertIn("STDERR: message 3", messages) - self.assertIn(u"STDOUT: \xff", messages) + self.assertIn("STDOUT: \xff", messages) if __name__ == "__main__": diff --git a/testing/mozbase/mozlog/tests/test_structured.py b/testing/mozbase/mozlog/tests/test_structured.py index 833e856761ca..e8816fc7e9a4 100644 --- a/testing/mozbase/mozlog/tests/test_structured.py +++ b/testing/mozbase/mozlog/tests/test_structured.py @@ -660,7 +660,7 @@ class TestTypeConversions(BaseStructuredTest): b"\xf0\x90\x8d\x84\xf0\x90\x8c\xb4\xf0\x90" b"\x8d\x83\xf0\x90\x8d\x84".decode(), 42, - u"\u16a4", + "\u16a4", ) ) else: @@ -669,13 +669,13 @@ class TestTypeConversions(BaseStructuredTest): "\xf0\x90\x8d\x84\xf0\x90\x8c\xb4\xf0\x90" "\x8d\x83\xf0\x90\x8d\x84", 42, - u"\u16a4", + "\u16a4", ) ) self.assert_log_equals( { "action": "test_start", - "test": (u"\U00010344\U00010334\U00010343\U00010344", u"42", u"\u16a4"), + "test": ("\U00010344\U00010334\U00010343\U00010344", "42", "\u16a4"), } ) self.logger.suite_end() @@ -899,7 +899,7 @@ class TestCommandline(unittest.TestCase): def test_setup_logging_optparse_unicode(self): parser = optparse.OptionParser() commandline.add_logging_group(parser) - args, _ = parser.parse_args([u"--log-raw=-"]) + args, _ = parser.parse_args(["--log-raw=-"]) logger = commandline.setup_logging("test_optparse_unicode", args, {}) self.assertEqual(len(logger.handlers), 1) self.assertEqual(logger.handlers[0].stream, sys.stdout) diff --git a/testing/mozbase/mozpower/tests/test_mozpower.py b/testing/mozbase/mozpower/tests/test_mozpower.py index fd513e836bb6..1ad6194c0ad3 100644 --- a/testing/mozbase/mozpower/tests/test_mozpower.py +++ b/testing/mozbase/mozpower/tests/test_mozpower.py @@ -55,7 +55,6 @@ def test_mozpower_processor_info_missing_error(): # Test failures in macos processor information parsing with mock.patch.object(MozPower, "_get_os", return_value="Darwin") as _: - with mock.patch("os.path.exists") as os_mock: os_mock.side_effect = os_side_effect_false @@ -74,7 +73,6 @@ def test_mozpower_processor_info_missing_error(): # Test failures in linux processor information parsing with mock.patch.object(MozPower, "_get_os", return_value="Linux") as _: - with mock.patch("os.path.exists") as os_mock: os_mock.side_effect = os_side_effect_false diff --git a/testing/mozbase/mozprocess/mozprocess/processhandler.py b/testing/mozbase/mozprocess/mozprocess/processhandler.py index 2e106456a25b..58e0a819326e 100644 --- a/testing/mozbase/mozprocess/mozprocess/processhandler.py +++ b/testing/mozbase/mozprocess/mozprocess/processhandler.py @@ -116,7 +116,6 @@ class ProcessHandlerMixin(object): ignore_children=False, encoding="utf-8", ): - # Parameter for whether or not we should attempt to track child processes self._ignore_children = ignore_children self._job = None diff --git a/testing/mozbase/mozprofile/mozprofile/cli.py b/testing/mozbase/mozprofile/mozprofile/cli.py index 7addb1165d35..104f6bd08c79 100755 --- a/testing/mozbase/mozprofile/mozprofile/cli.py +++ b/testing/mozbase/mozprofile/mozprofile/cli.py @@ -90,7 +90,6 @@ class MozProfileCLI(object): (self.options, self.args) = self.parser.parse_args(args) def add_options(self, parser): - parser.add_option( "-p", "--profile", diff --git a/testing/mozbase/mozprofile/mozprofile/diff.py b/testing/mozbase/mozprofile/mozprofile/diff.py index f8376e4d7b14..192b59cd9ee2 100644 --- a/testing/mozbase/mozprofile/mozprofile/diff.py +++ b/testing/mozbase/mozprofile/mozprofile/diff.py @@ -18,7 +18,6 @@ __all__ = ["diff", "diff_profiles"] def diff(profile1, profile2, diff_function=difflib.unified_diff): - profiles = (profile1, profile2) parts = {} parts_dict = {} @@ -59,7 +58,6 @@ def diff(profile1, profile2, diff_function=difflib.unified_diff): def diff_profiles(args=sys.argv[1:]): - # parse command line usage = "%prog [options] profile1 profile2" parser = optparse.OptionParser(usage=usage, description=__doc__) diff --git a/testing/mozbase/mozprofile/mozprofile/profile.py b/testing/mozbase/mozprofile/mozprofile/profile.py index 401715c93d8a..25e10d23bfef 100644 --- a/testing/mozbase/mozprofile/mozprofile/profile.py +++ b/testing/mozbase/mozprofile/mozprofile/profile.py @@ -410,7 +410,6 @@ class Profile(BaseProfile): for prefs_file in ("user.js", "prefs.js"): path = os.path.join(self.profile, prefs_file) if os.path.exists(path): - # prefs that get their own section # This is currently only 'network.proxy.autoconfig_url' # but could be expanded to include others diff --git a/testing/mozbase/mozprofile/mozprofile/view.py b/testing/mozbase/mozprofile/mozprofile/view.py index 93566232324c..455751148b25 100644 --- a/testing/mozbase/mozprofile/mozprofile/view.py +++ b/testing/mozbase/mozprofile/mozprofile/view.py @@ -17,7 +17,6 @@ __all__ = ["view_profile"] def view_profile(args=sys.argv[1:]): - usage = "%prog [options] profile_path <...>" parser = optparse.OptionParser(usage=usage, description=__doc__) options, args = parser.parse_args(args) diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py index f9c30c9b0ecb..916477b0948a 100644 --- a/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py +++ b/testing/mozbase/mozproxy/mozproxy/backends/mitm/desktop.py @@ -137,7 +137,6 @@ class MitmproxyDesktop(Mitmproxy): ) in contents: LOG.info("Verified mitmproxy CA certificate is installed in Firefox") else: - return False except Exception as e: LOG.info("failed to read Firefox policies file, exeption: %s" % e) diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py index e7689d27a65f..5ef19282df7b 100644 --- a/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py +++ b/testing/mozbase/mozproxy/mozproxy/backends/mitm/mitm.py @@ -178,7 +178,6 @@ class Mitmproxy(Playback): raise Exception("playback_files should be a list") for playback_file in self.config["playback_files"]: - if playback_file.startswith("https://") and "mozilla.com" in playback_file: # URL provided dest = os.path.join(self.mozproxy_dir, os.path.basename(playback_file)) @@ -271,7 +270,6 @@ class Mitmproxy(Playback): # record mode if self.record_mode: - # generate recording script paths command.extend( diff --git a/testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/inject-deterministic.py b/testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/inject-deterministic.py index 70536d76e684..7134643d6a90 100644 --- a/testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/inject-deterministic.py +++ b/testing/mozbase/mozproxy/mozproxy/backends/mitm/scripts/inject-deterministic.py @@ -128,7 +128,6 @@ class AddDeterministic: with open( path.join(path.dirname(__file__), "catapult/deterministic.js"), "r" ) as jsfile: - js = jsfile.read().replace( "REPLACE_LOAD_TIMESTAMP", str(self.millis) ) diff --git a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py index 6016425c8a15..45565349f513 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/android_device.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/android_device.py @@ -176,7 +176,6 @@ AVD_DICT = { def _get_device(substs, device_serial=None): - adb_path = _find_sdk_exe(substs, "adb", False) if not adb_path: adb_path = "adb" diff --git a/testing/mozbase/mozrunner/mozrunner/devices/base.py b/testing/mozbase/mozrunner/mozrunner/devices/base.py index d1fa66005274..88db2065d80f 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/base.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/base.py @@ -242,12 +242,12 @@ class ProfileConfigParser(RawConfigParser): def write(self, fp): if self._defaults: fp.write("[%s]\n" % ConfigParser.DEFAULTSECT) - for (key, value) in self._defaults.items(): + for key, value in self._defaults.items(): fp.write("%s=%s\n" % (key, str(value).replace("\n", "\n\t"))) fp.write("\n") for section in self._sections: fp.write("[%s]\n" % section) - for (key, value) in self._sections[section].items(): + for key, value in self._sections[section].items(): if key == "__name__": continue if (value is not None) or (self._optcre == self.OPTCRE): diff --git a/testing/mozbase/mozrunner/mozrunner/utils.py b/testing/mozbase/mozrunner/mozrunner/utils.py index 5bfaede7313e..46c20c1997b3 100755 --- a/testing/mozbase/mozrunner/mozrunner/utils.py +++ b/testing/mozbase/mozrunner/mozrunner/utils.py @@ -47,7 +47,6 @@ try: ret["Dependencies"] = "\n" + dist.get_metadata("requires.txt") return ret - except ImportError: # package resources not avaialable def get_metadata_from_egg(module): diff --git a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py index 847d3e8d3da5..824863cbb604 100644 --- a/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py +++ b/testing/mozbase/mozsystemmonitor/mozsystemmonitor/resourcemonitor.py @@ -118,7 +118,6 @@ def _collect(pipe, poll_interval): data = [] try: - # Establish initial values. # We should ideally use a monotonic clock. However, Python 2.7 doesn't @@ -178,7 +177,6 @@ def _collect(pipe, poll_interval): warnings.warn("_collect failed: %s" % e) finally: - for entry in data: pipe.send(entry) diff --git a/testing/mozbase/moztest/moztest/adapters/unit.py b/testing/mozbase/moztest/moztest/adapters/unit.py index 72c2f3005218..4273adf35322 100644 --- a/testing/mozbase/moztest/moztest/adapters/unit.py +++ b/testing/mozbase/moztest/moztest/adapters/unit.py @@ -169,7 +169,6 @@ class StructuredTestResult(TextTestResult): class StructuredTestRunner(unittest.TextTestRunner): - resultclass = StructuredTestResult def __init__(self, **kwargs): diff --git a/testing/mozbase/mozversion/mozversion/mozversion.py b/testing/mozbase/mozversion/mozversion/mozversion.py index bea53e0a6d7a..9a93bf4e20b5 100644 --- a/testing/mozbase/mozversion/mozversion/mozversion.py +++ b/testing/mozbase/mozversion/mozversion/mozversion.py @@ -126,7 +126,7 @@ def get_version(binary=None): else: version = LocalVersion(binary) - for (key, value) in sorted(version._info.items()): + for key, value in sorted(version._info.items()): if value: version._logger.info("%s: %s" % (key, value)) diff --git a/testing/mozbase/setup_development.py b/testing/mozbase/setup_development.py index af065922d363..73aba7aaee8d 100755 --- a/testing/mozbase/setup_development.py +++ b/testing/mozbase/setup_development.py @@ -145,7 +145,6 @@ def unroll_dependencies(dependencies): packages.update(deps) while len(order) != len(packages): - for package in packages.difference(order): if set(dependencies.get(package, set())).issubset(order): order.append(package) @@ -159,7 +158,6 @@ def unroll_dependencies(dependencies): def main(args=sys.argv[1:]): - # parse command line options usage = "%prog [options] [package] [package] [...]" parser = OptionParser(usage=usage, description=__doc__) diff --git a/testing/mozharness/examples/venv.py b/testing/mozharness/examples/venv.py index 82ee3d0109ce..ee16162ceae4 100755 --- a/testing/mozharness/examples/venv.py +++ b/testing/mozharness/examples/venv.py @@ -17,6 +17,7 @@ from mozharness.base.errors import PythonErrorList from mozharness.base.python import virtualenv_config_options, VirtualenvMixin from mozharness.base.script import BaseScript + # VirtualenvExample {{{1 class VirtualenvExample(VirtualenvMixin, BaseScript): config_options = [ diff --git a/testing/mozharness/external_tools/mouse_and_screen_resolution.py b/testing/mozharness/external_tools/mouse_and_screen_resolution.py index ad1f8d9e4b8e..db78c1c32166 100755 --- a/testing/mozharness/external_tools/mouse_and_screen_resolution.py +++ b/testing/mozharness/external_tools/mouse_and_screen_resolution.py @@ -51,7 +51,6 @@ def wfetch(url, retries=5): def main(): - # NOTE: this script was written for windows 7, but works well with windows 10 parser = OptionParser() parser.add_option( diff --git a/testing/mozharness/mozharness/base/config.py b/testing/mozharness/mozharness/base/config.py index d12b3aecad96..d97bcb6a933b 100644 --- a/testing/mozharness/mozharness/base/config.py +++ b/testing/mozharness/mozharness/base/config.py @@ -100,7 +100,7 @@ class ReadOnlyDict(dict): assert not self._lock, "ReadOnlyDict is locked!" def lock(self): - for (k, v) in list(self.items()): + for k, v in list(self.items()): self[k] = make_immutable(v) self._lock = True diff --git a/testing/mozharness/mozharness/base/python.py b/testing/mozharness/mozharness/base/python.py index 1d20786681b2..2f281e7766f2 100644 --- a/testing/mozharness/mozharness/base/python.py +++ b/testing/mozharness/mozharness/base/python.py @@ -508,7 +508,6 @@ class VirtualenvMixin(object): ) if debug_exe_dir.exists(): - for executable in { "python.exe", "python_d.exe", diff --git a/testing/mozharness/mozharness/base/script.py b/testing/mozharness/mozharness/base/script.py index 978ac8616d53..e2272036b02b 100644 --- a/testing/mozharness/mozharness/base/script.py +++ b/testing/mozharness/mozharness/base/script.py @@ -201,7 +201,7 @@ class PlatformMixin(object): if self._is_darwin(): # osx is a special snowflake and to ensure the arch, it is better to use the following return ( - sys.maxsize > 2 ** 32 + sys.maxsize > 2**32 ) # context: https://docs.python.org/2/library/platform.html else: # Using machine() gives you the architecture of the host rather @@ -578,7 +578,7 @@ class ScriptMixin(PlatformMixin): else: local_file = open(file_name, "wb") while True: - block = f.read(1024 ** 2) + block = f.read(1024**2) if not block: if f_length is not None and got_length != f_length: raise URLError( diff --git a/testing/mozharness/mozharness/mozilla/testing/android.py b/testing/mozharness/mozharness/mozilla/testing/android.py index 7e1770755284..37a57747caee 100644 --- a/testing/mozharness/mozharness/mozilla/testing/android.py +++ b/testing/mozharness/mozharness/mozilla/testing/android.py @@ -291,7 +291,6 @@ class AndroidMixin(object): dir = self.query_abs_dirs()["abs_blob_upload_dir"] perf_path = os.path.join(dir, "android-performance.log") with open(perf_path, "w") as f: - f.write("\n\nHost cpufreq/scaling_governor:\n") cpus = glob.glob("/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor") for cpu in cpus: @@ -473,7 +472,7 @@ class AndroidMixin(object): return self.device.shell_output( cmd, timeout=30, enable_run_as=enable_run_as ) - except (mozdevice.ADBTimeoutError) as e: + except mozdevice.ADBTimeoutError as e: self.info( "Failed to run shell command %s from %s: %s %s" % (cmd, self.device_name, type(e).__name__, e) diff --git a/testing/mozharness/mozharness/mozilla/testing/per_test_base.py b/testing/mozharness/mozharness/mozilla/testing/per_test_base.py index f93a9a09d709..fb5eda2b9132 100644 --- a/testing/mozharness/mozharness/mozilla/testing/per_test_base.py +++ b/testing/mozharness/mozharness/mozilla/testing/per_test_base.py @@ -71,7 +71,7 @@ class SingleTestMixin(object): # HACK: import here so we don't need import for rest of class from manifestparser import TestManifest - for (path, suite) in manifests: + for path, suite in manifests: if os.path.exists(path): man = TestManifest([path], strict=False) active = man.active_tests( @@ -122,7 +122,7 @@ class SingleTestMixin(object): import manifest self.reftest_test_dir = os.path.join(dirs["abs_reftest_dir"], "tests") - for (path, suite, subsuite) in ref_manifests: + for path, suite, subsuite in ref_manifests: if os.path.exists(path): man = manifest.ReftestManifest() man.load(path) @@ -282,7 +282,7 @@ class SingleTestMixin(object): repo_tests_path = os.path.join("testing", "web-platform", extra, "tests") tests_path = os.path.join("tests", "web-platform", extra, "tests") - for (type, path, test) in man: + for type, path, test in man: if type not in ["testharness", "reftest", "wdspec"]: continue repo_path = os.path.join(repo_tests_path, path) diff --git a/testing/mozharness/mozharness/mozilla/testing/testbase.py b/testing/mozharness/mozharness/mozilla/testing/testbase.py index e8f37ceb8bee..1519ff112c2a 100755 --- a/testing/mozharness/mozharness/mozilla/testing/testbase.py +++ b/testing/mozharness/mozharness/mozilla/testing/testbase.py @@ -301,6 +301,7 @@ class TestingMixin( This function helps dealing with downloading files while outside of the releng network. """ + # Code based on http://code.activestate.com/recipes/305288-http-basic-authentication def _urlopen_basic_auth(url, **kwargs): self.info("We want to download this file %s" % url) diff --git a/testing/mozharness/scripts/android_emulator_unittest.py b/testing/mozharness/scripts/android_emulator_unittest.py index 47cf13dde3e5..9f51f2ad4435 100644 --- a/testing/mozharness/scripts/android_emulator_unittest.py +++ b/testing/mozharness/scripts/android_emulator_unittest.py @@ -399,7 +399,7 @@ class AndroidEmulatorTest( ("xpcshell", {"xpcshell": "xpcshell"}), ] suites = [] - for (category, all_suites) in all: + for category, all_suites in all: cat_suites = self.query_per_test_category_suites(category, all_suites) for k in cat_suites.keys(): suites.append((k, cat_suites[k])) @@ -472,7 +472,7 @@ class AndroidEmulatorTest( per_test_args = [] suites = self._query_suites() minidump = self.query_minidump_stackwalk() - for (per_test_suite, suite) in suites: + for per_test_suite, suite in suites: self.test_suite = suite try: diff --git a/testing/mozharness/scripts/android_hardware_unittest.py b/testing/mozharness/scripts/android_hardware_unittest.py index 065d74557bc0..3abd79f0e24d 100644 --- a/testing/mozharness/scripts/android_hardware_unittest.py +++ b/testing/mozharness/scripts/android_hardware_unittest.py @@ -327,7 +327,7 @@ class AndroidHardwareTest( ("xpcshell", {"xpcshell": "xpcshell"}), ] suites = [] - for (category, all_suites) in all: + for category, all_suites in all: cat_suites = self.query_per_test_category_suites(category, all_suites) for k in cat_suites.keys(): suites.append((k, cat_suites[k])) @@ -401,7 +401,7 @@ class AndroidHardwareTest( per_test_args = [] suites = self._query_suites() minidump = self.query_minidump_stackwalk() - for (per_test_suite, suite) in suites: + for per_test_suite, suite in suites: self.test_suite = suite try: diff --git a/testing/mozharness/scripts/awsy_script.py b/testing/mozharness/scripts/awsy_script.py index 9071dab75d78..e54a342ca65a 100644 --- a/testing/mozharness/scripts/awsy_script.py +++ b/testing/mozharness/scripts/awsy_script.py @@ -93,7 +93,6 @@ class AWSY(TestingMixin, MercurialScript, TooltoolMixin, CodeCoverageMixin): ] def __init__(self, **kwargs): - kwargs.setdefault("config_options", self.config_options) kwargs.setdefault( "all_actions", diff --git a/testing/mozharness/scripts/does_it_crash.py b/testing/mozharness/scripts/does_it_crash.py index ad81e87e2a18..6a9ffe3e355b 100755 --- a/testing/mozharness/scripts/does_it_crash.py +++ b/testing/mozharness/scripts/does_it_crash.py @@ -120,7 +120,6 @@ class DoesItCrash(BaseScript): self.error("unable to terminate process!") def run_thing(self): - self.timed_out = False def timeout_handler(proc): diff --git a/testing/mozharness/scripts/openh264_build.py b/testing/mozharness/scripts/openh264_build.py index 1c6089e3f193..a0965af0af98 100755 --- a/testing/mozharness/scripts/openh264_build.py +++ b/testing/mozharness/scripts/openh264_build.py @@ -103,7 +103,6 @@ class OpenH264Build(TransferMixin, VCSScript, TooltoolMixin): all_actions=all_actions, default_actions=default_actions, ): - # Default configuration default_config = { "debug_build": False, diff --git a/testing/mozharness/test/test_base_script.py b/testing/mozharness/test/test_base_script.py index 8acb63005362..d61cc5f57603 100644 --- a/testing/mozharness/test/test_base_script.py +++ b/testing/mozharness/test/test_base_script.py @@ -483,13 +483,13 @@ class TestHelperFunctions(unittest.TestCase): self.s = script.BaseScript(initial_config_file="test/test.json") # create a very long path that the command-prompt cannot delete # by using unicode format (max path length 32000) - path = u"\\\\?\\%s\\test_dir" % os.getcwd() - win32file.CreateDirectoryExW(u".", path) + path = "\\\\?\\%s\\test_dir" % os.getcwd() + win32file.CreateDirectoryExW(".", path) for x in range(0, 20): print("path=%s" % path) - path = path + u"\\%sxxxxxxxxxxxxxxxxxxxx" % x - win32file.CreateDirectoryExW(u".", path) + path = path + "\\%sxxxxxxxxxxxxxxxxxxxx" % x + win32file.CreateDirectoryExW(".", path) self.s.rmtree("test_dir") self.assertFalse(os.path.exists("test_dir"), msg="rmtree unsuccessful") diff --git a/testing/performance/hooks_recording.py b/testing/performance/hooks_recording.py index 63cc65caa0ea..bfa61469d132 100644 --- a/testing/performance/hooks_recording.py +++ b/testing/performance/hooks_recording.py @@ -24,7 +24,6 @@ SCM_1_LOGIN_SITES = ("facebook", "netflix") def before_iterations(kw): - global next_site print("Setting up next site to record.") diff --git a/testing/raptor/raptor/browsertime/base.py b/testing/raptor/raptor/browsertime/base.py index 1da49f1a31f6..addb357c2be1 100644 --- a/testing/raptor/raptor/browsertime/base.py +++ b/testing/raptor/raptor/browsertime/base.py @@ -8,7 +8,6 @@ import json import os import pathlib import re -import signal import sys from abc import ABCMeta, abstractmethod from copy import deepcopy @@ -39,11 +38,12 @@ class Browsertime(Perftest): def browsertime_args(self): pass - def __init__(self, app, binary, **kwargs): + def __init__(self, app, binary, process_handler=None, **kwargs): self.browsertime = True self.browsertime_failure = "" self.browsertime_user_args = [] + self.process_handler = process_handler or mozprocess.ProcessHandler for key in list(kwargs): if key.startswith("browsertime_"): value = kwargs.pop(key) @@ -765,27 +765,9 @@ class Browsertime(Perftest): return True - def kill(self, proc): - if "win" in self.config["platform"]: - proc.send_signal(signal.CTRL_BREAK_EVENT) - else: - os.killpg(proc.pid, signal.SIGKILL) - proc.wait() - def run_extra_profiler_run( self, test, timeout, proc_timeout, output_timeout, line_handler, env ): - self.timed_out = False - self.output_timed_out = False - - def timeout_handler(proc): - self.timed_out = True - self.kill(proc) - - def output_timeout_handler(proc): - self.output_timed_out = True - self.kill(proc) - try: LOG.info( "Running browsertime with the profiler enabled after the main run." @@ -795,25 +777,18 @@ class Browsertime(Perftest): LOG.info( "browsertime profiling cmd: {}".format(" ".join([str(c) for c in cmd])) ) - mozprocess.run_and_wait( - cmd, - output_line_handler=line_handler, - env=env, - timeout=proc_timeout, - timeout_handler=timeout_handler, - output_timeout=output_timeout, - output_timeout_handler=output_timeout_handler, - text=False, - ) + proc = self.process_handler(cmd, processOutputLine=line_handler, env=env) + proc.run(timeout=proc_timeout, outputTimeout=output_timeout) + proc.wait() # Do not raise exception for the browsertime failure or timeout for this case. # Second profiler browsertime run is fallible. - if self.output_timed_out: + if proc.outputTimedOut: LOG.info( "Browsertime process for extra profiler run timed out after " f"waiting {output_timeout} seconds for output" ) - if self.timed_out: + if proc.timedOut: LOG.info( "Browsertime process for extra profiler run timed out after " f"{proc_timeout} seconds" @@ -828,17 +803,6 @@ class Browsertime(Perftest): LOG.info("Failed during the extra profiler run: " + str(e)) def run_test(self, test, timeout): - self.timed_out = False - self.output_timed_out = False - - def timeout_handler(proc): - self.timed_out = True - self.kill(proc) - - def output_timeout_handler(proc): - self.output_timed_out = True - self.kill(proc) - self.run_test_setup(test) # timeout is a single page-load timeout value (ms) from the test INI # this will be used for btime --timeouts.pageLoad @@ -873,6 +837,9 @@ class Browsertime(Perftest): ffmpeg_dir = os.path.dirname(os.path.abspath(self.browsertime_ffmpeg)) old_path = env.setdefault("PATH", "") new_path = os.pathsep.join([ffmpeg_dir, old_path]) + if isinstance(new_path, six.text_type): + # Python 2 doesn't like unicode in the environment. + new_path = new_path.encode("utf-8", "strict") env["PATH"] = new_path LOG.info("PATH: {}".format(env["PATH"])) @@ -881,7 +848,7 @@ class Browsertime(Perftest): line_matcher = re.compile(r".*(\[.*\])\s+([a-zA-Z]+):\s+(.*)") def _create_line_handler(extra_profiler_run=False): - def _line_handler(proc, line): + def _line_handler(line): """This function acts as a bridge between browsertime and raptor. It reforms the lines to get rid of information that is not needed, and outputs them appropriately based @@ -951,23 +918,18 @@ class Browsertime(Perftest): f"and output_timeout={output_timeout}" ) - mozprocess.run_and_wait( - cmd, - output_line_handler=_create_line_handler(), - env=env, - timeout=proc_timeout, - timeout_handler=timeout_handler, - output_timeout=output_timeout, - output_timeout_handler=output_timeout_handler, - text=False, + proc = self.process_handler( + cmd, processOutputLine=_create_line_handler(), env=env ) + proc.run(timeout=proc_timeout, outputTimeout=output_timeout) + proc.wait() - if self.output_timed_out: + if proc.outputTimedOut: raise Exception( f"Browsertime process timed out after waiting {output_timeout} seconds " "for output" ) - if self.timed_out: + if proc.timedOut: raise Exception( f"Browsertime process timed out after {proc_timeout} seconds" ) diff --git a/testing/raptor/raptor/filters.py b/testing/raptor/raptor/filters.py index f779430d4d52..87b0d827e603 100644 --- a/testing/raptor/raptor/filters.py +++ b/testing/raptor/raptor/filters.py @@ -64,7 +64,6 @@ def register_filter(func): def filters(*args): - filters_ = [_FILTERS[filter] for filter in args] return filters_ diff --git a/testing/raptor/raptor/output.py b/testing/raptor/raptor/output.py index 260167a7ca27..4ee7ebec3056 100644 --- a/testing/raptor/raptor/output.py +++ b/testing/raptor/raptor/output.py @@ -114,7 +114,6 @@ class PerftestOutput(object): support_data_by_type = {} for data_set in self.supporting_data: - data_type = data_set["type"] LOG.info("summarizing %s data" % data_type) @@ -1353,7 +1352,6 @@ class RaptorOutput(PerftestOutput): subtests.append(new_subtest) elif test["type"] == "benchmark": - if any( [ "youtube-playback" in measurement diff --git a/testing/raptor/raptor/perftest.py b/testing/raptor/raptor/perftest.py index c1a9bb94d814..939b32ddb6ad 100644 --- a/testing/raptor/raptor/perftest.py +++ b/testing/raptor/raptor/perftest.py @@ -505,7 +505,6 @@ class Perftest(object): # run is added with extra_profiler_run flag. if self.config["gecko_profile"] or self.config.get("extra_profiler_run"): if self.config["app"] == "firefox": - self.gecko_profiler.symbolicate() # clean up the temp gecko profiling folders LOG.info("cleaning up after gecko profiling") diff --git a/testing/talos/INSTALL.py b/testing/talos/INSTALL.py index 73edfbb7b5e4..6bdbfa13fa7f 100755 --- a/testing/talos/INSTALL.py +++ b/testing/talos/INSTALL.py @@ -36,7 +36,6 @@ def which(binary, path=os.environ["PATH"]): def main(args=sys.argv[1:]): - # sanity check # ensure setup.py exists setup_py = os.path.join(here, "setup.py") diff --git a/testing/talos/talos/cmanager_base.py b/testing/talos/talos/cmanager_base.py index 2a91c8c48f2d..54c0c1bda9d8 100644 --- a/testing/talos/talos/cmanager_base.py +++ b/testing/talos/talos/cmanager_base.py @@ -4,7 +4,6 @@ class CounterManager(object): - counterDict = {} def __init__(self): diff --git a/testing/talos/talos/cmanager_linux.py b/testing/talos/talos/cmanager_linux.py index c0741b2c6a12..81f220aaba2b 100644 --- a/testing/talos/talos/cmanager_linux.py +++ b/testing/talos/talos/cmanager_linux.py @@ -82,7 +82,6 @@ def GetPrivateBytes(pids): for pid in pids: mapfile = "/proc/%s/maps" % pid with open(mapfile) as maps: - private = 0 for line in maps: @@ -113,7 +112,6 @@ def GetResidentSize(pids): file = "/proc/%s/status" % pid with open(file) as status: - for line in status: if line.find("VmRSS") >= 0: RSS += int(line.split()[1]) * 1024 diff --git a/testing/talos/talos/results.py b/testing/talos/talos/results.py index 73ebd56ed349..801c18a0cc3f 100755 --- a/testing/talos/talos/results.py +++ b/testing/talos/talos/results.py @@ -40,7 +40,6 @@ class TalosResults(object): - output_formats: a dict mapping formats to a list of URLs """ try: - for key, urls in output_formats.items(): _output = output.Output(self, Results) results = _output() @@ -377,7 +376,6 @@ class BrowserLogResults(object): # parse the timestamps for attr, tokens in self.time_tokens: - # parse the token contents value, _last_token = self.get_single_token(*tokens) diff --git a/testing/talos/talos/run_tests.py b/testing/talos/talos/run_tests.py index d1c7299429b1..64c8b2d3b69f 100755 --- a/testing/talos/talos/run_tests.py +++ b/testing/talos/talos/run_tests.py @@ -456,7 +456,6 @@ def make_comparison_result(base_and_reference_results): # each set of two results is actually a base test followed by the # reference test; we want to go through each set of base vs reference for x in range(0, len(base_and_reference_results.results[0].results), 2): - # separate the 'base' and 'reference' result run values results = base_and_reference_results.results[0].results base_result_runs = results[x]["runs"] diff --git a/testing/talos/talos/talosconfig.py b/testing/talos/talos/talosconfig.py index a3f0d6f8070f..d3dc64cd0d8a 100644 --- a/testing/talos/talos/talosconfig.py +++ b/testing/talos/talos/talosconfig.py @@ -36,7 +36,6 @@ def generateTalosConfig(command_line, browser_config, test_config, pid=None): and ("xperf_user_providers" in test_config) and ("xperf_stackwalk" in test_config) ): # noqa - print("extending with xperf!") browser_config["xperf_providers"] = test_config["xperf_providers"] browser_config["xperf_user_providers"] = test_config["xperf_user_providers"] diff --git a/testing/talos/talos/unittests/conftest.py b/testing/talos/talos/unittests/conftest.py index 8b31038b752d..96cc9ca9b961 100644 --- a/testing/talos/talos/unittests/conftest.py +++ b/testing/talos/talos/unittests/conftest.py @@ -10,7 +10,6 @@ __TESTS_DIR = os.path.join(os.path.dirname(os.path.dirname(here)), "tests") def remove_develop_files(starting_dir=__TESTS_DIR): for file_name in os.listdir(starting_dir): - file_path = os.path.join(starting_dir, file_name) if file_name.endswith(".develop") and os.path.isfile(file_path): diff --git a/testing/talos/talos/xtalos/etlparser.py b/testing/talos/talos/xtalos/etlparser.py index 10fa5c64d3d6..5bbfa913f5d5 100644 --- a/testing/talos/talos/xtalos/etlparser.py +++ b/testing/talos/talos/xtalos/etlparser.py @@ -610,7 +610,6 @@ def etlparser_from_config(config_file, **kwargs): def main(args=sys.argv[1:]): - # parse command line arguments parser = xtalos.XtalosOptions() args = parser.parse_args(args) diff --git a/testing/talos/talos/xtalos/parse_xperf.py b/testing/talos/talos/xtalos/parse_xperf.py index 8daff86d6b84..eef9c7a9b189 100644 --- a/testing/talos/talos/xtalos/parse_xperf.py +++ b/testing/talos/talos/xtalos/parse_xperf.py @@ -107,7 +107,6 @@ def stop_from_config(config_file=None, debug=False, **kwargs): def main(args=sys.argv[1:]): - # parse command line arguments parser = xtalos.XtalosOptions() args = parser.parse_args(args) diff --git a/testing/talos/talos/xtalos/start_xperf.py b/testing/talos/talos/xtalos/start_xperf.py index 5f4e12079645..87cc6dc029ac 100644 --- a/testing/talos/talos/xtalos/start_xperf.py +++ b/testing/talos/talos/xtalos/start_xperf.py @@ -18,7 +18,6 @@ def start( etl_filename, debug=False, ): - xperf_cmd = [ xperf_path, "-on", @@ -86,7 +85,6 @@ def start_from_config(config_file=None, debug=False, **kwargs): def main(args=sys.argv[1:]): - # parse command line options parser = xtalos.XtalosOptions() args = parser.parse_args(args) diff --git a/testing/talos/talos/xtalos/xperf_analyzer.py b/testing/talos/talos/xtalos/xperf_analyzer.py index 0d218fcda344..833dc9960a6e 100644 --- a/testing/talos/talos/xtalos/xperf_analyzer.py +++ b/testing/talos/talos/xtalos/xperf_analyzer.py @@ -306,7 +306,7 @@ class XPerfCounter(XPerfAttribute): def accumulate(self, evt): data = evt.get_whiteboard() - for (key, comp) in six.iteritems(self.filters): + for key, comp in six.iteritems(self.filters): try: testdata = data[key] except KeyError: @@ -335,7 +335,7 @@ class XPerfCounter(XPerfAttribute): ) if self.values: msg += " with accumulated" - for (k, v) in six.iteritems(self.values): + for k, v in six.iteritems(self.values): msg += " [[{!s}] == {!s}]".format((k), (v)) return msg diff --git a/testing/talos/talos/xtalos/xtalos.py b/testing/talos/talos/xtalos/xtalos.py index 632fb59c4280..fad7afa0debb 100644 --- a/testing/talos/talos/xtalos/xtalos.py +++ b/testing/talos/talos/xtalos/xtalos.py @@ -154,7 +154,6 @@ class XtalosOptions(argparse.ArgumentParser): self.set_defaults(**defaults) def verifyOptions(self, options): - # override options from config file if options.configFile: options_from_config(options.__dict__, options.configFile) diff --git a/testing/tps/tps/firefoxrunner.py b/testing/tps/tps/firefoxrunner.py index e82392c6c03f..7225ab960cbc 100644 --- a/testing/tps/tps/firefoxrunner.py +++ b/testing/tps/tps/firefoxrunner.py @@ -12,7 +12,6 @@ from mozrunner import FirefoxRunner class TPSFirefoxRunner(object): - PROCESS_TIMEOUT = 240 def __init__(self, binary): diff --git a/testing/tps/tps/phase.py b/testing/tps/tps/phase.py index f51cf9e4c692..af40664c36b7 100644 --- a/testing/tps/tps/phase.py +++ b/testing/tps/tps/phase.py @@ -7,7 +7,6 @@ import re class TPSTestPhase(object): - lineRe = re.compile( r"^(.*?)test phase (?P[^\s]+): (?P.*)$" ) @@ -63,7 +62,6 @@ class TPSTestPhase(object): found_test = False f = open(self.logfile, "r") for line in f: - # skip to the part of the log file that deals with the test we're running if not found_test: if line.find("Running test %s" % self.testname) > -1: diff --git a/testing/tps/tps/testrunner.py b/testing/tps/tps/testrunner.py index f18c89fe90c8..9c3c135311a9 100644 --- a/testing/tps/tps/testrunner.py +++ b/testing/tps/tps/testrunner.py @@ -45,7 +45,6 @@ class TempFile(object): class TPSTestRunner(object): - extra_env = { "MOZ_CRASHREPORTER_DISABLE": "1", "GNOME_DISABLE_CRASH_DIALOG": "1", @@ -425,7 +424,6 @@ class TPSTestRunner(object): traceback.print_exc() else: try: - self.writeToResultFile(self.postdata) except Exception: traceback.print_exc() @@ -463,7 +461,7 @@ class TPSTestRunner(object): f.close() testfiles = json.loads(jsondata) testlist = [] - for (filename, meta) in testfiles["tests"].items(): + for filename, meta in testfiles["tests"].items(): skip_reason = meta.get("disabled") if skip_reason: print("Skipping test {} - {}".format(filename, skip_reason)) diff --git a/testing/web-platform/mozilla/tests/service-workers/resources/fetch_video.py b/testing/web-platform/mozilla/tests/service-workers/resources/fetch_video.py index 541f00c01981..3945506f3037 100644 --- a/testing/web-platform/mozilla/tests/service-workers/resources/fetch_video.py +++ b/testing/web-platform/mozilla/tests/service-workers/resources/fetch_video.py @@ -2,7 +2,7 @@ import os def main(request, response): - filename = os.path.join(request.doc_root, u"media", u"2x2-green.ogv") + filename = os.path.join(request.doc_root, "media", "2x2-green.ogv") body = open(filename, "rb").read() length = len(body) headers = [ diff --git a/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py b/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py index ee9e1f8e06a8..e76f6cabafca 100644 --- a/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py +++ b/testing/webcompat/interventions/tests/test_1570108_steamcommunity.py @@ -32,7 +32,7 @@ async def do_2fa(client): client.await_element_hidden(loader) for digit in digits: if digit.property("value"): - digit.send_keys(u"\ue003") # backspace + digit.send_keys("\ue003") # backspace code = input("**** Enter two-factor authentication code: ") for i, digit in enumerate(code): diff --git a/testing/webcompat/interventions/tests/test_1836109_watch_tonton_com_my.py b/testing/webcompat/interventions/tests/test_1836109_watch_tonton_com_my.py index e005aa57840a..e36eaaa53a53 100644 --- a/testing/webcompat/interventions/tests/test_1836109_watch_tonton_com_my.py +++ b/testing/webcompat/interventions/tests/test_1836109_watch_tonton_com_my.py @@ -8,6 +8,7 @@ LOGIN_CSS = ".login-page-container" # The site can take a little time to load, and this includes # interstitial ads, so for now we give it 10 seconds. + # Skip Android as the site blocks many Android devices including the emulator @pytest.mark.skip_platforms("android") @pytest.mark.asyncio diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py index 75b5619b1a48..100b1bfd18b9 100755 --- a/testing/xpcshell/runxpcshelltests.py +++ b/testing/xpcshell/runxpcshelltests.py @@ -2012,10 +2012,10 @@ class XPCShellTests(object): maxTime = timedelta(seconds=options["verifyMaxTime"]) for test_object in self.alltests: stepResults = {} - for (descr, step) in steps: + for descr, step in steps: stepResults[descr] = "not run / incomplete" finalResult = "PASSED" - for (descr, step) in steps: + for descr, step in steps: if (datetime.now() - startTime) > maxTime: self.log.info( "::: Test verification is taking too long: Giving up!" diff --git a/toolkit/components/crashes/gen_CrashManager.py b/toolkit/components/crashes/gen_CrashManager.py index 34cde771fe8f..7c0ba8ab9087 100644 --- a/toolkit/components/crashes/gen_CrashManager.py +++ b/toolkit/components/crashes/gen_CrashManager.py @@ -49,7 +49,7 @@ def main(o, crashManager): subst = [gen_process_map(), gen_process_pings()] with open(crashManager, "r") as src: for l in src.readlines(): - for (id, value) in subst: + for id, value in subst: if id in l: l = l.replace(id, value) o.write(l) diff --git a/toolkit/components/featuregates/gen_feature_definitions.py b/toolkit/components/featuregates/gen_feature_definitions.py index 14cdad363745..da4a9fe177bb 100755 --- a/toolkit/components/featuregates/gen_feature_definitions.py +++ b/toolkit/components/featuregates/gen_feature_definitions.py @@ -143,7 +143,7 @@ def expand_feature(feature): new_key = hyphens_to_camel_case(key) key_changes.append((key, new_key)) - for (old_key, new_key) in key_changes: + for old_key, new_key in key_changes: feature[new_key] = feature[old_key] del feature[old_key] diff --git a/toolkit/components/featuregates/test/python/test_gen_feature_definitions.py b/toolkit/components/featuregates/test/python/test_gen_feature_definitions.py index 0967e38de851..b6a3e4078910 100644 --- a/toolkit/components/featuregates/test/python/test_gen_feature_definitions.py +++ b/toolkit/components/featuregates/test/python/test_gen_feature_definitions.py @@ -271,27 +271,27 @@ class MainTests(unittest.TestCase): output.seek(0) results = json.load(output) assert results == { - u"demo-feature": { - u"id": u"demo-feature", - u"title": u"Demo Feature", - u"description": u"A no-op feature to demo the feature gate system.", - u"restartRequired": False, - u"preference": u"foo.bar.baz", - u"type": u"boolean", - u"bugNumbers": [1479127], - u"isPublic": {u"default": True}, - u"defaultValue": {u"default": False}, + "demo-feature": { + "id": "demo-feature", + "title": "Demo Feature", + "description": "A no-op feature to demo the feature gate system.", + "restartRequired": False, + "preference": "foo.bar.baz", + "type": "boolean", + "bugNumbers": [1479127], + "isPublic": {"default": True}, + "defaultValue": {"default": False}, }, - u"minimal-feature": { - u"id": u"minimal-feature", - u"title": u"Minimal Feature", - u"description": u"The smallest feature that is valid", - u"restartRequired": True, - u"preference": u"features.minimal-feature.enabled", - u"type": u"boolean", - u"bugNumbers": [1479127], - u"isPublic": {u"default": False}, - u"defaultValue": {u"default": None}, + "minimal-feature": { + "id": "minimal-feature", + "title": "Minimal Feature", + "description": "The smallest feature that is valid", + "restartRequired": True, + "preference": "features.minimal-feature.enabled", + "type": "boolean", + "bugNumbers": [1479127], + "isPublic": {"default": False}, + "defaultValue": {"default": None}, }, } diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py b/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py index 36c4ddc08f65..f4d326a70a89 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/jog.py @@ -81,6 +81,7 @@ def load_monkeypatches(): Monkeypatch jinja template loading because we're not glean_parser. We're glean_parser_ext. """ + # Monkeypatch util.get_jinja2_template to find templates nearby def get_local_template(template_name, filters=()): env = jinja2.Environment( diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/js.py b/toolkit/components/glean/build_scripts/glean_parser_ext/js.py index c1425c4ec946..d50adfc0fa7d 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/js.py +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/js.py @@ -65,7 +65,7 @@ def ping_entry(ping_id, ping_string_index): The 2 pieces of information of a ping encoded into a single 32-bit integer. """ assert ping_id < 2 ** (32 - PING_INDEX_BITS) - assert ping_string_index < 2 ** PING_INDEX_BITS + assert ping_string_index < 2**PING_INDEX_BITS return ping_id << PING_INDEX_BITS | ping_string_index diff --git a/toolkit/components/glean/build_scripts/glean_parser_ext/string_table.py b/toolkit/components/glean/build_scripts/glean_parser_ext/string_table.py index 1958eef604e3..2cf5cb68e783 100644 --- a/toolkit/components/glean/build_scripts/glean_parser_ext/string_table.py +++ b/toolkit/components/glean/build_scripts/glean_parser_ext/string_table.py @@ -79,7 +79,7 @@ class StringTable: f.write("#else\n") f.write("constexpr char %s[] = {\n" % name) f.write("#endif\n") - for (string, offset) in sorted(entries, key=lambda x: x[1]): + for string, offset in sorted(entries, key=lambda x: x[1]): if "*/" in string: raise ValueError( "String in string table contains unexpected sequence '*/': %s" diff --git a/toolkit/components/nimbus/generate/generate_feature_manifest.py b/toolkit/components/nimbus/generate/generate_feature_manifest.py index f9ee13dd5a07..86ed368be0b6 100644 --- a/toolkit/components/nimbus/generate/generate_feature_manifest.py +++ b/toolkit/components/nimbus/generate/generate_feature_manifest.py @@ -102,14 +102,14 @@ def generate_feature_manifest(fd, input_file): ) fd.write(f"export const FeatureManifest = {json.dumps(manifest)};") - except (IOError) as e: + except IOError as e: print(f"{input_file}: error:\n {e}\n") sys.exit(1) def platform_feature_manifest_array(features): entries = [] - for (feature, featureData) in features.items(): + for feature, featureData in features.items(): # Features have to be tagged isEarlyStartup to be accessible # to Nimbus platform API if not featureData.get("isEarlyStartup", False): @@ -147,6 +147,6 @@ def generate_platform_feature_manifest(fd, input_file): with open(input_file, "r", encoding="utf-8") as yaml_input: data = yaml.safe_load(yaml_input) fd.write(file_structure(data)) - except (IOError) as e: + except IOError as e: print("{}: error:\n {}\n".format(input_file, e)) sys.exit(1) diff --git a/toolkit/components/telemetry/build_scripts/gen_histogram_enum.py b/toolkit/components/telemetry/build_scripts/gen_histogram_enum.py index 8f224c5140d1..6ee88904575e 100644 --- a/toolkit/components/telemetry/build_scripts/gen_histogram_enum.py +++ b/toolkit/components/telemetry/build_scripts/gen_histogram_enum.py @@ -66,7 +66,7 @@ def main(output, *filenames): # contiguous block. print("enum HistogramID : uint32_t {", file=output) seen_group_types = {"UseCounter": False, "UseCounterWorker": False} - for (group_type, histograms) in groups: + for group_type, histograms in groups: if group_type is not None: assert isinstance(group_type, str) assert group_type in seen_group_types.keys() @@ -95,7 +95,7 @@ def main(output, *filenames): print(" HistogramCount,", file=output) - for (key, value) in sorted(seen_group_types.items()): + for key, value in sorted(seen_group_types.items()): if value: print( " Histogram{0}Count = HistogramLast{0} - HistogramFirst{0} + 1,".format( diff --git a/toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py b/toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py index cf7863ff5816..d530d37f82e8 100644 --- a/toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py +++ b/toolkit/components/telemetry/build_scripts/mozparsers/parse_histograms.py @@ -962,7 +962,7 @@ def from_files(filenames, strict_type_checks=True): if not isinstance(histograms, OrderedDict): ParserError("Histogram parser did not provide an OrderedDict.").handle_now() - for (name, definition) in histograms.items(): + for name, definition in histograms.items(): if name in all_histograms: ParserError('Duplicate histogram name "%s".' % name).handle_later() all_histograms[name] = definition @@ -1005,5 +1005,5 @@ def from_files(filenames, strict_type_checks=True): ) ParserError(msg % (", ".join(sorted(orphaned)))).handle_later() - for (name, definition) in all_histograms.items(): + for name, definition in all_histograms.items(): yield Histogram(name, definition, strict_type_checks=strict_type_checks) diff --git a/toolkit/components/telemetry/tests/integration/tests/test_search_counts_across_sessions.py b/toolkit/components/telemetry/tests/integration/tests/test_search_counts_across_sessions.py index c2d9720b002c..34afd305ad9e 100644 --- a/toolkit/components/telemetry/tests/integration/tests/test_search_counts_across_sessions.py +++ b/toolkit/components/telemetry/tests/integration/tests/test_search_counts_across_sessions.py @@ -62,11 +62,11 @@ def test_search_counts(browser, helpers): ] assert search_counts1 == { - u"range": [1, 2], - u"bucket_count": 3, - u"histogram_type": 4, - u"values": {u"1": 0, u"0": 1}, - u"sum": 1, + "range": [1, 2], + "bucket_count": 3, + "histogram_type": 4, + "values": {"1": 0, "0": 1}, + "sum": 1, } # - Install addon @@ -157,11 +157,11 @@ def test_search_counts(browser, helpers): "{}.urlbar".format(search_engine) ] assert search_counts3 == { - u"range": [1, 2], - u"bucket_count": 3, - u"histogram_type": 4, - u"values": {u"1": 0, u"0": 3}, - u"sum": 3, + "range": [1, 2], + "bucket_count": 3, + "histogram_type": 4, + "values": {"1": 0, "0": 3}, + "sum": 3, } diff --git a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py index b6f51e47b236..d30fd6798653 100644 --- a/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py +++ b/toolkit/components/telemetry/tests/marionette/harness/telemetry_harness/testcase.py @@ -224,7 +224,7 @@ class TelemetryTestCase(WindowManagerMixin, MarionetteTestCase): return TelemetryController.getCurrentPingData(true); """ ) - return ping_data[u"payload"][u"info"][u"subsessionId"] + return ping_data["payload"]["info"]["subsessionId"] def tearDown(self, *args, **kwargs): """Stop the ping server and tear down the testcase.""" 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 fec71476320f..35a662df1a4b 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 @@ -10,7 +10,6 @@ class TestClientActivity(FOGTestCase): """Tests for client activity and FOG's scheduling of the "baseline" ping.""" def test_user_activity(self): - # First test that restarting the browser sends a "active" ping ping0 = self.wait_for_ping( self.restart_browser, FOG_BASELINE_PING, ping_server=self.fog_ping_server diff --git a/toolkit/components/telemetry/tests/python/test_gen_event_data_json.py b/toolkit/components/telemetry/tests/python/test_gen_event_data_json.py index 3a2b374bf339..5caa4cebbc59 100644 --- a/toolkit/components/telemetry/tests/python/test_gen_event_data_json.py +++ b/toolkit/components/telemetry/tests/python/test_gen_event_data_json.py @@ -23,7 +23,6 @@ import gen_event_data # noqa: E402 class TestEventDataJson(unittest.TestCase): - maxDiff = None def test_JSON_definitions_generation(self): diff --git a/toolkit/components/telemetry/tests/python/test_gen_scalar_data_json.py b/toolkit/components/telemetry/tests/python/test_gen_scalar_data_json.py index 1db5558a2efd..ac60e2ae1028 100644 --- a/toolkit/components/telemetry/tests/python/test_gen_scalar_data_json.py +++ b/toolkit/components/telemetry/tests/python/test_gen_scalar_data_json.py @@ -22,7 +22,6 @@ import gen_scalar_data # noqa: E402 class TestScalarDataJson(unittest.TestCase): - maxDiff = None def test_JSON_definitions_generation(self): diff --git a/toolkit/components/telemetry/tests/python/test_histogramtools_strict.py b/toolkit/components/telemetry/tests/python/test_histogramtools_strict.py index accafe90adb9..2109cd7d35e4 100644 --- a/toolkit/components/telemetry/tests/python/test_histogramtools_strict.py +++ b/toolkit/components/telemetry/tests/python/test_histogramtools_strict.py @@ -158,7 +158,7 @@ class TestParser(unittest.TestCase): "expires_in_version": "never", "kind": "exponential", "low": 1024, - "high": 2 ** 64, + "high": 2**64, "n_buckets": 100, "products": ["firefox"], "description": "Test histogram", @@ -515,7 +515,7 @@ class TestParser(unittest.TestCase): "expires_in_version": "never", "kind": "exponential", "low": 1024, - "high": 2 ** 64, + "high": 2**64, "n_buckets": 100, "keyed": "true", "description": "Test histogram", diff --git a/toolkit/crashreporter/generate_crash_reporter_sources.py b/toolkit/crashreporter/generate_crash_reporter_sources.py index 9d066a814c99..beefa2e2741b 100644 --- a/toolkit/crashreporter/generate_crash_reporter_sources.py +++ b/toolkit/crashreporter/generate_crash_reporter_sources.py @@ -21,7 +21,7 @@ template_header = ( def validate_annotations(annotations): """Ensure that the annotations have all the required fields""" - for (name, data) in sorted(annotations.items()): + for name, data in sorted(annotations.items()): if "description" not in data: print("Annotation " + name + " does not have a description\n") sys.exit(1) diff --git a/toolkit/crashreporter/tools/symbolstore.py b/toolkit/crashreporter/tools/symbolstore.py index 5dd5570a848f..bc160025039e 100755 --- a/toolkit/crashreporter/tools/symbolstore.py +++ b/toolkit/crashreporter/tools/symbolstore.py @@ -306,7 +306,6 @@ if platform.system() == "Windows": ctypes.windll.kernel32.CloseHandle(handle) return result - else: # Just use the os.path version otherwise. realpath = os.path.realpath diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 46e2699270a6..c87034a19f78 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -4,6 +4,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # Set the MOZ_CONFIGURE_OPTIONS variable with all the options that # were passed somehow (environment, command line, mozconfig) @dependable @@ -167,6 +168,7 @@ imply_option("--enable-profiling", dmd) imply_option("--enable-jemalloc", dmd, when=compile_environment) imply_option("--enable-replace-malloc", dmd, when=compile_environment) + # midir-based Web MIDI support # ============================================================== @depends(target) @@ -184,6 +186,7 @@ def midir_support(target, midir_linux_support): set_config("MOZ_WEBMIDI_MIDIR_IMPL", midir_support) + # Enable various cubeb backends # ============================================================== @depends(target) @@ -675,6 +678,7 @@ def freetype2_combined_info(fontconfig_info, freetype2_info): set_define("MOZ_HAVE_FREETYPE2", depends_if(freetype2_info)(lambda _: True)) + # Apple platform decoder support # ============================================================== @depends(toolkit) @@ -804,6 +808,7 @@ def openmax(value): set_config("MOZ_OMX", openmax) set_define("MOZ_OMX", openmax) + # EME Support # ============================================================== @depends(target, wmf) @@ -1092,6 +1097,7 @@ set_config("NS_PRINTING", printing) set_define("NS_PRINTING", printing) set_define("NS_PRINT_PREVIEW", printing) + # Speech-dispatcher support # ============================================================== @depends(toolkit) @@ -1139,6 +1145,7 @@ def webspeech_test_backend(value): set_config("MOZ_WEBSPEECH_TEST_BACKEND", webspeech_test_backend) set_define("MOZ_WEBSPEECH_TEST_BACKEND", webspeech_test_backend) + # Graphics # ============================================================== @depends(target, milestone) @@ -1169,6 +1176,7 @@ system_webp = pkg_check_modules( set_config("MOZ_SYSTEM_WEBP", depends(when=system_webp)(lambda: True)) + # Build Freetype in the tree # ============================================================== @depends(target, "--enable-skia-pdf") @@ -1728,10 +1736,13 @@ def midl_flags(flags, target, midl): return flags + ["-nologo", "-no_cpp", "-env", env] # widl - return flags + { - "x86": ["--win32", "-m32"], - "x86_64": ["--win64", "-m64"], - }[target.cpu] + return ( + flags + + { + "x86": ["--win32", "-m32"], + "x86_64": ["--win64", "-m64"], + }[target.cpu] + ) set_config("MIDL_FLAGS", midl_flags) @@ -2751,6 +2762,7 @@ check_prog( when=compile_environment & target_is_windows, ) + # Fork server @depends(target, build_project) def forkserver_default(target, build_project): @@ -3350,6 +3362,7 @@ check_header( when=target_has_linux_kernel & compile_environment, ) + # Smart card support # ============================================================== @depends(build_project) diff --git a/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py b/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py index 640ec5856439..280ab3d0855d 100644 --- a/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py +++ b/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py @@ -94,7 +94,7 @@ def preprocess_locale_files(config_dir, l10ndirs): fp = open_utf16le_file(join(config_dir, "baseLocale.nsh")) fp.write( ( - u""";NSIS Modern User Interface - Language File + """;NSIS Modern User Interface - Language File ;Compatible with Modern UI 1.68 ;Language: baseLocale (0) !insertmacro MOZ_MUI_LANGUAGEFILE_BEGIN \"baseLocale\" @@ -106,7 +106,7 @@ def preprocess_locale_files(config_dir, l10ndirs): lookup("mui.properties", l10ndirs), "!define ", " ", True ) fp.write(locale_strings.encode("utf-16-le")) - fp.write(u"!insertmacro MOZ_MUI_LANGUAGEFILE_END\n".encode("utf-16-le")) + fp.write("!insertmacro MOZ_MUI_LANGUAGEFILE_END\n".encode("utf-16-le")) fp.close() # Create the custom language file for our custom strings @@ -149,7 +149,7 @@ def create_nlf_file(moz_dir, ab_cd, config_dir): fp = open_utf16le_file(join(config_dir, "baseLocale.nlf")) fp.write( ( - u"""# Header, don't edit + """# Header, don't edit NLF v6 # Start editing here # Language ID diff --git a/toolkit/xre/dllservices/mozglue/gen_dll_blocklist_defs.py b/toolkit/xre/dllservices/mozglue/gen_dll_blocklist_defs.py index 29fc42825933..1f053dfda6ac 100644 --- a/toolkit/xre/dllservices/mozglue/gen_dll_blocklist_defs.py +++ b/toolkit/xre/dllservices/mozglue/gen_dll_blocklist_defs.py @@ -393,7 +393,7 @@ GENERATED_BLOCKLIST_FILES = [ class PETimeStamp(object): def __init__(self, ts): - max_timestamp = (2 ** 32) - 1 + max_timestamp = (2**32) - 1 if ts < 0 or ts > max_timestamp: raise ValueError("Invalid timestamp value") self._value = ts @@ -713,7 +713,6 @@ def exec_script_file(script_name, globals): def gen_blocklists(first_fd, defs_filename): - BlocklistDescriptor.set_output_fd(first_fd) # exec_env defines the global variables that will be present in the diff --git a/tools/browsertime/mach_commands.py b/tools/browsertime/mach_commands.py index 4850c82b75f7..8d0e0c3915cf 100644 --- a/tools/browsertime/mach_commands.py +++ b/tools/browsertime/mach_commands.py @@ -155,7 +155,7 @@ def visualmetrics_path(): def host_platform(): - is_64bits = sys.maxsize > 2 ** 32 + is_64bits = sys.maxsize > 2**32 if sys.platform.startswith("win"): if is_64bits: diff --git a/tools/crashreporter/system-symbols/win/symsrv-fetch.py b/tools/crashreporter/system-symbols/win/symsrv-fetch.py index beeaafa24514..be4bd101d525 100644 --- a/tools/crashreporter/system-symbols/win/symsrv-fetch.py +++ b/tools/crashreporter/system-symbols/win/symsrv-fetch.py @@ -78,7 +78,7 @@ def get_type(data): async def exp_backoff(retry_num): - await asyncio.sleep(2 ** retry_num) + await asyncio.sleep(2**retry_num) async def server_has_file(client, server, filename): diff --git a/tools/github-sync/converter.py b/tools/github-sync/converter.py index 57db9286c1b6..104229e29974 100755 --- a/tools/github-sync/converter.py +++ b/tools/github-sync/converter.py @@ -132,7 +132,7 @@ def get_real_base_hg_rev(hg_data, commit_map): # commit). The "tail" hg revisions are the ones for which we don't have their # ancestors in hg_data. tails = [] - for (rev, cset) in hg_data.items(): + for rev, cset in hg_data.items(): for parent in cset.parents: if parent not in hg_data: tails.append(rev) @@ -245,7 +245,7 @@ def fake_commit(hg_rev, parent1, parent2): def build_tree(builder, treedata): - for (name, value) in treedata.items(): + for name, value in treedata.items(): if isinstance(value, dict): subbuilder = downstream_git_repo.TreeBuilder() build_tree(subbuilder, value) @@ -269,7 +269,7 @@ def author_to_signature(author): def real_commit(hg_rev, parent1, parent2): filetree = dict() manifest = mozilla_hg_repo.manifest(rev=hg_rev) - for (nodeid, permission, executable, symlink, filename) in manifest: + for nodeid, permission, executable, symlink, filename in manifest: if not filename.startswith(relative_path.encode("utf-8")): continue if symlink: @@ -460,12 +460,12 @@ if not hg_commits[hg_tip].touches_sync_code and len(hg_commits[hg_tip].parents) hg_tip = new_tip eprint("--- Interesting changesets ---") -for (rev, cset) in hg_commits.items(): +for rev, cset in hg_commits.items(): if cset.touches_sync_code or len(cset.parents) > 1 or rev in hg_to_git_commit_map: eprint(pretty_print(rev, cset)) if DEBUG: eprint("--- Other changesets (not really interesting) ---") - for (rev, cset) in hg_commits.items(): + for rev, cset in hg_commits.items(): if not ( cset.touches_sync_code or len(cset.parents) > 1 diff --git a/tools/jprof/split-profile.py b/tools/jprof/split-profile.py index c280c130c23b..2e5fa89cafc1 100755 --- a/tools/jprof/split-profile.py +++ b/tools/jprof/split-profile.py @@ -145,7 +145,7 @@ generate_profile([], output_filename(0, None)) # generate the listed splits count = 1 excludes = [] -for (splitname, splitfunction) in splits: +for splitname, splitfunction in splits: generate_profile( excludes + ["-i" + splitfunction], output_filename(count, splitname) ) diff --git a/tools/lint/android/lints.py b/tools/lint/android/lints.py index e97a95e26583..53c86260137a 100644 --- a/tools/lint/android/lints.py +++ b/tools/lint/android/lints.py @@ -282,7 +282,6 @@ def _parse_checkstyle_output(config, topsrcdir=None, report_path=None): root = tree.getroot() for file in root.findall("file"): - for error in file.findall("error"): # Like . # NOQA: E501 err = { diff --git a/tools/lint/eslint/__init__.py b/tools/lint/eslint/__init__.py index 9f1930d789b1..fdd7504c34c7 100644 --- a/tools/lint/eslint/__init__.py +++ b/tools/lint/eslint/__init__.py @@ -136,7 +136,6 @@ def lint(paths, config, binary=None, fix=None, rules=[], setup=None, **lintargs) def run(cmd_args, config): - shell = False if ( os.environ.get("MSYSTEM") in ("MINGW32", "MINGW64") diff --git a/tools/lint/python/l10n_lint.py b/tools/lint/python/l10n_lint.py index ef3269ef2aea..a16dc2626bc4 100644 --- a/tools/lint/python/l10n_lint.py +++ b/tools/lint/python/l10n_lint.py @@ -19,6 +19,7 @@ STRINGS_REPO = "https://hg.mozilla.org/l10n/gecko-strings" PULL_AFTER = timedelta(days=2) + # Wrapper to call lint_strings with mozilla-central configuration # comm-central defines its own wrapper since comm-central strings are # in separate repositories diff --git a/tools/lint/test/test_black.py b/tools/lint/test/test_black.py index 9027670665a7..df0e792e68ae 100644 --- a/tools/lint/test/test_black.py +++ b/tools/lint/test/test_black.py @@ -11,7 +11,6 @@ fixed = 0 def test_lint_fix(lint, create_temp_file): - contents = """def is_unique( s ): diff --git a/tools/lint/test/test_clang_format.py b/tools/lint/test/test_clang_format.py index 809280601d55..d32e000131a2 100644 --- a/tools/lint/test/test_clang_format.py +++ b/tools/lint/test/test_clang_format.py @@ -123,7 +123,6 @@ def test_dir(lint, config, paths): def test_fixed(lint, create_temp_file): - contents = """int main ( ) { \n return 0; \n diff --git a/tools/lint/test/test_file_whitespace.py b/tools/lint/test/test_file_whitespace.py index 51b6fc479529..7dc815d6ca5f 100644 --- a/tools/lint/test/test_file_whitespace.py +++ b/tools/lint/test/test_file_whitespace.py @@ -33,7 +33,6 @@ def test_lint_file_whitespace(lint, paths): def test_lint_file_whitespace_fix(lint, paths, create_temp_file): - contents = """int main() { \n return 0; \n } diff --git a/tools/lint/test/test_perfdocs.py b/tools/lint/test/test_perfdocs.py index 3e52e8627150..4ee834ad6897 100644 --- a/tools/lint/test/test_perfdocs.py +++ b/tools/lint/test/test_perfdocs.py @@ -549,7 +549,7 @@ def test_perfdocs_verifier_nonexistent_documented_metrics( verifier.validate_tree() assert len(logger.warning.call_args_list) == expected - for (args, _) in logger.warning.call_args_list: + for args, _ in logger.warning.call_args_list: assert "Cannot find documented metric" in args[0] assert "being used" in args[0] @@ -604,7 +604,7 @@ def test_perfdocs_verifier_undocumented_metrics( verifier.validate_tree() assert len(logger.warning.call_args_list) == 1 - for (args, _) in logger.warning.call_args_list: + for args, _ in logger.warning.call_args_list: assert "Missing description for the metric" in args[0] @@ -668,7 +668,7 @@ def test_perfdocs_verifier_duplicate_metrics( verifier.validate_tree() assert len(logger.warning.call_args_list) == expected - for (args, _) in logger.warning.call_args_list: + for args, _ in logger.warning.call_args_list: assert "Duplicate definitions found for " in args[0] diff --git a/tools/lint/test/test_rustfmt.py b/tools/lint/test/test_rustfmt.py index c176a2695dbc..f1793be38301 100644 --- a/tools/lint/test/test_rustfmt.py +++ b/tools/lint/test/test_rustfmt.py @@ -41,7 +41,6 @@ def test_dir(lint, config, paths): def test_fix(lint, create_temp_file): - contents = """fn main() { // Statements here are executed when the compiled binary is called diff --git a/tools/lint/test/test_updatebot.py b/tools/lint/test/test_updatebot.py index 55842e99c0e6..5763cc1a7ab0 100644 --- a/tools/lint/test/test_updatebot.py +++ b/tools/lint/test/test_updatebot.py @@ -9,7 +9,7 @@ def test_basic(lint, paths): results = [] for p in paths(): - for (root, dirs, files) in os.walk(p): + for root, dirs, files in os.walk(p): for f in files: if f == ".yamllint": continue diff --git a/tools/moztreedocs/upload.py b/tools/moztreedocs/upload.py index fadbe1418185..a60713517442 100644 --- a/tools/moztreedocs/upload.py +++ b/tools/moztreedocs/upload.py @@ -71,7 +71,6 @@ def get_s3_keys(s3, bucket): def s3_set_redirects(redirects): - s3, bucket = create_aws_session() configuration = {"IndexDocument": {"Suffix": "index.html"}, "RoutingRules": []} diff --git a/tools/rb/find_leakers.py b/tools/rb/find_leakers.py index 9e9a37ac69a9..f131a2be59ef 100755 --- a/tools/rb/find_leakers.py +++ b/tools/rb/find_leakers.py @@ -50,7 +50,13 @@ def process_log(log_lines): if not log_line.startswith("<"): continue - (class_name, obj, ignore, operation, count,) = log_line.strip("\r\n").split( + ( + class_name, + obj, + ignore, + operation, + count, + ) = log_line.strip("\r\n").split( " " )[:5] diff --git a/tools/tryselect/selectors/release.py b/tools/tryselect/selectors/release.py index a828b3d03864..ef43c2ae5785 100644 --- a/tools/tryselect/selectors/release.py +++ b/tools/tryselect/selectors/release.py @@ -130,7 +130,7 @@ def run( migration_configs = yaml.safe_load(f) for migration in migrations: migration_config = migration_configs["merge-automation"]["behaviors"][migration] - for (path, from_, to) in migration_config["replacements"]: + for path, from_, to in migration_config["replacements"]: if path in files_to_change: contents = files_to_change[path] else: diff --git a/tools/tryselect/selectors/syntax.py b/tools/tryselect/selectors/syntax.py index ad643f831474..51e8e7d07524 100644 --- a/tools/tryselect/selectors/syntax.py +++ b/tools/tryselect/selectors/syntax.py @@ -285,7 +285,6 @@ def parse_arg(arg): class AutoTry: - # Maps from flavors to the job names needed to run that flavour flavor_jobs = { "mochitest": ["mochitest-1", "mochitest-e10s-1"], diff --git a/tools/tryselect/task_config.py b/tools/tryselect/task_config.py index b63df0b709f0..d6c7996ef2e4 100644 --- a/tools/tryselect/task_config.py +++ b/tools/tryselect/task_config.py @@ -50,7 +50,6 @@ class TryConfig: class Artifact(TryConfig): - arguments = [ [ ["--artifact"], @@ -173,7 +172,6 @@ class Pernosco(TryConfig): class Path(TryConfig): - arguments = [ [ ["paths"], @@ -208,7 +206,6 @@ class Path(TryConfig): class Environment(TryConfig): - arguments = [ [ ["--env"], @@ -246,7 +243,6 @@ class RangeAction(Action): class Rebuild(TryConfig): - arguments = [ [ ["--rebuild"], @@ -300,7 +296,6 @@ class Routes(TryConfig): class ChemspillPrio(TryConfig): - arguments = [ [ ["--chemspill-prio"], @@ -423,7 +418,6 @@ class Browsertime(TryConfig): class DisablePgo(TryConfig): - arguments = [ [ ["--disable-pgo"], @@ -442,7 +436,6 @@ class DisablePgo(TryConfig): class WorkerOverrides(TryConfig): - arguments = [ [ ["--worker-override"], diff --git a/tools/tryselect/util/estimates.py b/tools/tryselect/util/estimates.py index 634b1de2a215..a15ad7283116 100644 --- a/tools/tryselect/util/estimates.py +++ b/tools/tryselect/util/estimates.py @@ -38,7 +38,6 @@ def find_all_dependencies(graph, tasklist): def find_longest_path(graph, tasklist, duration_data): - dep_durations = dict() def find_dependency_durations(task): @@ -60,7 +59,6 @@ def find_longest_path(graph, tasklist, duration_data): def determine_percentile(quantiles_file, duration): - duration = duration.total_seconds() with open(quantiles_file) as f: diff --git a/tools/update-programs/moz.configure b/tools/update-programs/moz.configure index 2b507519058a..1ce4a4ade9d4 100644 --- a/tools/update-programs/moz.configure +++ b/tools/update-programs/moz.configure @@ -2,6 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. + # Spoof a stub of `js/moz.configure` for the included scripts. @dependable def js_standalone(): diff --git a/xpcom/build/Services.py b/xpcom/build/Services.py index 4c6c14807fb5..43f010d05be7 100644 --- a/xpcom/build/Services.py +++ b/xpcom/build/Services.py @@ -83,7 +83,7 @@ def services_h(output): """ ) - for (name, iface, contractid) in services: + for name, iface, contractid in services: # Write out a forward declaration for the type in question segs = iface.split("::") for namespace in segs[:-1]: @@ -126,7 +126,7 @@ def services_cpp(output): ) output.write(CPP_INCLUDES) - for (name, iface, contractid) in services: + for name, iface, contractid in services: output.write( """ static %(type)s* g%(name)s = nullptr; @@ -165,6 +165,6 @@ mozilla::services::Shutdown() gXPCOMShuttingDown = true; """ ) - for (name, iface, contractid) in services: + for name, iface, contractid in services: output.write(" NS_IF_RELEASE(g%s);\n" % name) output.write("}\n") diff --git a/xpcom/ds/tools/perfecthash.py b/xpcom/ds/tools/perfecthash.py index b4e964a125e8..929b643a309d 100644 --- a/xpcom/ds/tools/perfecthash.py +++ b/xpcom/ds/tools/perfecthash.py @@ -291,8 +291,9 @@ class CGHelper(object): if return_type is None: return_type = "const %s&" % self.entry_type - return textwrap.dedent( - """ + return ( + textwrap.dedent( + """ %(return_type)s %(name)s(%(key_type)s aKey) { @@ -305,16 +306,18 @@ class CGHelper(object): %(return_entry)s } """ - ) % { - "name": name, - "basis_table": self._indent(self.basis_table()), - "entries_name": self.entries_name, - "return_type": return_type, - "return_entry": self._indent(return_entry), - "key_type": key_type, - "key_bytes": key_bytes, - "key_length": key_length, - } + ) + % { + "name": name, + "basis_table": self._indent(self.basis_table()), + "entries_name": self.entries_name, + "return_type": return_type, + "return_entry": self._indent(return_entry), + "key_type": key_type, + "key_bytes": key_bytes, + "key_length": key_length, + } + ) def gen_jslinearstr_getter( self, name, return_type=None, return_entry="return entry;" @@ -337,8 +340,9 @@ class CGHelper(object): if return_type is None: return_type = "const %s&" % self.entry_type - return textwrap.dedent( - """ + return ( + textwrap.dedent( + """ %(return_type)s %(name)s(JSLinearString* aKey) { @@ -362,10 +366,12 @@ class CGHelper(object): } } """ - ) % { - "name": name, - "basis_table": self._indent(self.basis_table()), - "entries_name": self.entries_name, - "return_type": return_type, - "return_entry": self._indent(return_entry, 2), - } + ) + % { + "name": name, + "basis_table": self._indent(self.basis_table()), + "entries_name": self.entries_name, + "return_type": return_type, + "return_entry": self._indent(return_entry, 2), + } + ) diff --git a/xpcom/idl-parser/xpidl/header.py b/xpcom/idl-parser/xpidl/header.py index 80674d0b7684..ed179b1bad2a 100644 --- a/xpcom/idl-parser/xpidl/header.py +++ b/xpcom/idl-parser/xpidl/header.py @@ -21,7 +21,6 @@ if printdoccomments: for c in clist: fd.write("%s%s\n" % (indent, c)) - else: def printComments(fd, clist, indent): diff --git a/xpcom/idl-parser/xpidl/rust.py b/xpcom/idl-parser/xpidl/rust.py index 3b15387ddf71..b9fc6627fbfa 100644 --- a/xpcom/idl-parser/xpidl/rust.py +++ b/xpcom/idl-parser/xpidl/rust.py @@ -145,7 +145,6 @@ if printdoccomments: s += "\n/// ```\n///\n" return s - else: def printComments(fd, clist, indent): diff --git a/xpcom/idl-parser/xpidl/xpidl.py b/xpcom/idl-parser/xpidl/xpidl.py index 3a5fc497319e..b95fd14bc510 100755 --- a/xpcom/idl-parser/xpidl/xpidl.py +++ b/xpcom/idl-parser/xpidl/xpidl.py @@ -1023,8 +1023,8 @@ class ConstMember(object): # Value is a lambda. Resolve it. self.value = self.valueFn(self.iface) - min_val = -(2 ** 31) if basetype.signed else 0 - max_val = 2 ** 31 - 1 if basetype.signed else 2 ** 32 - 1 + min_val = -(2**31) if basetype.signed else 0 + max_val = 2**31 - 1 if basetype.signed else 2**32 - 1 if self.value < min_val or self.value > max_val: raise IDLError( "xpidl constants must fit within %s" diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build index e74c936c3852..ab0d1c32ecad 100644 --- a/xpcom/reflect/xptcall/md/unix/moz.build +++ b/xpcom/reflect/xptcall/md/unix/moz.build @@ -28,19 +28,15 @@ if CONFIG["OS_ARCH"] == "GNU": if CONFIG["CPU_ARCH"] == "x86": SOURCES += ["xptcinvoke_gcc_x86_unix.cpp", "xptcstubs_gcc_x86_unix.cpp"] -if ( - CONFIG["OS_ARCH"] - in ( - "Linux", - "Bitrig", - "DragonFly", - "FreeBSD", - "NetBSD", - "OpenBSD", - "SunOS", - ) - or CONFIG["OS_ARCH"].startswith("GNU_") -): +if CONFIG["OS_ARCH"] in ( + "Linux", + "Bitrig", + "DragonFly", + "FreeBSD", + "NetBSD", + "OpenBSD", + "SunOS", +) or CONFIG["OS_ARCH"].startswith("GNU_"): if CONFIG["CPU_ARCH"] == "x86_64": SOURCES += [ "xptcinvoke_asm_x86_64_unix.S", diff --git a/xpcom/reflect/xptinfo/xptcodegen.py b/xpcom/reflect/xptinfo/xptcodegen.py index 34131f6678ef..d2859703b86f 100644 --- a/xpcom/reflect/xptinfo/xptcodegen.py +++ b/xpcom/reflect/xptinfo/xptcodegen.py @@ -148,7 +148,7 @@ def iid_bytes(iid): # Get the byte representation of the IID for hashing. # Split a 16-bit integer into its high and low 8 bits def splitint(i): - assert i < 2 ** 16 + assert i < 2**16 return (i >> 8, i & 0xFF)