Skip to content

Commit

Permalink
Bug 1707591 - ride along - reformat the tree with black 21.10b0 r=aha…
Browse files Browse the repository at this point in the history
…l,webdriver-reviewers,perftest-reviewers,whimboo,gerard-majax,alexandru.irimovici

This changed with this:
psf/black#1740

Depends on D130964

Differential Revision: https://phabricator.services.mozilla.com/D130965
  • Loading branch information
sylvestre committed Nov 22, 2021
1 parent 4d7c199 commit 57b90e3
Show file tree
Hide file tree
Showing 42 changed files with 118 additions and 118 deletions.
4 changes: 2 additions & 2 deletions config/check_spidermonkey_style.py
Expand Up @@ -529,7 +529,7 @@ def append_ordinary_line(self, line):
self.kids[-1].lines.append(line)

def style_relevant_kids(self):
""" Return a list of kids in this block that are style-relevant. """
"""Return a list of kids in this block that are style-relevant."""
return [kid for kid in self.kids if kid.is_style_relevant()]

def sorted(self, enclosing_inclname):
Expand Down Expand Up @@ -623,7 +623,7 @@ def to_source(self):


class OrdinaryCode(object):
""" A list of lines of code that aren't #include/#if/#else/#endif lines. """
"""A list of lines of code that aren't #include/#if/#else/#endif lines."""

def __init__(self, lines=None):
self.lines = lines if lines is not None else []
Expand Down
2 changes: 1 addition & 1 deletion config/printprereleasesuffix.py
Expand Up @@ -17,7 +17,7 @@


def get_prerelease_suffix(version):
""" Returns the prerelease suffix from the version string argument """
"""Returns the prerelease suffix from the version string argument"""

