fix(types): T1 — remove 15 stale type: ignore comments confirmed unused by mypy

This commit is contained in:
2026-05-01 01:26:24 -04:00
parent 8033137be6
commit ed6263a53d
10 changed files with 13 additions and 13 deletions

View File

@@ -76,7 +76,7 @@ def _maybe_wrap_telemetry(bus: BaseBus) -> BaseBus:
up at all we no-op.
"""
try:
from decnet.telemetry import wrap_repository # type: ignore[attr-defined]
from decnet.telemetry import wrap_repository
except ImportError:
return bus
try:

View File

@@ -169,10 +169,10 @@ class CanaryDNSProtocol(asyncio.DatagramProtocol):
self._answer_ip = answer_ip
self._transport: Optional[asyncio.DatagramTransport] = None
def connection_made(self, transport) -> None: # type: ignore[override]
self._transport = transport # type: ignore[assignment]
def connection_made(self, transport) -> None:
self._transport = transport
def datagram_received( # type: ignore[override]
def datagram_received(
self, data: bytes, addr: Tuple[str, int],
) -> None:
try:

View File

@@ -43,7 +43,7 @@ class HoneydocPdfGenerator(CanaryGenerator):
def generate(self, ctx: CanaryContext) -> CanaryArtifact:
try:
from pikepdf import Pdf, Name, Dictionary, String # type: ignore[import-not-found]
from pikepdf import Pdf, Name, Dictionary, String
except ImportError as e:
raise InstrumenterRejectedError(
"honeydoc_pdf requires pikepdf; install it (`pip install "

View File

@@ -32,7 +32,7 @@ class ImageInstrumenter(CanaryInstrumenter):
self, blob: bytes, ctx: CanaryContext, *, target_path: str,
) -> CanaryArtifact:
try:
from PIL import Image, PngImagePlugin # type: ignore[import-not-found]
from PIL import Image, PngImagePlugin
except ImportError as e:
raise InstrumenterRejectedError(
"image instrumenter requires Pillow; install it (`pip "

View File

@@ -34,7 +34,7 @@ class PdfInstrumenter(CanaryInstrumenter):
self, blob: bytes, ctx: CanaryContext, *, target_path: str,
) -> CanaryArtifact:
try:
import pikepdf # type: ignore[import-not-found]
import pikepdf
except ImportError as e:
raise InstrumenterRejectedError(
"PDF instrumenter requires pikepdf; install it (`pip "

View File

@@ -214,7 +214,7 @@ async def _start_dns_server(
local_addr=(_dns_bind(), _dns_port()),
)
log.info("canary.dns listening zone=%s port=%d", zone, _dns_port())
return transport # type: ignore[return-value]
return transport
# ---------------------------- entry point --------------------------------

View File

@@ -346,7 +346,7 @@ def _stream_container(
publish_fn: CollectorPublishFn | None = None,
) -> None:
"""Stream logs from one container and append to the host log files."""
import docker # type: ignore[import]
import docker
lf: Optional[Any] = None
jf: Optional[Any] = None
@@ -450,7 +450,7 @@ async def log_collector_worker(log_file: str) -> None:
Watches Docker events to pick up containers started after initial scan.
"""
import docker # type: ignore[import]
import docker
log_path = Path(log_file)
json_path = log_path.with_suffix(".json")

View File

@@ -305,7 +305,7 @@ def check_no_host_port_collision(h: dict[str, Any]) -> list[ValidationIssue]:
return []
try:
import psutil # type: ignore
import psutil
bound = {
c.laddr.port
for c in psutil.net_connections(kind="inet")

View File

@@ -45,7 +45,7 @@ class SqliteVecUnavailable(RuntimeError):
def _load_sqlite_vec(conn: sqlite3.Connection) -> None:
try:
import sqlite_vec # type: ignore[import-untyped]
import sqlite_vec
except ImportError as e:
raise SqliteVecUnavailable("sqlite_vec package not installed") from e
try:

View File

@@ -99,7 +99,7 @@ class WorkerRegistry:
payload.pop("ts", None)
out.append(WorkerStatus(
name=name,
status=status, # type: ignore[arg-type]
status=status,
last_heartbeat_ts=ts,
seconds_since=seconds_since,
extra=payload,