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

+20 -10
View File
@@ -35,8 +35,9 @@ def fake_pyghmi(monkeypatch):
def x10(http):
server = MockupServer(http, MOCKUP)
for path, status in json.loads((FIXTURES / MOCKUP / "STATUS.json").read_text()).items():
body = json.loads((FIXTURES / MOCKUP / path[len("/redfish/v1/"):] / "index.json")
.read_text())
body = json.loads(
(FIXTURES / MOCKUP / path[len("/redfish/v1/") :] / "index.json").read_text()
)
server.override("GET", path, status, body)
return server
@@ -49,8 +50,9 @@ def _open(**optional):
@pytest.fixture
def unlicensed(x10):
x10.override("GET", "/redfish/v1/", 403,
json.loads((X10 / "service_root_403.json").read_text()))
x10.override(
"GET", "/redfish/v1/", 403, json.loads((X10 / "service_root_403.json").read_text())
)
d = _open()
yield d
d.close()
@@ -84,7 +86,11 @@ def test_redfish_is_used_and_ipmi_is_not_even_opened(x10):
assert d.get_facts()["model"] == "X10DRL-i"
assert len(d.get_hardware_inventory()["cpus"]) == 2
assert d.get_power_state()["actions"] == [
"GracefulShutdown", "ForceOff", "GracefulRestart", "ForceRestart"]
"GracefulShutdown",
"ForceOff",
"GracefulRestart",
"ForceRestart",
]
finally:
d.close()
assert FakeCommand.instances == []
@@ -117,10 +123,12 @@ def test_the_ipmi_port_is_its_own(x10):
def test_the_partial_license_warning_passes_through(x10):
d = _open()
try:
assert d.get_device_warnings() == [{
"code": "bmc_license_partial",
"meta": {"licenses": "DCMS", "parts": ["drives", "firmware inventory"]},
}]
assert d.get_device_warnings() == [
{
"code": "bmc_license_partial",
"meta": {"licenses": "DCMS", "parts": ["drives", "firmware inventory"]},
}
]
finally:
d.close()
@@ -134,7 +142,9 @@ def test_an_unlicensed_bmc_is_read_over_ipmi(unlicensed):
assert facts["model"] == "X10DRL-i"
assert facts["os_version"] == "3.91"
assert unlicensed.get_power_state() == {
"state": "On", "actions": ["GracefulShutdown", "ForceOff", "ForceRestart"]}
"state": "On",
"actions": ["GracefulShutdown", "ForceOff", "ForceRestart"],
}
def test_an_unlicensed_bmc_switches_power_over_ipmi(unlicensed):