Skip to content

Commit f024d94

Browse files
committed
Bug 1786490 - reformat the tree using black 23.3.0 r=sylvestre,webdriver-reviewers,taskgraph-reviewers,whimboo,jmaher,ahal,perftest-reviewers,geckoview-reviewers,afinder,m_kato
# ignore-this-changeset Differential Revision: https://phabricator.services.mozilla.com/D186092
1 parent 51f5fcd commit f024d94

File tree

290 files changed

+777
-840
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+777
-840
lines changed

build/mach_initialize.py

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
class MetaPathFinder(object):
1515
pass
1616

17-
1817
else:
1918
from importlib.abc import MetaPathFinder
2019

build/moz.configure/memory.configure

+1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ set_config("MOZ_REPLACE_MALLOC_STATIC", replace_malloc_static)
5858
# PHC (Probabilistic Heap Checker)
5959
# ==============================================================
6060

61+
6162
# In general, it only makes sense for PHC to run on the platforms that have a
6263
# crash reporter.
6364
@depends(

build/moz.configure/nspr.configure

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def pkgconf_requires_private(system_nspr, nspr_minver):
8383

8484
set_config("PKGCONF_REQUIRES_PRIVATE", pkgconf_requires_private)
8585

86+
8687
# pkg_check_modules takes care of NSPR_CFLAGS and NSPR_LIBS when using --with-system-nspr.
8788
@depends(build_environment, c_compiler, fold_libs, when=build_nspr)
8889
def nspr_config(build_env, c_compiler, fold_libs):

build/moz.configure/toolchain.configure

+4-1
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ def sysroot(host_or_target, target_sysroot=None):
10331033
opt = "--with-host-sysroot"
10341034
env = "HOST_SYSROOT"
10351035
when = depends(host)(lambda h: h.kernel == "Linux")
1036+
10361037
# Only bootstrap a host sysroot when using a bootstrapped target sysroot
10371038
# or when the target doesn't use a bootstrapped sysroot in the first place.
10381039
@depends(when, bootstrap_target_when, target_sysroot.bootstrapped)
@@ -1731,7 +1732,6 @@ def select_linker_tmpl(host_or_target):
17311732
@imports("os")
17321733
@imports("shutil")
17331734
def select_linker(linker, c_compiler, developer_options, toolchain_flags, target):
1734-
17351735
if linker:
17361736
linker = linker[0]
17371737
else:
@@ -2500,6 +2500,7 @@ def cet_ldflags(c_compiler, target):
25002500

25012501
set_config("MOZ_CETCOMPAT_LDFLAGS", cet_ldflags)
25022502

2503+
25032504
# Frame pointers
25042505
# ==============================================================
25052506
@depends(c_compiler)
@@ -2785,6 +2786,7 @@ add_old_configure_assignment(
27852786
"ENABLE_MOZSEARCH_PLUGIN", depends_if("--enable-mozsearch-plugin")(lambda _: True)
27862787
)
27872788

2789+
27882790
# Libstdc++ compatibility hacks
27892791
# ==============================================================
27902792
#
@@ -2966,6 +2968,7 @@ add_old_configure_assignment("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags)
29662968
# Shared library building
29672969
# ==============================================================
29682970

2971+
29692972
# XXX: The use of makefile constructs in these variables is awful.
29702973
@depends(target, c_compiler)
29712974
def make_shared_library(target, compiler):

build/moz.configure/update-programs.configure

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

7+
78
# Updater
89
# ==============================================================
910
@depends(build_project)

build/unix/rewrite_sanitizer_dylib.py

-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def scan_directory(path):
6060
sys.exit(1)
6161

6262
for file in path.rglob("*"):
63-
6463
if not file.is_file():
6564
continue
6665

config/check_vanilla_allocations.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def main():
208208
if f in ignored_files and (f, 2) in functions:
209209
fail(f"There should be only one {f} file")
210210

211-
for (filename, n) in sorted(functions):
211+
for filename, n in sorted(functions):
212212
for fn in functions[(filename, n)]:
213213
# An allocation is present in a non-special file. Fail!
214214
fail("'" + fn + "' present in " + filename)

config/mozunit/mozunit/mozunit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def _mocked_file(self, name, mode, content=None):
219219
content = six.ensure_binary(content or b"")
220220
return MockedBytesFile(self, name, content)
221221
else:
222-
content = six.ensure_text(content or u"")
222+
content = six.ensure_text(content or "")
223223
return MockedStringFile(self, name, content)
224224

225225

config/tests/unit-nsinstall.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ def test_nsinstall_d(self):
146146
@unittest.skipIf(not RUN_NON_ASCII_TESTS, "Skipping non ascii tests")
147147
def test_nsinstall_non_ascii(self):
148148
"Test that nsinstall handles non-ASCII files"
149-
filename = u"\u2325\u3452\u2415\u5081"
149+
filename = "\u2325\u3452\u2415\u5081"
150150
testfile = self.touch(filename)
151-
testdir = self.mkdirs(u"\u4241\u1D04\u1414")
151+
testdir = self.mkdirs("\u4241\u1D04\u1414")
152152
self.assertEqual(
153153
nsinstall([testfile.encode("utf-8"), testdir.encode("utf-8")]), 0
154154
)
@@ -162,9 +162,9 @@ def test_nsinstall_non_ascii(self):
162162
)
163163
def test_nsinstall_non_ascii_subprocess(self):
164164
"Test that nsinstall as a subprocess handles non-ASCII files"
165-
filename = u"\u2325\u3452\u2415\u5081"
165+
filename = "\u2325\u3452\u2415\u5081"
166166
testfile = self.touch(filename)
167-
testdir = self.mkdirs(u"\u4241\u1D04\u1414")
167+
testdir = self.mkdirs("\u4241\u1D04\u1414")
168168
# We don't use subprocess because it can't handle Unicode on
169169
# Windows <http://bugs.python.org/issue1759845>. mozprocess calls
170170
# CreateProcessW directly so it's perfect.

devtools/rename.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
66

7+
78
# Put the content of `filenames[0]` file into `output` file pointer
89
def main(output, *filenames):
910
with open(filenames[0], "r", encoding="utf-8") as f:

dom/bindings/Codegen.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def fill(template, **args):
381381

382382
t, argModList = compile_fill_template(template)
383383
# Now apply argModList to args
384-
for (name, modified_name, depth) in argModList:
384+
for name, modified_name, depth in argModList:
385385
if not (args[name] == "" or args[name].endswith("\n")):
386386
raise ValueError(
387387
"Argument %s with value %r is missing a newline" % (name, args[name])
@@ -4372,7 +4372,7 @@ def InitUnforgeablePropertiesOnHolder(
43724372
(defineUnforgeableAttrs, properties.unforgeableAttrs),
43734373
(defineUnforgeableMethods, properties.unforgeableMethods),
43744374
]
4375-
for (template, array) in unforgeableMembers:
4375+
for template, array in unforgeableMembers:
43764376
if array.hasNonChromeOnly():
43774377
unforgeables.append(CGGeneric(template % array.variableName(False)))
43784378
if array.hasChromeOnly():
@@ -13021,7 +13021,6 @@ def deps(self):
1302113021
return self.type.getDeps()
1302213022

1302313023
def getStruct(self):
13024-
1302513024
members = [
1302613025
ClassMember("mType", "TypeOrUninit", body="eUninitialized"),
1302713026
ClassMember("mValue", "Value"),
@@ -17065,7 +17064,6 @@ def deps(self):
1706517064

1706617065
class CGNamespacedEnum(CGThing):
1706717066
def __init__(self, namespace, enumName, names, values, comment=""):
17068-
1706917067
if not values:
1707017068
values = []
1707117069

@@ -23425,7 +23423,6 @@ def GeneratedEventList(config):
2342523423

2342623424
@staticmethod
2342723425
def PrototypeList(config):
23428-
2342923426
# Prototype ID enum.
2343023427
descriptorsWithPrototype = config.getDescriptors(
2343123428
hasInterfacePrototypeObject=True
@@ -23613,7 +23610,6 @@ def BindingNames(config):
2361323610

2361423611
@staticmethod
2361523612
def RegisterBindings(config):
23616-
2361723613
curr = CGNamespace.build(
2361823614
["mozilla", "dom"], CGGlobalNames(config.windowGlobalNames)
2361923615
)
@@ -23641,7 +23637,6 @@ def RegisterBindings(config):
2364123637

2364223638
@staticmethod
2364323639
def RegisterWorkerBindings(config):
23644-
2364523640
curr = CGRegisterWorkerBindings(config)
2364623641

2364723642
# Wrap all of that in our namespaces.
@@ -23668,7 +23663,6 @@ def RegisterWorkerBindings(config):
2366823663

2366923664
@staticmethod
2367023665
def RegisterWorkerDebuggerBindings(config):
23671-
2367223666
curr = CGRegisterWorkerDebuggerBindings(config)
2367323667

2367423668
# Wrap all of that in our namespaces.
@@ -23695,7 +23689,6 @@ def RegisterWorkerDebuggerBindings(config):
2369523689

2369623690
@staticmethod
2369723691
def RegisterWorkletBindings(config):
23698-
2369923692
curr = CGRegisterWorkletBindings(config)
2370023693

2370123694
# Wrap all of that in our namespaces.
@@ -23722,7 +23715,6 @@ def RegisterWorkletBindings(config):
2372223715

2372323716
@staticmethod
2372423717
def RegisterShadowRealmBindings(config):
23725-
2372623718
curr = CGRegisterShadowRealmBindings(config)
2372723719

2372823720
# Wrap all of that in our namespaces.

dom/bindings/Configuration.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def addUnions(t):
248248
for m in t.flatMemberTypes:
249249
addUnions(m)
250250

251-
for (t, _) in getAllTypes(self.descriptors, self.dictionaries, self.callbacks):
251+
for t, _ in getAllTypes(self.descriptors, self.dictionaries, self.callbacks):
252252
addUnions(t)
253253

254254
for d in getDictionariesConvertedToJS(
@@ -440,7 +440,7 @@ def filterExtendedAttributes(extendedAttributes):
440440
name,
441441
)
442442
)
443-
for (k, v) in firstExtAttrs.items():
443+
for k, v in firstExtAttrs.items():
444444
if extAttrs[k] != v:
445445
raise TypeError(
446446
"%s on %s and %s on %s have different values for extended attribute %s, but they're using the same template %s."

dom/bindings/parser/WebIDL.py

+9-13
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,6 @@ def finish(self, scope):
947947

948948
def validate(self):
949949
for member in self.members:
950-
951950
if member.isAttr():
952951
if member.inherit:
953952
raise WebIDLError(
@@ -3165,7 +3164,7 @@ def typeName(type):
31653164
return "MaybeShared" + type.name
31663165
return type.name
31673166

3168-
for (i, type) in enumerate(self.memberTypes):
3167+
for i, type in enumerate(self.memberTypes):
31693168
if not type.isComplete():
31703169
self.memberTypes[i] = type.complete(scope)
31713170

@@ -3206,7 +3205,7 @@ def typeName(type):
32063205
continue
32073206
i += 1
32083207

3209-
for (i, t) in enumerate(self.flatMemberTypes[:-1]):
3208+
for i, t in enumerate(self.flatMemberTypes[:-1]):
32103209
for u in self.flatMemberTypes[i + 1 :]:
32113210
if not t.isDistinguishableFrom(u):
32123211
raise WebIDLError(
@@ -3619,7 +3618,6 @@ def isExposedInAllOf(self, exposureSet):
36193618

36203619

36213620
class IDLBuiltinType(IDLType):
3622-
36233621
Types = enum(
36243622
# The integer types
36253623
"byte",
@@ -4287,7 +4285,7 @@ def coerceToType(self, type, location):
42874285
)
42884286
elif self.type.isInteger() and type.isFloat():
42894287
# Convert an integer literal into float
4290-
if -(2 ** 24) <= self.value <= 2 ** 24:
4288+
if -(2**24) <= self.value <= 2**24:
42914289
return IDLValue(self.location, type, float(self.value))
42924290
else:
42934291
raise WebIDLError(
@@ -4468,7 +4466,6 @@ def _getDependentObjects(self):
44684466

44694467

44704468
class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
4471-
44724469
Tags = enum(
44734470
"Const", "Attr", "Method", "MaplikeOrSetlike", "AsyncIterable", "Iterable"
44744471
)
@@ -5791,7 +5788,7 @@ def expand(self, members):
57915788
"CrossOriginWritable",
57925789
"SetterThrows",
57935790
]
5794-
for (key, value) in self._extendedAttrDict.items():
5791+
for key, value in self._extendedAttrDict.items():
57955792
if key in allowedExtAttrs:
57965793
if value is not True:
57975794
raise WebIDLError(
@@ -5968,7 +5965,7 @@ def __init__(
59685965

59695966
IDLObjectWithScope.__init__(self, location, parentScope, identifier)
59705967

5971-
for (returnType, arguments) in self.signatures():
5968+
for returnType, arguments in self.signatures():
59725969
for argument in arguments:
59735970
argument.resolve(self)
59745971

@@ -6109,7 +6106,6 @@ def includesRestrictedFloatArgument(self):
61096106

61106107

61116108
class IDLMethod(IDLInterfaceMember, IDLScope):
6112-
61136109
Special = enum(
61146110
"Getter", "Setter", "Deleter", "LegacyCaller", base=IDLInterfaceMember.Special
61156111
)
@@ -6292,7 +6288,7 @@ def resolve(self, parentScope):
62926288
assert isinstance(parentScope, IDLScope)
62936289
IDLObjectWithIdentifier.resolve(self, parentScope)
62946290
IDLScope.__init__(self, self.location, parentScope, self.identifier)
6295-
for (returnType, arguments) in self.signatures():
6291+
for returnType, arguments in self.signatures():
62966292
for argument in arguments:
62976293
argument.resolve(self)
62986294

@@ -6435,7 +6431,7 @@ def validate(self):
64356431
variadicArgument = None
64366432

64376433
arguments = overload.arguments
6438-
for (idx, argument) in enumerate(arguments):
6434+
for idx, argument in enumerate(arguments):
64396435
assert argument.type.isComplete()
64406436

64416437
if (
@@ -6568,8 +6564,8 @@ def locationsForArgCount(self, argc):
65686564

65696565
def distinguishingIndexForArgCount(self, argc):
65706566
def isValidDistinguishingIndex(idx, signatures):
6571-
for (firstSigIndex, (firstRetval, firstArgs)) in enumerate(signatures[:-1]):
6572-
for (secondRetval, secondArgs) in signatures[firstSigIndex + 1 :]:
6567+
for firstSigIndex, (firstRetval, firstArgs) in enumerate(signatures[:-1]):
6568+
for secondRetval, secondArgs in signatures[firstSigIndex + 1 :]:
65736569
if idx < len(firstArgs):
65746570
firstType = firstArgs[idx].type
65756571
else:

dom/bindings/parser/tests/test_attributes_on_types.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def WebIDLTest(parser, harness):
337337
),
338338
]
339339

340-
for (name, template) in TEMPLATES:
340+
for name, template in TEMPLATES:
341341
parser = parser.reset()
342342
threw = False
343343
try:
@@ -346,7 +346,7 @@ def WebIDLTest(parser, harness):
346346
except Exception:
347347
threw = True
348348
harness.ok(not threw, "Template for %s parses without attributes" % name)
349-
for (attribute, type) in ATTRIBUTES:
349+
for attribute, type in ATTRIBUTES:
350350
parser = parser.reset()
351351
threw = False
352352
try:

dom/bindings/parser/tests/test_callback_interface.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def WebIDLTest(parser, harness):
9494
"""
9595
)
9696
results = parser.finish()
97-
for (i, iface) in enumerate(results):
97+
for i, iface in enumerate(results):
9898
harness.check(
9999
iface.isSingleOperationInterface(),
100100
i < 4,

dom/bindings/parser/tests/test_const.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def WebIDLTest(parser, harness):
6464
len(iface.members), len(expected), "Expect %s members" % len(expected)
6565
)
6666

67-
for (const, (QName, name, type, value)) in zip(iface.members, expected):
67+
for const, (QName, name, type, value) in zip(iface.members, expected):
6868
harness.ok(isinstance(const, WebIDL.IDLConst), "Should be an IDLConst")
6969
harness.ok(const.isConst(), "Const is a const")
7070
harness.ok(not const.isAttr(), "Const is not an attr")

dom/bindings/parser/tests/test_constructor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def checkMethod(
8787
)
8888

8989
sigpairs = zip(method.signatures(), signatures)
90-
for (gotSignature, expectedSignature) in sigpairs:
90+
for gotSignature, expectedSignature in sigpairs:
9191
(gotRetType, gotArgs) = gotSignature
9292
(expectedRetType, expectedArgs) = expectedSignature
9393

dom/bindings/parser/tests/test_float_types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def WebIDLTest(parser, harness):
5555
method = iface.members[6]
5656
harness.ok(isinstance(method, WebIDL.IDLMethod), "Should be an IDLMethod")
5757
argtypes = [a.type for a in method.signatures()[0][1]]
58-
for (idx, type) in enumerate(argtypes):
58+
for idx, type in enumerate(argtypes):
5959
harness.ok(type.isFloat(), "Type %d should be float" % idx)
6060
harness.check(
6161
type.isUnrestricted(),

dom/bindings/parser/tests/test_method.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def checkMethod(
9090
)
9191

9292
sigpairs = zip(method.signatures(), signatures)
93-
for (gotSignature, expectedSignature) in sigpairs:
93+
for gotSignature, expectedSignature in sigpairs:
9494
(gotRetType, gotArgs) = gotSignature
9595
(expectedRetType, expectedArgs) = expectedSignature
9696

0 commit comments

Comments
 (0)