diff --git a/bootstrap.py b/bootstrap.py index 880915f21e8f7..91590a9ca9b4b 100755 --- a/bootstrap.py +++ b/bootstrap.py @@ -152,13 +152,13 @@ def main(args): continue print(f'Out-of-date: {name}') if args.dry_run: - if type(action) == list: + if isinstance(action, list): action_str = ' '.join(action) else: action_str = action.__name__ print(f' (skipping: dry run) -> {action_str}') continue - if type(action) == list: + if isinstance(action, list): run_cmd(action) else: action() diff --git a/embuilder.py b/embuilder.py index 9284af26091de..b748abc493336 100755 --- a/embuilder.py +++ b/embuilder.py @@ -189,8 +189,8 @@ def get_port_variant(name): def clear_port(port_name): - with get_port_variant(port_name) as port_name: - ports.clear_port(port_name, settings) + with get_port_variant(port_name) as port_name_base: + ports.clear_port(port_name_base, settings) def build_port(port_name): diff --git a/emrun.py b/emrun.py index b48e0208ef415..145b3b2164c7e 100644 --- a/emrun.py +++ b/emrun.py @@ -476,7 +476,6 @@ def handle_incoming_message(self, seq_num, log, data): # queued message, ignoring the proper order. This ensures that if any # messages are actually lost, that the message queue will be orderly flushed. def print_timed_out_messages(self): - global last_message_time with http_mutex: now = tick() max_message_queue_time = 5 diff --git a/pyproject.toml b/pyproject.toml index 87c9d2640f0b5..8cbce9634f067 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,6 @@ lint.ignore = [ "module-import-not-at-top-of-file", "multiple-leading-hashes-for-block-comment", "line-too-long", - "type-comparison", "ambiguous-variable-name", "indentation-with-invalid-multiple", # Does not honor `indent-width`. See https://github.com/astral-sh/ruff/issues/8705 "indentation-with-invalid-multiple-comment", # Does not honor `indent-width`. See https://github.com/astral-sh/ruff/issues/8705 @@ -67,9 +66,7 @@ lint.ignore = [ "too-many-boolean-expressions", "too-many-locals", "too-many-nested-blocks", - "redefined-argument-from-local", "no-self-use", - "global-variable-not-assigned", "global-statement", "too-many-statements-in-try-clause", "subprocess-run-without-check", diff --git a/test/jsrun.py b/test/jsrun.py index bbd8d9874f593..dbb01a1c94af1 100644 --- a/test/jsrun.py +++ b/test/jsrun.py @@ -55,7 +55,6 @@ def check_engine(engine): engine_path = engine[0] else: engine_path = engine - global WORKING_ENGINES if engine_path not in WORKING_ENGINES: logging.debug(f'Checking JS engine {engine}') try: diff --git a/test/test_browser.py b/test/test_browser.py index 15f8629956415..e9103d7a52da3 100644 --- a/test/test_browser.py +++ b/test/test_browser.py @@ -190,7 +190,7 @@ def is_jspi(args): def skipIfFeatureNotAvailable(skip_env_var, feature, message): - for env_var in skip_env_var if type(skip_env_var) == list else [skip_env_var]: + for env_var in skip_env_var if isinstance(skip_env_var, list) else [skip_env_var]: should_skip = browser_should_skip_feature(env_var, feature) if should_skip: break diff --git a/test/test_other.py b/test/test_other.py index d2c96fa81755b..385c2b49c9d8f 100644 --- a/test/test_other.py +++ b/test/test_other.py @@ -15067,8 +15067,8 @@ def test_unused_destructor(self): self.assertNotIn(b'hello from dtor', read_binary('test_unused_destructor.wasm')) def test_strip_all(self): - def has_debug_section(wasm): - with webassembly.Module('hello_world.wasm') as wasm: + def has_debug_section(wasm_file): + with webassembly.Module(wasm_file) as wasm: return wasm.get_custom_section('.debug_info') is not None # Use -O2 to ensure wasm-opt gets run diff --git a/tools/cmdline.py b/tools/cmdline.py index b5b7749a56333..42a30d848729f 100644 --- a/tools/cmdline.py +++ b/tools/cmdline.py @@ -685,7 +685,7 @@ def parse_string_list(text): return [] return parse_string_list_members(text) - if expected_type == list or (text and text[0] == '['): + if expected_type is list or (text and text[0] == '['): # if json parsing fails, we fall back to our own parser, which can handle a few # simpler syntaxes try: @@ -703,7 +703,7 @@ def parse_string_list(text): return parsed - if expected_type == float: + if expected_type is float: try: return float(text) except ValueError: @@ -749,7 +749,7 @@ def apply_user_settings(): expected_type = settings.types.get(key) - if filename and expected_type == list and value.strip()[0] != '[': + if filename and expected_type is list and value.strip()[0] != '[': # Prefer simpler one-line-per value parser value = parse_symbol_list_file(value) else: diff --git a/tools/emscripten.py b/tools/emscripten.py index b62496f41c979..7f64b599fe361 100644 --- a/tools/emscripten.py +++ b/tools/emscripten.py @@ -1065,7 +1065,7 @@ def create_receiving(function_exports, other_exports, library_symbols, aliases): continue receiving.append(f" assert(typeof wasmExports['{sym}'] != 'undefined', 'missing Wasm export: {sym}');") for sym, info in exports.items(): - is_function = type(info) == webassembly.FuncType + is_function = isinstance(info, webassembly.FuncType) mangled = asmjs_mangle(sym) assignment = mangled if generate_dyncall_assignment and is_function and sym.startswith('dynCall_'): diff --git a/tools/settings.py b/tools/settings.py index ef2b0f1b05bbb..182e3d1f7fb5d 100644 --- a/tools/settings.py +++ b/tools/settings.py @@ -432,7 +432,7 @@ def check_type(self, name, value): if not expected_type: return # Allow integers 1 and 0 for type `bool` - if expected_type == bool and type(value) is not list: + if expected_type is bool and type(value) is not list: if value in {1, 0}: value = bool(value) if value in {'True', 'False', 'true', 'false'}: