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:
1 parent
5b24675a12
commit
09029ca0a4
29 files changed
+985
-456
No files matched your search
@@ -2,7 +2,8 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Mapping
|
||||
from collections.abc import Mapping
|
||||
from typing import Any
|
||||
|
||||
from .common import ident, integer, link_list, links, number, status, text
|
||||
|
||||
@@ -10,10 +11,12 @@ from .common import ident, integer, link_list, links, number, status, text
|
||||
def parse_system(system: Mapping[str, Any]) -> dict[str, Any]:
|
||||
"""Identity, summaries and links of the managed server."""
|
||||
state, health = status(system)
|
||||
cpus = system.get("ProcessorSummary") if isinstance(system.get("ProcessorSummary"),
|
||||
Mapping) else {}
|
||||
memory = system.get("MemorySummary") if isinstance(system.get("MemorySummary"),
|
||||
Mapping) else {}
|
||||
cpus = (
|
||||
system.get("ProcessorSummary")
|
||||
if isinstance(system.get("ProcessorSummary"), Mapping)
|
||||
else {}
|
||||
)
|
||||
memory = system.get("MemorySummary") if isinstance(system.get("MemorySummary"), Mapping) else {}
|
||||
return {
|
||||
"id": text(system.get("Id")),
|
||||
"name": text(system.get("Name")),
|
||||
@@ -44,8 +47,9 @@ def parse_power_state(system: Mapping[str, Any]) -> str | None:
|
||||
return text(system.get("PowerState"))
|
||||
|
||||
|
||||
def parse_reset_action(resource: Mapping[str, Any],
|
||||
action: str = "#ComputerSystem.Reset") -> dict[str, Any]:
|
||||
def parse_reset_action(
|
||||
resource: Mapping[str, Any], action: str = "#ComputerSystem.Reset"
|
||||
) -> dict[str, Any]:
|
||||
"""Target and allowed ``ResetType`` values of a reset action.
|
||||
|
||||
``allowed`` is ``None`` when the service does not list the values inline. Then
|
||||
|
||||
Reference in new issue
Block a user