Skip to content

Commit 4a25f58

Browse files
committed
ruff format
1 parent 844e8ca commit 4a25f58

File tree

99 files changed

+11832
-6475
lines changed

Some content is hidden

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

99 files changed

+11832
-6475
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ jobs:
427427
- run: ruff check
428428
# TODO (cclauss): When ruff supports rule E303 without --preview, remove following line
429429
- run: ruff check --preview --select=E303
430+
- run: ruff format
430431
mypy:
431432
executor: focal
432433
steps:

.style.yapf

Lines changed: 0 additions & 3 deletions
This file was deleted.

bootstrap.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
on the timestamps of various input files (kind of like a dumb version
88
of a Makefile).
99
"""
10+
1011
import argparse
1112
import os
1213
import shutil
@@ -21,13 +22,16 @@
2122

2223
actions = [
2324
('npm packages', ['package.json'], [shutil.which('npm'), 'ci']),
24-
('create entry points', [
25-
'tools/maint/create_entry_points.py',
26-
'tools/maint/run_python.bat',
27-
'tools/maint/run_python.sh',
28-
'tools/maint/run_python.ps1',
29-
],
30-
[sys.executable, 'tools/maint/create_entry_points.py']),
25+
(
26+
'create entry points',
27+
[
28+
'tools/maint/create_entry_points.py',
29+
'tools/maint/run_python.bat',
30+
'tools/maint/run_python.sh',
31+
'tools/maint/run_python.ps1',
32+
],
33+
[sys.executable, 'tools/maint/create_entry_points.py'],
34+
),
3135
('git submodules', ['test/third_party/posixtestsuite/'], [shutil.which('git'), 'submodule', 'update', '--init']),
3236
]
3337

@@ -57,7 +61,9 @@ def main(args):
5761
parser = argparse.ArgumentParser(description=__doc__)
5862
parser.add_argument('-v', '--verbose', action='store_true', help='verbose', default=False)
5963
parser.add_argument('-n', '--dry-run', action='store_true', help='dry run', default=False)
60-
parser.add_argument('-i', '--install-post-checkout', action='store_true', help='install post checkout script', default=False)
64+
parser.add_argument(
65+
'-i', '--install-post-checkout', action='store_true', help='install post checkout script', default=False
66+
)
6167
args = parser.parse_args()
6268

6369
if args.install_post_checkout:

docs/process.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ pre-processor. See [`.clang-format`][clang-format] for more details.
5555
### Python Code
5656

5757
We generally follow the pep8 standard with the major exception that we use 2
58-
spaces for indentation. `ruff` is run on all PRs to ensure that Python code
59-
conforms to this style. See [`pyproject.toml`][pyproject.toml] for more details.
58+
spaces for indentation. `ruff check` and `ruff format` are run on all PRs to
59+
ensure that Python code conforms to this style. See
60+
[`pyproject.toml`][pyproject.toml] for more details.
6061

6162
#### Static Type Checking
6263

em-config.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121

2222
def main():
23-
if len(sys.argv) != 2 or \
24-
not re.match(r"^[\w\W_][\w\W_\d]*$", sys.argv[1]) or \
25-
not hasattr(config, sys.argv[1]):
23+
if len(sys.argv) != 2 or not re.match(r"^[\w\W_][\w\W_\d]*$", sys.argv[1]) or not hasattr(config, sys.argv[1]):
2624
print('Usage: em-config VAR_NAME', file=sys.stderr)
2725
sys.exit(1)
2826

emar.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# University of Illinois/NCSA Open Source License. Both these licenses can be
55
# found in the LICENSE file.
66

7-
"""Wrapper script around `llvm-ar`.
8-
"""
7+
"""Wrapper script around `llvm-ar`."""
98

109
import sys
1110
from tools import shared

embuilder.py

Lines changed: 111 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -30,95 +30,95 @@
3030

3131
# Minimal subset of targets used by CI systems to build enough to be useful
3232
MINIMAL_TASKS = [
33-
'libcompiler_rt',
34-
'libcompiler_rt-wasm-sjlj',
35-
'libcompiler_rt-ww',
36-
'libc',
37-
'libc-debug',
38-
'libc-ww-debug',
39-
'libc_optz',
40-
'libc_optz-debug',
41-
'libc++abi',
42-
'libc++abi-except',
43-
'libc++abi-noexcept',
44-
'libc++abi-debug',
45-
'libc++abi-debug-except',
46-
'libc++abi-debug-noexcept',
47-
'libc++abi-debug-ww-noexcept',
48-
'libc++',
49-
'libc++-except',
50-
'libc++-noexcept',
51-
'libc++-ww-noexcept',
52-
'libal',
53-
'libdlmalloc',
54-
'libdlmalloc-tracing',
55-
'libdlmalloc-debug',
56-
'libdlmalloc-ww',
57-
'libembind',
58-
'libembind-rtti',
59-
'libemmalloc',
60-
'libemmalloc-debug',
61-
'libemmalloc-memvalidate',
62-
'libemmalloc-verbose',
63-
'libemmalloc-memvalidate-verbose',
64-
'libmimalloc',
65-
'libmimalloc-mt',
66-
'libGL',
67-
'libGL-getprocaddr',
68-
'libGL-emu-getprocaddr',
69-
'libGL-emu-webgl2-ofb-getprocaddr',
70-
'libGL-webgl2-ofb-getprocaddr',
71-
'libGL-ww-getprocaddr',
72-
'libhtml5',
73-
'libsockets',
74-
'libsockets-ww',
75-
'libstubs',
76-
'libstubs-debug',
77-
'libstandalonewasm-nocatch',
78-
'crt1',
79-
'crt1_proxy_main',
80-
'crtbegin',
81-
'libunwind-except',
82-
'libnoexit',
83-
'sqlite3',
84-
'sqlite3-mt',
85-
'libwebgpu',
86-
'libwebgpu_cpp',
33+
'libcompiler_rt',
34+
'libcompiler_rt-wasm-sjlj',
35+
'libcompiler_rt-ww',
36+
'libc',
37+
'libc-debug',
38+
'libc-ww-debug',
39+
'libc_optz',
40+
'libc_optz-debug',
41+
'libc++abi',
42+
'libc++abi-except',
43+
'libc++abi-noexcept',
44+
'libc++abi-debug',
45+
'libc++abi-debug-except',
46+
'libc++abi-debug-noexcept',
47+
'libc++abi-debug-ww-noexcept',
48+
'libc++',
49+
'libc++-except',
50+
'libc++-noexcept',
51+
'libc++-ww-noexcept',
52+
'libal',
53+
'libdlmalloc',
54+
'libdlmalloc-tracing',
55+
'libdlmalloc-debug',
56+
'libdlmalloc-ww',
57+
'libembind',
58+
'libembind-rtti',
59+
'libemmalloc',
60+
'libemmalloc-debug',
61+
'libemmalloc-memvalidate',
62+
'libemmalloc-verbose',
63+
'libemmalloc-memvalidate-verbose',
64+
'libmimalloc',
65+
'libmimalloc-mt',
66+
'libGL',
67+
'libGL-getprocaddr',
68+
'libGL-emu-getprocaddr',
69+
'libGL-emu-webgl2-ofb-getprocaddr',
70+
'libGL-webgl2-ofb-getprocaddr',
71+
'libGL-ww-getprocaddr',
72+
'libhtml5',
73+
'libsockets',
74+
'libsockets-ww',
75+
'libstubs',
76+
'libstubs-debug',
77+
'libstandalonewasm-nocatch',
78+
'crt1',
79+
'crt1_proxy_main',
80+
'crtbegin',
81+
'libunwind-except',
82+
'libnoexit',
83+
'sqlite3',
84+
'sqlite3-mt',
85+
'libwebgpu',
86+
'libwebgpu_cpp',
8787
]
8888

8989
# Additional tasks on top of MINIMAL_TASKS that are necessary for PIC testing on
9090
# CI (which has slightly more tests than other modes that want to use MINIMAL)
9191
MINIMAL_PIC_TASKS = MINIMAL_TASKS + [
92-
'libcompiler_rt-mt',
93-
'libc-mt',
94-
'libc-mt-debug',
95-
'libc_optz-mt',
96-
'libc_optz-mt-debug',
97-
'libc++abi-mt',
98-
'libc++abi-mt-noexcept',
99-
'libc++abi-debug-mt',
100-
'libc++abi-debug-mt-noexcept',
101-
'libc++-mt',
102-
'libc++-mt-noexcept',
103-
'libdlmalloc-mt',
104-
'libGL-emu',
105-
'libGL-emu-webgl2-getprocaddr',
106-
'libGL-mt-getprocaddr',
107-
'libGL-mt-emu',
108-
'libGL-mt-emu-webgl2-getprocaddr',
109-
'libGL-mt-emu-webgl2-ofb-getprocaddr',
110-
'libsockets_proxy',
111-
'libsockets-mt',
112-
'crtbegin',
113-
'libsanitizer_common_rt',
114-
'libubsan_rt',
115-
'libwasm_workers-debug-stub',
116-
'libfetch',
117-
'libfetch-mt',
118-
'libwasmfs',
119-
'libwasmfs-debug',
120-
'libwasmfs_no_fs',
121-
'giflib',
92+
'libcompiler_rt-mt',
93+
'libc-mt',
94+
'libc-mt-debug',
95+
'libc_optz-mt',
96+
'libc_optz-mt-debug',
97+
'libc++abi-mt',
98+
'libc++abi-mt-noexcept',
99+
'libc++abi-debug-mt',
100+
'libc++abi-debug-mt-noexcept',
101+
'libc++-mt',
102+
'libc++-mt-noexcept',
103+
'libdlmalloc-mt',
104+
'libGL-emu',
105+
'libGL-emu-webgl2-getprocaddr',
106+
'libGL-mt-getprocaddr',
107+
'libGL-mt-emu',
108+
'libGL-mt-emu-webgl2-getprocaddr',
109+
'libGL-mt-emu-webgl2-ofb-getprocaddr',
110+
'libsockets_proxy',
111+
'libsockets-mt',
112+
'crtbegin',
113+
'libsanitizer_common_rt',
114+
'libubsan_rt',
115+
'libwasm_workers-debug-stub',
116+
'libfetch',
117+
'libfetch-mt',
118+
'libwasmfs',
119+
'libwasmfs-debug',
120+
'libwasmfs_no_fs',
121+
'giflib',
122122
]
123123

124124
PORTS = sorted(list(ports.ports_by_name.keys()) + list(ports.port_variants.keys()))
@@ -186,19 +186,17 @@ def handle_port_error(target, message):
186186
def main():
187187
all_build_start_time = time.time()
188188

189-
parser = argparse.ArgumentParser(description=__doc__,
190-
formatter_class=argparse.RawDescriptionHelpFormatter,
191-
epilog=get_help())
189+
parser = argparse.ArgumentParser(
190+
description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter, epilog=get_help()
191+
)
192192
parser.add_argument('--lto', action='store_const', const='full', help='build bitcode object for LTO')
193-
parser.add_argument('--lto=thin', dest='lto', action='store_const', const='thin', help='build bitcode object for ThinLTO')
194-
parser.add_argument('--pic', action='store_true',
195-
help='build relocatable objects for suitable for dynamic linking')
196-
parser.add_argument('--force', action='store_true',
197-
help='force rebuild of target (by removing it first)')
198-
parser.add_argument('--verbose', action='store_true',
199-
help='show build commands')
200-
parser.add_argument('--wasm64', action='store_true',
201-
help='use wasm64 architecture')
193+
parser.add_argument(
194+
'--lto=thin', dest='lto', action='store_const', const='thin', help='build bitcode object for ThinLTO'
195+
)
196+
parser.add_argument('--pic', action='store_true', help='build relocatable objects for suitable for dynamic linking')
197+
parser.add_argument('--force', action='store_true', help='force rebuild of target (by removing it first)')
198+
parser.add_argument('--verbose', action='store_true', help='show build commands')
199+
parser.add_argument('--wasm64', action='store_true', help='use wasm64 architecture')
202200
parser.add_argument('operation', choices=['build', 'clear', 'rebuild'])
203201
parser.add_argument('targets', nargs='*', help='see below')
204202
args = parser.parse_args()
@@ -239,7 +237,7 @@ def main():
239237

240238
# process tasks
241239
auto_tasks = False
242-
task_targets = dict.fromkeys(args.targets) # use dict to keep targets order
240+
task_targets = dict.fromkeys(args.targets) # use dict to keep targets order
243241

244242
# substitute
245243
predefined_tasks = {
@@ -314,14 +312,28 @@ def main():
314312
return 1
315313

316314
time_taken = time.time() - start_time
317-
logger.info('...success. Took %s(%.2fs)' % (('%02d:%02d mins ' % (time_taken // 60, time_taken % 60) if time_taken >= 60 else ''), time_taken))
315+
logger.info(
316+
'...success. Took %s(%.2fs)'
317+
% (('%02d:%02d mins ' % (time_taken // 60, time_taken % 60) if time_taken >= 60 else ''), time_taken)
318+
)
318319

319320
if USE_NINJA and args.operation != 'clear':
320321
system_libs.build_deferred()
321322

322323
if len(tasks) > 1 or USE_NINJA:
323324
all_build_time_taken = time.time() - all_build_start_time
324-
logger.info('Built %d targets in %s(%.2fs)' % (len(tasks), ('%02d:%02d mins ' % (all_build_time_taken // 60, all_build_time_taken % 60) if all_build_time_taken >= 60 else ''), all_build_time_taken))
325+
logger.info(
326+
'Built %d targets in %s(%.2fs)'
327+
% (
328+
len(tasks),
329+
(
330+
'%02d:%02d mins ' % (all_build_time_taken // 60, all_build_time_taken % 60)
331+
if all_build_time_taken >= 60
332+
else ''
333+
),
334+
all_build_time_taken,
335+
)
336+
)
325337

326338
return 0
327339

0 commit comments

Comments
 (0)