py: Reformat all Python files consistently

This commit is the unmodified results of running
```
black $(git ls-files '*.py')
```
with black version 19.10b0. See #2046.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
This commit is contained in:
Philip Withnall
2020-11-17 15:07:09 +00:00
parent 053d2ae2b4
commit 905b22a17e
26 changed files with 6928 additions and 4875 deletions

View File

@@ -29,14 +29,16 @@ import argparse
def main(argv):
parser = argparse.ArgumentParser(
description="Generate test cases for casefolding from Unicode data")
description="Generate test cases for casefolding from Unicode data"
)
parser.add_argument("UNICODE-VERSION")
parser.add_argument("CaseFolding.txt")
args = parser.parse_args(argv[1:])
version = getattr(args, "UNICODE-VERSION")
filename = getattr(args, "CaseFolding.txt")
print("""\
print(
"""\
# Test cases generated from Unicode {} data
# by gen-casefold-txt.py. Do not edit.
#
@@ -45,7 +47,10 @@ def main(argv):
AaBbCc@@\taabbcc@@
#
# Now the automatic tests
#""".format(version))
#""".format(
version
)
)
# Names of fields in the CaseFolding table
CODE, STATUS, MAPPING = range(3)
@@ -60,8 +65,9 @@ AaBbCc@@\taabbcc@@
fields = [f.strip() for f in line.split(";", 3)[:3]]
if len(fields) != 3:
raise SystemExit(
"Entry for %s has wrong number of fields (%d)" % (
fields[CODE], len(fields)))
"Entry for %s has wrong number of fields (%d)"
% (fields[CODE], len(fields))
)
status = fields[STATUS]
# skip simple and Turkic mappings
@@ -69,8 +75,7 @@ AaBbCc@@\taabbcc@@
continue
code = chr(int(fields[CODE], 16))
values = "".join(
[chr(int(v, 16)) for v in fields[MAPPING].split()])
values = "".join([chr(int(v, 16)) for v in fields[MAPPING].split()])
print("{}\t{}".format(code, values))