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. up at all we no-op.
""" """
try: try:
from decnet.telemetry import wrap_repository # type: ignore[attr-defined] from decnet.telemetry import wrap_repository
except ImportError: except ImportError:
return bus return bus
try: try:

View File

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

View File

@@ -43,7 +43,7 @@ class HoneydocPdfGenerator(CanaryGenerator):
def generate(self, ctx: CanaryContext) -> CanaryArtifact: def generate(self, ctx: CanaryContext) -> CanaryArtifact:
try: try:
from pikepdf import Pdf, Name, Dictionary, String # type: ignore[import-not-found] from pikepdf import Pdf, Name, Dictionary, String
except ImportError as e: except ImportError as e:
raise InstrumenterRejectedError( raise InstrumenterRejectedError(
"honeydoc_pdf requires pikepdf; install it (`pip install " "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, self, blob: bytes, ctx: CanaryContext, *, target_path: str,
) -> CanaryArtifact: ) -> CanaryArtifact:
try: try:
from PIL import Image, PngImagePlugin # type: ignore[import-not-found] from PIL import Image, PngImagePlugin
except ImportError as e: except ImportError as e:
raise InstrumenterRejectedError( raise InstrumenterRejectedError(
"image instrumenter requires Pillow; install it (`pip " "image instrumenter requires Pillow; install it (`pip "

View File

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

View File

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

View File

@@ -346,7 +346,7 @@ def _stream_container(
publish_fn: CollectorPublishFn | None = None, publish_fn: CollectorPublishFn | None = None,
) -> None: ) -> None:
"""Stream logs from one container and append to the host log files.""" """Stream logs from one container and append to the host log files."""
import docker # type: ignore[import] import docker
lf: Optional[Any] = None lf: Optional[Any] = None
jf: 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. Watches Docker events to pick up containers started after initial scan.
""" """
import docker # type: ignore[import] import docker
log_path = Path(log_file) log_path = Path(log_file)
json_path = log_path.with_suffix(".json") 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 [] return []
try: try:
import psutil # type: ignore import psutil
bound = { bound = {
c.laddr.port c.laddr.port
for c in psutil.net_connections(kind="inet") 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: def _load_sqlite_vec(conn: sqlite3.Connection) -> None:
try: try:
import sqlite_vec # type: ignore[import-untyped] import sqlite_vec
except ImportError as e: except ImportError as e:
raise SqliteVecUnavailable("sqlite_vec package not installed") from e raise SqliteVecUnavailable("sqlite_vec package not installed") from e
try: try:

View File

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