From 374f83e424e5d1ae463ca303961c9b93fba562b2 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 21 Jan 2022 15:34:20 -0800 Subject: [PATCH] Replace usage of `set([..])` with python set literals. NFC --- emcc.py | 6 +++--- emscripten.py | 6 +++--- tools/building.py | 6 +++--- tools/maint/check_for_unused_test_files.py | 12 ++++++------ tools/ports/__init__.py | 2 +- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/emcc.py b/emcc.py index 347c2e1be55bb..4dd8efb5b0a54 100755 --- a/emcc.py +++ b/emcc.py @@ -148,8 +148,8 @@ VALID_ENVIRONMENTS = ('web', 'webview', 'worker', 'node', 'shell') SIMD_INTEL_FEATURE_TOWER = ['-msse', '-msse2', '-msse3', '-mssse3', '-msse4.1', '-msse4.2', '-mavx'] SIMD_NEON_FLAGS = ['-mfpu=neon'] -COMPILE_ONLY_FLAGS = set(['--default-obj-ext']) -LINK_ONLY_FLAGS = set([ +COMPILE_ONLY_FLAGS = {'--default-obj-ext'} +LINK_ONLY_FLAGS = { '--bind', '--closure', '--cpuprofiler', '--embed-file', '--emit-symbol-map', '--emrun', '--exclude-file', '--extern-post-js', '--extern-pre-js', '--ignore-dynamic-linking', '--js-library', @@ -157,7 +157,7 @@ '--post-js', '--pre-js', '--preload-file', '--profiling-funcs', '--proxy-to-worker', '--shell-file', '--source-map-base', '--threadprofiler', '--use-preload-plugins' -]) +} # this function uses the global 'final' variable, which contains the current diff --git a/emscripten.py b/emscripten.py index 860f3790d4b99..b59d6732f0092 100644 --- a/emscripten.py +++ b/emscripten.py @@ -80,16 +80,16 @@ def optimize_syscalls(declares): settings.SYSCALLS_REQUIRE_FILESYSTEM = 0 else: syscall_prefixes = ('__syscall_', 'fd_') - syscalls = [d for d in declares if d.startswith(syscall_prefixes)] + syscalls = {d for d in declares if d.startswith(syscall_prefixes)} # check if the only filesystem syscalls are in: close, ioctl, llseek, write # (without open, etc.. nothing substantial can be done, so we can disable # extra filesystem support in that case) - if set(syscalls).issubset(set([ + if syscalls.issubset({ '__syscall_ioctl', 'fd_seek', 'fd_write', 'fd_close', - ])): + }): if DEBUG: logger.debug('very limited syscalls (%s) so disabling full filesystem support', ', '.join(str(s) for s in syscalls)) settings.SYSCALLS_REQUIRE_FILESYSTEM = 0 diff --git a/tools/building.py b/tools/building.py index b0c59c0a3358b..a6b41b30c5f20 100644 --- a/tools/building.py +++ b/tools/building.py @@ -405,7 +405,7 @@ def link_bitcode(args, target, force_archive_contents=False): # Tracking unresolveds is necessary for .a linking, see below. # Specify all possible entry points to seed the linking process. # For a simple application, this would just be "main". - unresolved_symbols = set([func[1:] for func in settings.EXPORTED_FUNCTIONS]) + unresolved_symbols = {func[1:] for func in settings.EXPORTED_FUNCTIONS} resolved_symbols = set() # Paths of already included object files from archives. added_contents = set() @@ -1028,7 +1028,7 @@ def metadce(js_file, wasm_file, minify_whitespace, debug_info): 'root': True }) # fix wasi imports TODO: support wasm stable with an option? - WASI_IMPORTS = set([ + WASI_IMPORTS = { 'environ_get', 'environ_sizes_get', 'args_get', @@ -1044,7 +1044,7 @@ def metadce(js_file, wasm_file, minify_whitespace, debug_info): 'proc_exit', 'clock_res_get', 'clock_time_get', - ]) + } for item in graph: if 'import' in item and item['import'][1][1:] in WASI_IMPORTS: item['import'][0] = settings.WASI_MODULE_NAME diff --git a/tools/maint/check_for_unused_test_files.py b/tools/maint/check_for_unused_test_files.py index 734340d4d6ba5..5e1606f516faa 100755 --- a/tools/maint/check_for_unused_test_files.py +++ b/tools/maint/check_for_unused_test_files.py @@ -12,24 +12,24 @@ script_dir = os.path.dirname(os.path.abspath(__file__)) root_dir = os.path.dirname(os.path.dirname(script_dir)) test_dir = os.path.join(root_dir, 'tests') -ignore_dirs = set([ +ignore_dirs = { 'third_party', 'metadce', '__pycache__', -]) -ignore_files = set([ +} +ignore_files = { 'getValue_setValue_assert.out', 'legacy_exported_runtime_numbers_assert.out', -]) +} ignore_root_patterns = ['runner.*', 'test_*.py'] -ignore_root_files = set([ +ignore_root_files = { 'jsrun.py', 'clang_native.py', 'common.py', 'parallel_testsuite.py', 'parse_benchmark_output.py', 'malloc_bench.c', -]) +} def grep(string, subdir=''): diff --git a/tools/ports/__init__.py b/tools/ports/__init__.py index 1b6d93d4f9d79..4ecde8da2918b 100644 --- a/tools/ports/__init__.py +++ b/tools/ports/__init__.py @@ -313,7 +313,7 @@ def get_needed_ports(settings): def build_port(port_name, settings): port = ports_by_name[port_name] - port_set = set((port,)) + port_set = {port} resolve_dependencies(port_set, settings) for port in dependency_order(port_set): port.get(Ports, settings, shared)