def mfunc(m):
return " {0} {1} {2}".format(
Expand Down
2 changes: 1 addition & 1 deletion config/tests/unit-printprereleasesuffix.py
Expand Up @@ -72,7 +72,7 @@ def test_a_b(self):
self.assertEqual(self.c, "")

def test_plus(self):
"""test 1.2+ version string """
"""test 1.2+ version string"""
self.c = get_prerelease_suffix("1.2+")
self.assertEqual(self.c, "")

Expand Down
2 changes: 1 addition & 1 deletion dom/bindings/Codegen.py
Expand Up @@ -13120,7 +13120,7 @@ def deps(self):


class ClassItem:
""" Use with CGClass """
"""Use with CGClass"""

def __init__(self, name, visibility):
self.name = name
Expand Down
40 changes: 20 additions & 20 deletions js/src/builtin/intl/make_intl_data.py
Expand Up @@ -517,7 +517,7 @@ def compare_tags(language, script):


def writeVariantTagMappings(println, variant_mappings, description, source, url):
""" Writes a function definition that maps variant subtags. """
"""Writes a function definition that maps variant subtags."""
println(
"""
static const char* ToCharPointer(const char* str) {
Expand Down Expand Up @@ -649,7 +649,7 @@ def writeVariantTagMappings(println, variant_mappings, description, source, url)


def writeLegacyMappingsFunction(println, legacy_mappings, description, source, url):
""" Writes a function definition that maps legacy language tags. """
"""Writes a function definition that maps legacy language tags."""
println("")
writeMappingHeader(println, description, source, url)
println(
Expand Down Expand Up @@ -915,7 +915,7 @@ def variant_size(m):
def writeSignLanguageMappingsFunction(
println, legacy_mappings, description, source, url
):
""" Writes a function definition that maps legacy sign language tags. """
"""Writes a function definition that maps legacy sign language tags."""
println("")
writeMappingHeader(println, description, source, url)
println(
Expand Down Expand Up @@ -1623,7 +1623,7 @@ def readSupplementalMetadata(file):


def writeCLDRLanguageTagData(println, data, url):
""" Writes the language tag data to the Intl data file. """
"""Writes the language tag data to the Intl data file."""

println(generatedFileWarning)
println("// Version: CLDR-{}".format(data["version"]))
Expand Down Expand Up @@ -1851,7 +1851,7 @@ def writeCLDRLanguageTagData(println, data, url):


def writeCLDRLanguageTagLikelySubtagsTest(println, data, url):
""" Writes the likely-subtags test file. """
"""Writes the likely-subtags test file."""

println(generatedFileWarning)

Expand Down Expand Up @@ -2035,7 +2035,7 @@ def readCLDRVersionFromICU():


def updateCLDRLangTags(args):
""" Update the LocaleGenerated.cpp file. """
"""Update the LanguageTagGenerated.cpp file."""
version = args.version
url = args.url
out = args.out
Expand Down Expand Up @@ -2095,15 +2095,15 @@ def readFiles(cldr_file):


def flines(filepath, encoding="utf-8"):
""" Open filepath and iterate over its content. """
"""Open filepath and iterate over its content."""
with io.open(filepath, mode="r", encoding=encoding) as f:
for line in f:
yield line


@total_ordering
class Zone(object):
""" Time zone with optional file name. """
"""Time zone with optional file name."""

def __init__(self, name, filename=""):
self.name = name
Expand All @@ -2126,7 +2126,7 @@ def __repr__(self):


class TzDataDir(object):
""" tzdata source from a directory. """
"""tzdata source from a directory."""

def __init__(self, obj):
self.name = partial(os.path.basename, obj)
Expand All @@ -2138,7 +2138,7 @@ def __init__(self, obj):


class TzDataFile(object):
""" tzdata source from a file (tar or gzipped). """
"""tzdata source from a file (tar or gzipped)."""

def __init__(self, obj):
self.name = lambda: os.path.splitext(
Expand All @@ -2157,7 +2157,7 @@ def _tarlines(self, tar, m):


def validateTimeZones(zones, links):
""" Validate the zone and link entries. """
"""Validate the zone and link entries."""
linkZones = set(links.keys())
intersect = linkZones.intersection(zones)
if intersect:
Expand Down Expand Up @@ -2195,7 +2195,7 @@ def isTzFile(d, m, f):


def readIANAFiles(tzdataDir, files):
""" Read all IANA time zone files from the given iterable. """
"""Read all IANA time zone files from the given iterable."""
nameSyntax = "[\w/+\-]+"
pZone = re.compile(r"Zone\s+(?P<name>%s)\s+.*" % nameSyntax)
pLink = re.compile(
Expand Down Expand Up @@ -2227,7 +2227,7 @@ def createLink(line, fname):


def readIANATimeZones(tzdataDir, ignoreBackzone, ignoreFactory):
""" Read the IANA time zone information from `tzdataDir`. """
"""Read the IANA time zone information from `tzdataDir`."""

backzoneFiles = {"backzone"}
(bkfiles, tzfiles) = partition(listIANAFiles(tzdataDir), backzoneFiles.__contains__)
Expand Down Expand Up @@ -2524,7 +2524,7 @@ def otherICULegacyLinks():


def icuTzDataVersion(icuTzDir):
""" Read the ICU time zone version from `icuTzDir`/zoneinfo64.txt. """
"""Read the ICU time zone version from `icuTzDir`/zoneinfo64.txt."""

def searchInFile(pattern, f):
p = re.compile(pattern)
Expand All @@ -2546,7 +2546,7 @@ def searchInFile(pattern, f):


def findIncorrectICUZones(ianaZones, ianaLinks, icuZones, icuLinks, ignoreBackzone):
""" Find incorrect ICU zone entries. """
"""Find incorrect ICU zone entries."""

def isIANATimeZone(zone):
return zone in ianaZones or zone in ianaLinks
Expand Down Expand Up @@ -2588,7 +2588,7 @@ def isICULink(zone):


def findIncorrectICULinks(ianaZones, ianaLinks, icuZones, icuLinks):
""" Find incorrect ICU link entries. """
"""Find incorrect ICU link entries."""

def isIANATimeZone(zone):
return zone in ianaZones or zone in ianaLinks
Expand Down Expand Up @@ -2651,7 +2651,7 @@ def isICUZone(zone):
def processTimeZones(
tzdataDir, icuDir, icuTzDir, version, ignoreBackzone, ignoreFactory, out
):
""" Read the time zone info and create a new time zone cpp file. """
"""Read the time zone info and create a new time zone cpp file."""
print("Processing tzdata mapping...")
(ianaZones, ianaLinks) = readIANATimeZones(tzdataDir, ignoreBackzone, ignoreFactory)
(icuZones, icuLinks) = readICUTimeZones(icuDir, icuTzDir, ignoreFactory)
Expand Down Expand Up @@ -3012,7 +3012,7 @@ def generateTzDataTests(tzdataDir, version, ignoreBackzone, ignoreFactory, testD


def updateTzdata(topsrcdir, args):
""" Update the time zone cpp file. """
"""Update the time zone cpp file."""

icuDir = os.path.join(topsrcdir, "intl/icu/source")
if not os.path.isdir(icuDir):
Expand Down Expand Up @@ -3142,7 +3142,7 @@ def writeCurrencyFile(published, currencies, out):


def updateCurrency(topsrcdir, args):
""" Update the CurrencyDataGenerated.js file. """
"""Update the CurrencyDataGenerated.js file."""
import xml.etree.ElementTree as ET
from random import randint

Expand Down Expand Up @@ -3643,7 +3643,7 @@ def find_unit_type(unit):


def writeUnitTestFiles(all_units, sanctioned_units):
""" Generate test files for unit number formatters. """
"""Generate test files for unit number formatters."""

js_src_builtin_intl_dir = os.path.dirname(os.path.abspath(__file__))
test_dir = os.path.join(
Expand Down
20 changes: 10 additions & 10 deletions js/src/util/make_unicode.py
Expand Up @@ -198,7 +198,7 @@ def read_special_casing(special_casing):


def int_ranges(ints):
""" Yields consecutive ranges (inclusive) from integer values. """
"""Yields consecutive ranges (inclusive) from integer values."""
(a, b) = tee(sorted(ints))
start = next(b)
for (curr, succ) in zip_longest(a, b):
Expand Down Expand Up @@ -680,7 +680,7 @@ def make_non_bmp_file(version, non_bmp_lower_map, non_bmp_upper_map, codepoint_t

def write_special_casing_methods(unconditional_toupper, codepoint_table, println):
def hexlit(n):
""" Returns C++ hex-literal for |n|. """
"""Returns C++ hex-literal for |n|."""
return "0x{:04X}".format(n)

def describe_range(ranges, depth):
Expand All @@ -697,13 +697,13 @@ def describe_range(ranges, depth):
)

def out_range(start, end):
""" Tests if the input character isn't a member of the set {x | start <= x <= end}. """
"""Tests if the input character isn't a member of the set {x | start <= x <= end}."""
if start == end:
return "ch != {}".format(hexlit(start))
return "ch < {} || ch > {}".format(hexlit(start), hexlit(end))

def in_range(start, end, parenthesize=False):
""" Tests if the input character is in the set {x | start <= x <= end}. """
"""Tests if the input character is in the set {x | start <= x <= end}."""
if start == end:
return "ch == {}".format(hexlit(start))
(left, right) = ("(", ")") if parenthesize else ("", "")
Expand All @@ -712,7 +712,7 @@ def in_range(start, end, parenthesize=False):
)

def in_any_range(ranges, spaces):
""" Tests if the input character is included in any of the given ranges. """
"""Tests if the input character is included in any of the given ranges."""
lines = [[]]
for (start, end) in ranges:
expr = in_range(start, end, parenthesize=True)
Expand All @@ -724,7 +724,7 @@ def in_any_range(ranges, spaces):
return " ||\n{}".format(spaces).join(" || ".join(t) for t in lines)

def write_range_accept(parent_list, child_list, depth):
""" Accepts the input character if it matches any code unit in |child_list|. """
"""Accepts the input character if it matches any code unit in |child_list|."""
(min_parent, max_parent) = (parent_list[0], parent_list[-1])
(min_child, max_child) = (child_list[0], child_list[-1])
assert min_child >= min_parent
Expand Down Expand Up @@ -770,7 +770,7 @@ def write_range_accept(parent_list, child_list, depth):
println(indent, "}")

def write_ChangesWhenUpperCasedSpecialCasing():
""" Checks if the input has a special upper case mapping. """
"""Checks if the input has a special upper case mapping."""
println("bool")
println("js::unicode::ChangesWhenUpperCasedSpecialCasing(char16_t ch)")
println("{")
Expand Down Expand Up @@ -829,7 +829,7 @@ def write_ChangesWhenUpperCasedSpecialCasing():
println("}")

def write_LengthUpperCaseSpecialCasing():
""" Slow case: Special casing character was found, returns its mapping length. """
"""Slow case: Special casing character was found, returns its mapping length."""
println("size_t")
println("js::unicode::LengthUpperCaseSpecialCasing(char16_t ch)")
println("{")
Expand All @@ -851,7 +851,7 @@ def write_LengthUpperCaseSpecialCasing():
println("}")

def write_AppendUpperCaseSpecialCasing():
""" Slow case: Special casing character was found, append its mapping characters. """
"""Slow case: Special casing character was found, append its mapping characters."""
println("void")
println(
"js::unicode::AppendUpperCaseSpecialCasing(char16_t ch, char16_t* elements, size_t* index)" # NOQA: E501
Expand Down Expand Up @@ -1378,7 +1378,7 @@ def write_supplemental_identifier_method(name, group_set, println):


def getsize(data):
""" return smallest possible integer size for the given array """
"""return smallest possible integer size for the given array"""
maxdata = max(data)
assert maxdata < 2 ** 32

Expand Down
4 changes: 2 additions & 2 deletions layout/tools/reftest/remotereftest.py
Expand Up @@ -252,7 +252,7 @@ def findPath(self, paths, filename=None):
return None

def startWebServer(self, options):
""" Create the webserver on the host and start it up """
"""Create the webserver on the host and start it up"""
remoteXrePath = options.xrePath
remoteUtilityPath = options.utilityPath

Expand Down Expand Up @@ -300,7 +300,7 @@ def stopWebServer(self, options):
self.server.stop()

def killNamedProc(self, pname, orphans=True):
""" Kill processes matching the given command name """
"""Kill processes matching the given command name"""
try:
import psutil
except ImportError as e:
Expand Down
2 changes: 1 addition & 1 deletion python/mozboot/mozboot/base.py
Expand Up @@ -526,7 +526,7 @@ def prompt_int(self, prompt, low, high, default=None):
print("ERROR! Please enter a valid option!")

def prompt_yesno(self, prompt):
""" Prompts the user with prompt and requires a yes/no answer."""
"""Prompts the user with prompt and requires a yes/no answer."""
if self.no_interactive:
print(prompt)
print('Selecting "Y" because context is not interactive.')
Expand Down
2 changes: 1 addition & 1 deletion python/mozbuild/mozbuild/backend/mach_commands.py
Expand Up @@ -376,7 +376,7 @@ def _get_clang_tools(command_context, clang_tools_path):


def prompt_bool(prompt, limit=5):
""" Prompts the user with prompt and requires a boolean value. """
"""Prompts the user with prompt and requires a boolean value."""
from distutils.util import strtobool

for _ in range(limit):
Expand Down
12 changes: 6 additions & 6 deletions python/mozbuild/mozbuild/test/test_expression.py
Expand Up @@ -54,25 +54,25 @@ def test_not(self):
self.assert_(not Expression("!1").evaluate(self.c))

def test_equals(self):
""" Test for the == operator"""
"""Test for the == operator"""
self.assert_(Expression("FAIL == PASS").evaluate(self.c))

def test_notequals(self):
""" Test for the != operator"""
"""Test for the != operator"""
self.assert_(Expression("FAIL != 1").evaluate(self.c))

def test_logical_and(self):
""" Test for the && operator"""
"""Test for the && operator"""
self.assertTrue(Expression("PASS == PASS && PASS != NOTPASS").evaluate(self.c))

def test_logical_or(self):
""" Test for the || operator"""
"""Test for the || operator"""
self.assertTrue(
Expression("PASS == NOTPASS || PASS != NOTPASS").evaluate(self.c)
)

def test_logical_ops(self):
""" Test for the && and || operators precedence"""
"""Test for the && and || operators precedence"""
# Would evaluate to false if precedence was wrong
self.assertTrue(
Expression("PASS == PASS || PASS != NOTPASS && PASS == NOTPASS").evaluate(
Expand All @@ -81,7 +81,7 @@ def test_logical_ops(self):
)

def test_defined(self):
""" Test for the defined() value"""
"""Test for the defined() value"""
self.assertTrue(Expression("defined(FAIL)").evaluate(self.c))
self.assertTrue(Expression("!defined(PASS)").evaluate(self.c))

Expand Down
2 changes: 1 addition & 1 deletion python/mozrelease/mozrelease/partner_repack.py
Expand Up @@ -187,7 +187,7 @@ def isValidPlatform(platform):


def parseRepackConfig(filename, platform):
""" Did you hear about this cool file format called yaml ? json ? Yeah, me neither """
"""Did you hear about this cool file format called yaml ? json ? Yeah, me neither"""
config = {}
config["platforms"] = []
f = open(filename, "r")
Expand Down

0 comments on commit 57b90e3

Please sign in to comment.