Skip to content

Fix flake8 errors/warnings. NFC #23930

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ jobs:
- checkout
- pip-install
- run: ruff check
# TODO (cclauss): When ruff supports rules E20,E30 without --preview, remove following line
- run: ruff check --preview --select=E20,E30
# TODO (cclauss): When ruff supports rules these errors without --preview, remove following line
- run: ruff check --preview --select=E20,E30,E221,E225,E226
mypy:
executor: focal
steps:
Expand Down
2 changes: 1 addition & 1 deletion emsymbolizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def symbolize_address_sourcemap(module, address, force_file):
print(sm.mappings)
# Print with section offsets to easily compare against dwarf
for k, v in sm.mappings.items():
print(f'{k-csoff:x}: {v}')
print(f'{k - csoff:x}: {v}')
sm.lookup(address).print()


Expand Down
24 changes: 12 additions & 12 deletions test/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,7 @@ def test_fs_idbfs_fsync(self):

args = ['--pre-js', 'pre.js', '-lidbfs.js', '-sEXIT_RUNTIME', '-sASYNCIFY']
secret = str(time.time())
self.btest('fs/test_idbfs_fsync.c', '1', emcc_args=args + ['-DFIRST', f'-DSECRET="{secret }"', '-lidbfs.js'])
self.btest('fs/test_idbfs_fsync.c', '1', emcc_args=args + ['-DFIRST', f'-DSECRET="{secret}"', '-lidbfs.js'])
self.btest('fs/test_idbfs_fsync.c', '1', emcc_args=args + [f'-DSECRET="{secret}"', '-lidbfs.js'])

def test_fs_memfs_fsync(self):
Expand All @@ -1392,7 +1392,7 @@ def test_fs_workerfs_read(self):
}, '/work');
};
''' % (secret, secret2))
self.btest_exit('fs/test_workerfs_read.c', emcc_args=['-lworkerfs.js', '--pre-js', 'pre.js', f'-DSECRET="{secret }"', f'-DSECRET2="{secret2}"', '--proxy-to-worker', '-lworkerfs.js'])
self.btest_exit('fs/test_workerfs_read.c', emcc_args=['-lworkerfs.js', '--pre-js', 'pre.js', f'-DSECRET="{secret}"', f'-DSECRET2="{secret2}"', '--proxy-to-worker', '-lworkerfs.js'])

def test_fs_workerfs_package(self):
self.set_setting('DEFAULT_LIBRARY_FUNCS_TO_INCLUDE', '$ccall')
Expand Down Expand Up @@ -1445,8 +1445,8 @@ def test_fs_lz4fs_package(self):
self.btest_exit('fs/test_lz4fs.cpp', 1, emcc_args=['-DLOAD_MANUALLY', '-sLZ4', '-sFORCE_FILESYSTEM', '-O2'])
print(' opts+closure')
self.btest_exit('fs/test_lz4fs.cpp', 1, emcc_args=['-DLOAD_MANUALLY', '-sLZ4',
'-sFORCE_FILESYSTEM', '-O2',
'--closure=1', '-g1', '-Wno-closure'])
'-sFORCE_FILESYSTEM', '-O2',
'--closure=1', '-g1', '-Wno-closure'])

'''# non-lz4 for comparison
try:
Expand Down Expand Up @@ -4367,12 +4367,12 @@ def test_webgl_multi_draw(self, args):
def test_webgl_draw_base_vertex_base_instance(self, multi_draw, draw_elements):
self.reftest('webgl_draw_base_vertex_base_instance_test.c', 'webgl_draw_instanced_base_vertex_base_instance.png',
emcc_args=['-lGL',
'-sMAX_WEBGL_VERSION=2',
'-sOFFSCREEN_FRAMEBUFFER',
'-DMULTI_DRAW=' + str(multi_draw),
'-DDRAW_ELEMENTS=' + str(draw_elements),
'-DEXPLICIT_SWAP=1',
'-DWEBGL_CONTEXT_VERSION=2'])
'-sMAX_WEBGL_VERSION=2',
'-sOFFSCREEN_FRAMEBUFFER',
'-DMULTI_DRAW=' + str(multi_draw),
'-DDRAW_ELEMENTS=' + str(draw_elements),
'-DEXPLICIT_SWAP=1',
'-DWEBGL_CONTEXT_VERSION=2'])

@requires_graphics_hardware
def test_webgl_sample_query(self):
Expand Down Expand Up @@ -5353,8 +5353,8 @@ def test_wasmfs_fetch_backend(self, args):
create_file('subdir/backendfile2', 'file 2')
self.btest_exit('wasmfs/wasmfs_fetch.c',
emcc_args=['-sWASMFS', '-pthread', '-sPROXY_TO_PTHREAD',
'-sFORCE_FILESYSTEM', '-lfetchfs.js',
'--js-library', test_file('wasmfs/wasmfs_fetch.js')] + args)
'-sFORCE_FILESYSTEM', '-lfetchfs.js',
'--js-library', test_file('wasmfs/wasmfs_fetch.js')] + args)

