fix: repair imports lost in the 3.1 rebase and meet the new lint baseline

The rebase onto upstream 3.1 (mypy + ruff I001/F401 waves) left the tree
short of the newly enforced baselines in three ways:

* contextlib / UbridgeError imports dropped as false duplicates during
  conflict resolution left NameErrors in iou_vm and qemu_vm (F821);
  the Dynamips router grabbed the compute-level NIOTAP instead of the
  hypervisor one, breaking TAP anchoring (test failure).
* unused imports (KERNEL_UNSUPPORTED_FILTERS, UbridgeError, List) and
  unsorted blocks left behind where the stack's later commits moved the
  last usage elsewhere — ruff I001/F401/RUF022 now enforce these.
* mypy, now baseline-free: cache dict annotations in tc_probe, the
  locators candidate list, the resolved-params None branch in the MCP
  runner, and validate_bpf_syntax keeps the upstream Dict[str, Any]
  return (the strict Optional[str] was wrong for the "valid" bool entry).

The e2e raw-frame probe resolves its compiler via shutil.which (S607)
and zips with strict= (B905); the remaining subprocess call is S603 by
nature and gets a per-file ignore like other test files.

ruff check/format clean, mypy at upstream parity (no new errors),
full unit suite 2167 passed.
This commit is contained in:
YueGuobin committed 2026-10-06 00:21:11 +08:00
1 parent e13e5f3804
commit 7d04d08dba
35 files changed
+165 -136

No files matched your search

+12 -2
View File
@@ -101,7 +101,17 @@ from .compute.iou_nodes import IOU, IOUCreate, IOUStart, IOUUpdate
from .compute.nat_nodes import NAT, NATCreate, NATUpdate
# Compute schemas
from .compute.nios import AnchorNIO, TAPNIO, UDPNIO, BridgeNIO, BatchNIOCreate, BatchNIOEntry, EthernetNIO, MarkerRebuild, MarkerToggle
from .compute.nios import (
TAPNIO,
UDPNIO,
AnchorNIO,
BatchNIOCreate,
BatchNIOEntry,
BridgeNIO,
EthernetNIO,
MarkerRebuild,
MarkerToggle,
)
from .compute.qemu_nodes import Qemu, QemuCreate, QemuUpdate
from .compute.virtualbox_nodes import VirtualBox, VirtualBoxCreate, VirtualBoxUpdate
from .compute.vmware_nodes import VMware, VMwareCreate, VMwareUpdate
@@ -159,12 +169,12 @@ __all__ = [
"ATMSwitch",
"ATMSwitchCreate",
"ATMSwitchUpdate",
"AnchorNIO",
"ApiKeyCreate",
"Appliance",
"ApplianceVersion",
"ApplianceVersionV8",
"AutoIdlePC",
"AnchorNIO",
"BatchNIOCreate",
"BatchNIOEntry",
"BridgeNIO",
+2 -1
View File
@@ -16,11 +16,12 @@
import uuid
from enum import Enum
from typing import Any, List, Optional, Union
from typing import Any, Optional, Union
from pydantic import BaseModel, ConfigDict, Field, SecretStr, model_validator
from .base import DateTimeModelMixin
# The capabilities payload has one definition (controller.capabilities): a
# second, private copy here silently stripped every field it did not know
# about from GET /computes/{id} — which is how ubridge_tap and