summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorThomas Waldmann <tw@waldmann-edv.de>2022-07-06 15:37:27 +0200
committerThomas Waldmann <tw@waldmann-edv.de>2022-07-06 16:34:38 +0200
commit7957af562d5ce8266b177039783be4dc8bdd7898 (patch)
tree6520fc40e4a6b51b7e7de35d1493a4b19db27c61 /scripts
parent7f8f6711024fae68a5b2d54b34cdf249f46368a5 (diff)
blacken all the code
https://black.readthedocs.io/
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/errorlist.py4
-rwxr-xr-xscripts/glibc_check.py21
-rw-r--r--scripts/hash_sizes.py19
3 files changed, 23 insertions, 21 deletions
diff --git a/scripts/errorlist.py b/scripts/errorlist.py
index c4a0e7a0e..6eae5056b 100755
--- a/scripts/errorlist.py
+++ b/scripts/errorlist.py
@@ -10,5 +10,5 @@ classes = Error.__subclasses__() + ErrorWithTraceback.__subclasses__()
for cls in sorted(classes, key=lambda cls: (cls.__module__, cls.__qualname__)):
if cls is ErrorWithTraceback:
continue
- print(' ', cls.__qualname__)
- print(indent(cls.__doc__, ' ' * 8))
+ print(" ", cls.__qualname__)
+ print(indent(cls.__doc__, " " * 8))
diff --git a/scripts/glibc_check.py b/scripts/glibc_check.py
index 5f8344960..8c1585e6e 100755
--- a/scripts/glibc_check.py
+++ b/scripts/glibc_check.py
@@ -13,11 +13,11 @@ import sys
verbose = True
objdump = "objdump -T %s"
-glibc_re = re.compile(r'GLIBC_([0-9]\.[0-9]+)')
+glibc_re = re.compile(r"GLIBC_([0-9]\.[0-9]+)")
def parse_version(v):
- major, minor = v.split('.')
+ major, minor = v.split(".")
return int(major), int(minor)
@@ -32,11 +32,9 @@ def main():
overall_versions = set()
for filename in filenames:
try:
- output = subprocess.check_output(objdump % filename, shell=True,
- stderr=subprocess.STDOUT)
+ output = subprocess.check_output(objdump % filename, shell=True, stderr=subprocess.STDOUT)
output = output.decode()
- versions = {parse_version(match.group(1))
- for match in glibc_re.finditer(output)}
+ versions = {parse_version(match.group(1)) for match in glibc_re.finditer(output)}
requires_glibc = max(versions)
overall_versions.add(requires_glibc)
if verbose:
@@ -50,14 +48,15 @@ def main():
if verbose:
if ok:
- print("The binaries work with the given glibc %s." %
- format_version(given))
+ print("The binaries work with the given glibc %s." % format_version(given))
else:
- print("The binaries do not work with the given glibc %s. "
- "Minimum is: %s" % (format_version(given), format_version(wanted)))
+ print(
+ "The binaries do not work with the given glibc %s. "
+ "Minimum is: %s" % (format_version(given), format_version(wanted))
+ )
return ok
-if __name__ == '__main__':
+if __name__ == "__main__":
ok = main()
sys.exit(0 if ok else 1)
diff --git a/scripts/hash_sizes.py b/scripts/hash_sizes.py
index 68e6e160a..19a33916d 100644
--- a/scripts/hash_sizes.py
+++ b/scripts/hash_sizes.py
@@ -23,11 +23,11 @@ policies = [
# which growth factor to use when growing a hashtable of size < upto
# grow fast (*2.0) at the start so we do not have to resize too often (expensive).
# grow slow (*1.1) for huge hash tables (do not jump too much in memory usage)
- Policy(256*K, 2.0),
- Policy(2*M, 1.7),
- Policy(16*M, 1.4),
- Policy(128*M, 1.2),
- Policy(2*G-1, 1.1),
+ Policy(256 * K, 2.0),
+ Policy(2 * M, 1.7),
+ Policy(16 * M, 1.4),
+ Policy(128 * M, 1.2),
+ Policy(2 * G - 1, 1.1),
]
@@ -92,12 +92,15 @@ def main():
sizes.append(p)
i = int(i * grow_factor)
- print("""\
+ print(
+ """\
static int hash_sizes[] = {
%s
};
-""" % ', '.join(str(size) for size in sizes))
+"""
+ % ", ".join(str(size) for size in sizes)
+ )
-if __name__ == '__main__':
+if __name__ == "__main__":
main()