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). What ruff
cannot fix comes in the next commit.
This commit is contained in:
Christian Manivong committed 2026-10-23 08:47:07 +02:00
1 parent 8145a9f479
commit b23967417c
3 files changed
+62 -34

No files matched your search

+9 -7
View File
@@ -6,7 +6,6 @@ import pytest
from fritzconnection.core.exceptions import (
FritzActionError,
FritzArrayIndexError,
FritzServiceError,
)
from napalm.base.exceptions import ConnectionClosedException, ConnectionException
@@ -135,9 +134,9 @@ DSL_INFO = {
"NewDownstreamMaxRate": 120000,
"NewUpstreamMaxRate": 50000,
"NewDownstreamNoiseMargin": 120, # 12.0 dB
"NewUpstreamNoiseMargin": 80, # 8.0 dB
"NewUpstreamNoiseMargin": 80, # 8.0 dB
"NewDownstreamAttenuation": 150, # 15.0 dB
"NewUpstreamAttenuation": 90, # 9.0 dB
"NewUpstreamAttenuation": 90, # 9.0 dB
}
DSL_STATS = {
@@ -639,7 +638,8 @@ class TestPPPoEInterface:
class TestAutoMaxBitRate:
def test_lan_speed_zero_when_auto(self, driver):
driver.fc.call_action.side_effect = lambda svc, act, **kw: (
LAN_INFO_AUTO_RATE if (svc, act) == ("LANEthernetInterfaceConfig1", "GetInfo")
LAN_INFO_AUTO_RATE
if (svc, act) == ("LANEthernetInterfaceConfig1", "GetInfo")
else _call_action(svc, act, **kw)
)
interfaces = driver.get_interfaces()
@@ -690,7 +690,8 @@ class TestGetSystemConfig:
def test_firmware_not_available_when_none(self, driver):
driver.fc.call_action.side_effect = lambda svc, act, **kw: (
UI_INFO_NO_UPDATE if (svc, act) == ("UserInterface1", "X_AVM-DE_GetInfo")
UI_INFO_NO_UPDATE
if (svc, act) == ("UserInterface1", "X_AVM-DE_GetInfo")
else _call_action(svc, act, **kw)
)
assert driver.get_system_config()["firmware_update_available"] is False
@@ -730,8 +731,9 @@ class TestIPv6Pinholes:
def test_pinholes_are_not_reported_as_nat_translations(self, driver):
"""A pinhole opens the firewall for a globally routable address; there
is nothing to translate."""
assert all(":" not in t["inside_local"].rsplit(":", 1)[0]
for t in driver.get_nat_translations())
assert all(
":" not in t["inside_local"].rsplit(":", 1)[0] for t in driver.get_nat_translations()
)
def test_no_pinholes_without_ipv6_service(self, driver):
del driver.fc.services["WANIPv6Firewall1"]