From 3c69599a49145eedd37e9e5f3f14ad81d91f3806 Mon Sep 17 00:00:00 2001 From: Moritz Kiemer Date: Tue, 22 Oct 2024 15:46:44 +0200 Subject: [PATCH] try to fix future mypy findings Change-Id: Iab52182e36f0ad7f3f5d9a3eaaa235f264e85ad4 --- cmk/base/check_legacy_includes/df.py | 4 ++-- cmk/base/legacy_checks/hp_blade_blades.py | 4 ++-- cmk/plugins/mysql/agent_based/mysql_replica_slave.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmk/base/check_legacy_includes/df.py b/cmk/base/check_legacy_includes/df.py index 2ac811c5222..d139a91fdf4 100644 --- a/cmk/base/check_legacy_includes/df.py +++ b/cmk/base/check_legacy_includes/df.py @@ -137,9 +137,9 @@ def df_check_filesystem_single_coroutine( # pylint: disable=too-many-branches params.get("subtract_reserved", False) and reserved_mb > 0, params.get("show_reserved") and reserved_mb > 0, ) - # params might still be a tuple + # params might still be a tuple # (mo): I don't think so. if isinstance(params, dict) - else (False, False, False) + else ("onproblem", False, False) ) used_mb = size_mb - avail_mb diff --git a/cmk/base/legacy_checks/hp_blade_blades.py b/cmk/base/legacy_checks/hp_blade_blades.py index 0b061d3613e..135c8735268 100644 --- a/cmk/base/legacy_checks/hp_blade_blades.py +++ b/cmk/base/legacy_checks/hp_blade_blades.py @@ -41,7 +41,7 @@ } -def saveint(i: str) -> int: +def saveint(i: object) -> int: """Tries to cast a string to an integer and return it. In case this fails, it returns 0. @@ -49,7 +49,7 @@ def saveint(i: str) -> int: bad style these days, because in case you get 0 back from this function, you can not know whether it is really 0 or something went wrong.""" try: - return int(i) + return int(i) # type: ignore[call-overload] except (TypeError, ValueError): return 0 diff --git a/cmk/plugins/mysql/agent_based/mysql_replica_slave.py b/cmk/plugins/mysql/agent_based/mysql_replica_slave.py index 4080bda714a..fcb63aa1a31 100644 --- a/cmk/plugins/mysql/agent_based/mysql_replica_slave.py +++ b/cmk/plugins/mysql/agent_based/mysql_replica_slave.py @@ -32,7 +32,7 @@ class Error(NamedTuple): message: str -Section = Error | dict[str, int | None | bool | Literal["NULL"]] +Section = Error | Mapping[str, int | None | bool | Literal["NULL"]] def _parse_mysql_replica_slave(