Skip to content

Commit 582c633

Browse files
authored
fix(typecheck): add unused-ignore to cross-platform type: ignore comments (#176)
On Windows, ctypes.windll and signal.SIGBREAK exist natively, making the attr-defined type: ignore comments unnecessary. Adding unused-ignore suppresses the mypy strict warning on Windows while preserving the attr-defined suppression needed on Linux.
1 parent 45c668b commit 582c633

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/rdc/_platform.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def terminate_process(pid: int) -> bool:
3535
# GenerateConsoleCtrlEvent requires same console group. Acceptable for now.
3636
import ctypes
3737

38-
kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]
38+
kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined,unused-ignore]
3939
handle = kernel32.OpenProcess(0x0001, False, pid) # PROCESS_TERMINATE
4040
if not handle:
4141
return False
@@ -80,7 +80,7 @@ def is_pid_alive(pid: int, *, tag: str = "rdc") -> bool:
8080
# TODO(W-next): check process name against tag on Windows
8181
import ctypes
8282

83-
kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined]
83+
kernel32 = ctypes.windll.kernel32 # type: ignore[attr-defined,unused-ignore]
8484
handle = kernel32.OpenProcess(0x0400, False, pid) # PROCESS_QUERY_INFORMATION
8585
if not handle:
8686
return False
@@ -124,7 +124,7 @@ def _handler(*_: object) -> None:
124124
sys.exit(0)
125125

126126
if _WIN: # pragma: no cover
127-
signal.signal(signal.SIGBREAK, _handler) # type: ignore[attr-defined]
127+
signal.signal(signal.SIGBREAK, _handler) # type: ignore[attr-defined,unused-ignore]
128128
else:
129129
signal.signal(signal.SIGTERM, _handler)
130130

0 commit comments

Comments
 (0)