From f581ecf4b8866f2ba13f966af76baf0cef8ba500 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Sat, 20 Jan 2024 10:45:46 -0500 Subject: [PATCH] pybind/mgr/cephadm: fix typing issue Found using mypy 0.990. Newer mypy versions see the check as tautological because `self.func` is typed as always being `Callable` and thus always true. I don't know if the typing is wrong or if the if-block is tautological (and redundant). For now, silence the error by using `getattr` instead of direct attribute access. Signed-off-by: John Mulligan --- src/pybind/mgr/cephadm/configchecks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/mgr/cephadm/configchecks.py b/src/pybind/mgr/cephadm/configchecks.py index b9dcb18f478..38cde7806af 100644 --- a/src/pybind/mgr/cephadm/configchecks.py +++ b/src/pybind/mgr/cephadm/configchecks.py @@ -150,7 +150,7 @@ class CephadmCheckDefinition: "description": self.description, "name": self.name, "status": self.status, - "valid": True if self.func else False + "valid": True if getattr(self, 'func', None) else False } -- 2.39.5