style: ruff format and the lint rules of the driver standard

Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM
driver uses (E, F, I, UP, B at line length 100, Python 3.10). Mapping and
Iterable come from collections.abc, imports are sorted. What ruff cannot
fix comes in the next commit.
This commit is contained in:
Christian Manivong committed 2026-10-23 08:39:45 +02:00
1 parent 5b24675a12
commit 09029ca0a4
29 files changed
+985 -456

No files matched your search

+17 -11
View File
@@ -18,24 +18,30 @@ package updates and service control for a BMC.
```python
class ManagementControllerDriver(DeviceTypeDriver):
"""Contract, not code."""
ROLE: str = "management_controller" # key exposed as device_class
ROLE: str = "management_controller" # key exposed as device_class
TYPE_LABEL: str = "Management Controller"
USES_SSH: bool = False # Redfish is HTTPS; IPMI is UDP
USES_SSH: bool = False # Redfish is HTTPS; IPMI is UDP
if TYPE_CHECKING:
# The managed machine
def get_power_state(self) -> PowerStateDict: ...
def set_power_state(self, action: PowerAction) -> None: ... # On, GracefulShutdown,
# ForceOff, GracefulRestart,
# ForceRestart, PowerCycle
def get_hardware_inventory(self) -> HardwareInventoryDict: ... # CPUs, DIMMs, drives,
# PSUs, NICs, serials
def set_power_state(self, action: PowerAction) -> None:
... # On, GracefulShutdown,
# ForceOff, GracefulRestart,
# ForceRestart, PowerCycle
def get_hardware_inventory(self) -> HardwareInventoryDict:
... # CPUs, DIMMs, drives,
# PSUs, NICs, serials
def get_event_log(self, limit: int = 500) -> List[EventLogEntryDict]: ... # SEL
# The controller itself
def get_firmware_inventory(self) -> List[FirmwareDict]: ... # BMC, BIOS, others
def get_management_protocols(self) -> ManagementProtocolsDict: ... # IPMI, SSH,
# HTTP(S), SNMP,
# KVM, virtual media
def get_firmware_inventory(self) -> List[FirmwareDict]: ... # BMC, BIOS, others
def get_management_protocols(self) -> ManagementProtocolsDict:
... # IPMI, SSH,
# HTTP(S), SNMP,
# KVM, virtual media
```
Points to settle in napalm-device-types: