Skip to content

Commit cedfc49

Browse files
committed
Clean up no-untyped-def #872
Change-Id: Ia24ee2926520a843491c7cb822a5570265519afe
1 parent f8d8e93 commit cedfc49

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

cmk/legacy_checks/ddn_s2a_errors.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44
# conditions defined in the file COPYING, which is part of this source code package.
55

66
# mypy: disable-error-code="no-untyped-call"
7-
# mypy: disable-error-code="no-untyped-def"
87

8+
from collections.abc import Generator, Iterable, Mapping
9+
from typing import Any
910

10-
from cmk.agent_based.legacy.v0_unstable import LegacyCheckDefinition
11+
from cmk.agent_based.legacy.v0_unstable import LegacyCheckDefinition, LegacyResult
12+
from cmk.agent_based.v2 import StringTable
1113
from cmk.legacy_includes.ddn_s2a import parse_ddn_s2a_api_response
1214

1315
check_info = {}
1416

1517

16-
def parse_ddn_s2a_errors(string_table):
18+
def parse_ddn_s2a_errors(string_table: StringTable) -> dict[str, Any]:
1719
preparsed = parse_ddn_s2a_api_response(string_table)
1820
return {
1921
"port_type": preparsed["port_type"],
@@ -29,8 +31,10 @@ def parse_ddn_s2a_errors(string_table):
2931
}
3032

3133

32-
def discover_ddn_s2a_errors(parsed):
33-
def value_to_levels(value):
34+
def discover_ddn_s2a_errors(
35+
parsed: dict[str, Any],
36+
) -> Iterable[tuple[str, dict[str, tuple[int, int]]]]:
37+
def value_to_levels(value: int) -> tuple[int, int]:
3438
# As the values in this check are all error counters since last reset,
3539
# we calculate default levels according to the current counter state,
3640
# so we'll be warned if an error occurs.
@@ -59,8 +63,12 @@ def value_to_levels(value):
5963
)
6064

6165

62-
def check_ddn_s2a_errors(item, params, parsed):
63-
def check_errors(value, levels, infotext_formatstring):
66+
def check_ddn_s2a_errors(
67+
item: str, params: Mapping[str, Any], parsed: dict[str, Any]
68+
) -> Generator[LegacyResult]:
69+
def check_errors(
70+
value: int, levels: tuple[int, int] | None, infotext_formatstring: str
71+
) -> tuple[int, str]:
6472
infotext = infotext_formatstring % value
6573
if levels is None:
6674
return 0, infotext

0 commit comments

Comments
 (0)