Skip to content
Open
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
11 changes: 4 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,13 @@ lint.ignore = [
"undocumented-magic-method",
"undocumented-public-nested-class",
"undocumented-public-init",
"incorrect-blank-line-before-class",
"multi-line-summary-second-line",
"incorrect-blank-line-before-class", # Superceeded by no-blank-line-before-class
"multi-line-summary-second-line", # Superceeded by multi-line-summary-first-line
"non-imperative-mood",
"assert-false", # See https://github.com/PyCQA/flake8-bugbear/issues/66
"function-uses-loop-variable",
"star-arg-unpacking-after-keyword-arg",
"multiple-spaces-before-keyword",
"module-import-not-at-top-of-file",
"multiple-spaces-after-comma",
"multiple-leading-hashes-for-block-comment",
"line-too-long",
"type-comparison",
Expand All @@ -79,17 +77,16 @@ lint.ignore = [
"redefined-loop-name",
"mutable-class-default",
"unnecessary-iterable-allocation-for-first-element",
"missing-f-string-syntax",
"unraw-re-pattern",
"non-empty-init-module",
"format-literals", # TODO
]
lint.per-file-ignores."tools/ports/*.py" = [ "unused-function-argument", "unused-lambda-argument" ]
lint.per-file-ignores."tools/webidl_binder.py" = [ "printf-string-formatting", "f-string" ]
lint.per-file-ignores."test/other/ports/*.py" = [ "unused-function-argument" ]
lint.per-file-ignores."test/parallel_testsuite.py" = [ "unused-method-argument" ]
lint.per-file-ignores."test/test_benchmark.py" = [ "unused-method-argument" ]
lint.per-file-ignores."test/*.py" = [ "collection-literal-concatenation", "printf-string-formatting" ]
lint.per-file-ignores."test/*.py" = [ "collection-literal-concatenation", "printf-string-formatting", "multiple-spaces-after-comma" ]
lint.per-file-ignores."system/lib/update_*.py" = [ "multiple-spaces-after-comma" ]
lint.mccabe.max-complexity = 51 # Recommended: 10
lint.pylint.allow-magic-value-types = [
"bytes",
Expand Down
1 change: 1 addition & 0 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.

# ruff: file-ignore[multiple-spaces-before-keyword]

import errno
import glob
Expand Down
2 changes: 2 additions & 0 deletions tools/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.

# ruff: file-ignore[missing-f-string-syntax]

import logging
import os
import shutil
Expand Down
2 changes: 1 addition & 1 deletion tools/empath-split.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def parse_paths_file(paths_file_content):
else:
path = normalize_path(line)
if path in path_to_module:
exit_with_error("Path '{path}' cannot be assigned to module '{cur_module}; it is already assigned to module '{path_to_module[path]}'")
exit_with_error(f"Path '{path}' cannot be assigned to module '{cur_module}; it is already assigned to module '{path_to_module[path]}'")
cur_paths.append(path)
path_to_module[path] = cur_module

Expand Down
2 changes: 2 additions & 0 deletions tools/maint/create_dom_pk_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

# Use #include <emscripten/dom_pk_codes.h> in your code to access these IDs.

# ruff: file-ignore[multiple-spaces-after-comma]

import os
import random
import sys
Expand Down
2 changes: 1 addition & 1 deletion tools/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
('WASM_WORKERS', 'MAIN_MODULE', 'dynamic linking is not supported with -sWASM_WORKERS'),
('WASM2JS', 'MAIN_MODULE', 'wasm2js does not support dynamic linking'),
('WASM2JS', 'SIDE_MODULE', 'wasm2js does not support dynamic linking'),
('WASM2JS', 'GROWABLE_ARRAYBUFFERS', None),
('WASM2JS', 'GROWABLE_ARRAYBUFFERS', None),
('WASM2JS', 'SUPPORT_BIG_ENDIAN', None),
('WASM2JS', 'MEMORY64', None),
('MAIN_MODULE', 'NO_WASM_ASYNC_COMPILATION', 'dynamic linking requires async wasm compilation'),
Expand Down
16 changes: 8 additions & 8 deletions tools/webidl_binder.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,33 +493,33 @@ def is_ptr_arg(i):

# Wrap asserts with existence check when argument is optional.
if all_checks and optional:
body += "if(typeof {0} !== 'undefined' && {0} !== null) {{\n".format(js_arg)
body += f"if(typeof {js_arg} !== 'undefined' && {js_arg} !== null) {{\n"
# Special case argument types.
if arg.type.isNumeric():
if arg.type.isInteger():
if all_checks:
body += " assert(typeof {0} === 'number' && !isNaN({0}), '{1}Expecting <integer>');\n".format(js_arg, check_msg)
body += f" assert(typeof {js_arg} === 'number' && !isNaN({js_arg}), '{check_msg}Expecting <integer>');\n"
else:
if all_checks:
body += " assert(typeof {0} === 'number', '{1}Expecting <number>');\n".format(js_arg, check_msg)
body += f" assert(typeof {js_arg} === 'number', '{check_msg}Expecting <number>');\n"
# No transform needed for numbers
elif arg.type.isBoolean():
if all_checks:
body += " assert(typeof {0} === 'boolean' || (typeof {0} === 'number' && !isNaN({0})), '{1}Expecting <boolean>');\n".format(js_arg, check_msg)
body += f" assert(typeof {js_arg} === 'boolean' || (typeof {0} === 'number' && !isNaN({0})), '{1}Expecting <boolean>');\n"
# No transform needed for booleans
elif arg.type.isString():
# Strings can be DOM strings or pointers.
if all_checks:
body += " assert(typeof {0} === 'string' || ({0} && typeof {0} === 'object' && typeof {0}.ptr === 'number'), '{1}Expecting <string>');\n".format(js_arg, check_msg)
body += f" assert(typeof {js_arg} === 'string' || ({js_arg} && typeof {js_arg} === 'object' && typeof {js_arg}.ptr === 'number'), '{check_msg}Expecting <string>');\n"
do_default = True # legacy path is fast enough for strings.
elif arg.type.isInterface():
if all_checks:
body += " assert(typeof {0} === 'object' && typeof {0}.ptr === 'number', '{1}Expecting <pointer>');\n".format(js_arg, check_msg)
body += f" assert(typeof {js_arg} === 'object' && typeof {js_arg}.ptr === 'number', '{check_msg}Expecting <pointer>');\n"
if optional:
body += " if(typeof {0} !== 'undefined' && {0} !== null) {{ {0} = {0}.ptr }};\n".format(js_arg)
body += f" if(typeof {js_arg} !== 'undefined' && {js_arg} !== null) {{ {js_arg} = {js_arg}.ptr }};\n"
else:
# No checks in fast mode when the arg is required
body += " {0} = {0}.ptr;\n".format(js_arg)
body += f" {js_arg} = {js_arg}.ptr;\n"
else:
do_default = True

Expand Down
Loading