fix(types): T1 — remove 15 stale type: ignore comments confirmed unused by mypy
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -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 "
|
||||
|
||||
@@ -380,7 +380,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 --------------------------------
|
||||
|
||||
@@ -368,7 +368,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
|
||||
@@ -472,7 +472,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")
|
||||
|
||||
@@ -338,7 +338,7 @@ async def _persist_fleet_change(
|
||||
repo: BaseRepository, decky: Any, services: list[str], compose_path: Path,
|
||||
) -> None:
|
||||
"""Persist the mutation to JSON state, compose file, and the DB row."""
|
||||
config, _ = _load_state() # type: ignore[misc] — checked earlier
|
||||
config, _ = _load_state()
|
||||
target = _fleet_find_decky(config, decky.name)
|
||||
target.services = services
|
||||
_save_state(config, compose_path)
|
||||
|
||||
@@ -374,7 +374,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")
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -32,7 +32,7 @@ router = APIRouter(prefix="/deckies/{decky_name}/tarpit", tags=["Deckies"])
|
||||
_DECKY_RE = r"^[a-z0-9\-]{1,64}$"
|
||||
|
||||
|
||||
def _tc(*args: str) -> subprocess.CompletedProcess: # type: ignore[type-arg]
|
||||
def _tc(*args: str) -> subprocess.CompletedProcess[str]:
|
||||
cmd = ["tc", *args]
|
||||
return subprocess.run(cmd, capture_output=True, text=True) # nosec B603 B404
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user