@no_firefox('no OPFS support yet')
@no_wasm64()
Expand Down
5 changes: 2 additions & 3 deletions test/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3778,8 +3778,7 @@ def test_dlfcn_jspi(self):
"side.so",
test_file("core/test_dlfcn_jspi_side.c"),
"-sSIDE_MODULE",
]
+ self.get_emcc_args()
] + self.get_emcc_args()
)
self.do_run_in_out_file_test("core/test_dlfcn_jspi.c", emcc_args=["side.so", "-sMAIN_MODULE=2"])

Expand Down Expand Up @@ -8068,7 +8067,7 @@ def test_async_ccall_good(self):
})
@with_asyncify_and_jspi
def test_async_ccall_promise(self, exit_runtime):
if self.get_setting('ASYNCIFY') == 2:
if self.get_setting('ASYNCIFY') == 2:
self.set_setting('JSPI_EXPORTS', ['stringf', 'floatf'])
self.set_setting('ASSERTIONS')
self.set_setting('INVOKE_RUN', 0)
Expand Down
24 changes: 12 additions & 12 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -8501,15 +8501,15 @@ def test(p1, p2, p3, last, expected):
return os.path.getsize('a.out.wasm')

print('no bad ctor')
first = test(1000, 2000, 3000, 0xe, 0x58e) # noqa
second = test(3000, 1000, 2000, 0xe, 0x8e5) # noqa
third = test(2000, 3000, 1000, 0xe, 0xe58) # noqa
first = test(1000, 2000, 3000, 0xe, 0x58e) # noqa: E221
second = test(3000, 1000, 2000, 0xe, 0x8e5)
third = test(2000, 3000, 1000, 0xe, 0xe58) # noqa: E221
print(first, second, third)
assert first == second and second == third
print('with bad ctor')
first = test(1000, 2000, 3000, 0xf, 0x58f) # noqa; 2 will succeed
second = test(3000, 1000, 2000, 0xf, 0x8f5) # noqa; 1 will succedd
third = test(2000, 3000, 1000, 0xf, 0xf58) # noqa; 0 will succeed
first = test(1000, 2000, 3000, 0xf, 0x58f) # noqa: E221. 2 will succeed
second = test(3000, 1000, 2000, 0xf, 0x8f5) # 1 will succedd
third = test(2000, 3000, 1000, 0xf, 0xf58) # noqa: E221. 0 will succeed
print(first, second, third)
self.assertLess(first, second)
self.assertLess(second, third)
Expand Down Expand Up @@ -9182,12 +9182,12 @@ def test_codesize_cxx(self, *args):
self.run_codesize_test('hello_libcxx.cpp', *args, check_funcs=False)

@parameterized({
'O0': ([], [], ['waka']), # noqa
'O1': (['-O1'], [], ['waka']), # noqa
'O2': (['-O2'], [], ['waka']), # noqa
'O3': (['-O3'], [], []), # noqa; in -O3, -Os and -Oz we metadce
'Os': (['-Os'], [], []), # noqa
'Oz': (['-Oz'], [], []), # noqa
'O0': ([], [], ['waka']),
'O1': (['-O1'], [], ['waka']),
'O2': (['-O2'], [], ['waka']),
'O3': (['-O3'], [], []), # in -O3, -Os and -Oz we metadce
'Os': (['-Os'], [], []),
'Oz': (['-Oz'], [], []),
# finally, check what happens when we export nothing. wasm should be almost empty
'export_nothing':
(['-Os', '-sEXPORTED_FUNCTIONS=[]'], [], []), # noqa
Expand Down
2 changes: 1 addition & 1 deletion tools/file_packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def generate_object_file(data_files):
# The name of file
{f.c_symbol_name}_name:
.asciz "{dstpath}"
.size {f.c_symbol_name}_name, {len(dstpath)+1}
.size {f.c_symbol_name}_name, {len(dstpath) + 1}

# The size of the file followed by the content itself
{f.c_symbol_name}:
Expand Down
2 changes: 1 addition & 1 deletion tools/maint/npm_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def run(cmd, **args):
def main():
if run(['git', 'status', '-uno', '--porcelain']).strip():
print('tree is not clean')
#return 1
return 1
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was actually a bug that accidentally submitted this.


output = run(['npx', 'npm-check-updates', '-u'], stderr=subprocess.STDOUT).strip()

Expand Down