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

+5 -3
View File
@@ -3,7 +3,8 @@
from __future__ import annotations
import ipaddress
from typing import Any, Mapping
from collections.abc import Mapping
from typing import Any
from .common import boolean, integer, link_list, links, number, status, text
@@ -132,8 +133,9 @@ def parse_network_protocol(proto: Mapping[str, Any]) -> dict[str, Any]:
for community in snmp.get("CommunityStrings") or []:
if isinstance(community, Mapping):
# The community string itself is never kept, even if a BMC returns it.
communities.append({"name": text(community.get("Name")),
"access": text(community.get("AccessMode"))})
communities.append(
{"name": text(community.get("Name")), "access": text(community.get("AccessMode"))}
)
return {
"hostname": text(proto.get("HostName")),