Skip to content

Commit

Permalink
try to fix future mypy findings
Browse files Browse the repository at this point in the history
Change-Id: Iab52182e36f0ad7f3f5d9a3eaaa235f264e85ad4
  • Loading branch information
mo-ki committed Oct 22, 2024
1 parent 68a8055 commit 3c69599
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions cmk/base/check_legacy_includes/df.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cmk/base/legacy_checks/hp_blade_blades.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@
}


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.
Advice: Please don't use this function in new code. It is understood as
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

Expand Down
2 changes: 1 addition & 1 deletion cmk/plugins/mysql/agent_based/mysql_replica_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 3c69599

Please sign in to comment.