Skip to content

Commit 4fbf146

Browse files
sobolevnhugovk
authored andcommitted
[3.13] gh-139590: Stricter ruff rules for Tools/wasm (GH-139752)
(cherry picked from commit 678e0b8) Co-authored-by: sobolevn <mail@sobolevn.me>
1 parent ee894d2 commit 4fbf146

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ repos:
2222
name: Run Ruff (lint) on Tools/peg_generator/
2323
args: [--exit-non-zero-on-fix, --config=Tools/peg_generator/.ruff.toml]
2424
files: ^Tools/peg_generator/
25+
- id: ruff-check
26+
name: Run Ruff (lint) on Tools/wasm/
27+
args: [--exit-non-zero-on-fix, --config=Tools/wasm/.ruff.toml]
28+
files: ^Tools/wasm/
2529
- id: ruff-format
2630
name: Run Ruff (format) on Doc/
2731
args: [--check]

Tools/wasm/.ruff.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,4 @@ select = [
2222
]
2323
ignore = [
2424
"E501", # Line too long
25-
"F541", # f-string without any placeholders
26-
"PYI024", # Use `typing.NamedTuple` instead of `collections.namedtuple`
27-
"PYI025", # Use `from collections.abc import Set as AbstractSet`
2825
]

Tools/wasm/wasm_assets.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import sys
1717
import sysconfig
1818
import zipfile
19-
from typing import Dict
2019

2120
# source directory
2221
SRCDIR = pathlib.Path(__file__).parent.parent.parent.absolute()
@@ -147,7 +146,7 @@ def filterfunc(filename: str) -> bool:
147146
pzf.writepy(entry, filterfunc=filterfunc)
148147

149148

150-
def detect_extension_modules(args: argparse.Namespace) -> Dict[str, bool]:
149+
def detect_extension_modules(args: argparse.Namespace) -> dict[str, bool]:
151150
modules = {}
152151

153152
# disabled by Modules/Setup.local ?
@@ -162,7 +161,7 @@ def detect_extension_modules(args: argparse.Namespace) -> Dict[str, bool]:
162161
# disabled by configure?
163162
with open(args.sysconfig_data) as f:
164163
data = f.read()
165-
loc: Dict[str, Dict[str, str]] = {}
164+
loc: dict[str, dict[str, str]] = {}
166165
exec(data, globals(), loc)
167166

168167
for key, value in loc["build_time_vars"].items():

0 commit comments

Comments
 (0)