From: John Mulligan Date: Tue, 28 Mar 2023 21:06:51 +0000 (-0400) Subject: mgr/dashboard: add an assertion for type narrowing X-Git-Tag: v17.2.8~507^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9b8749a4a87ee801ac84607e2935543bbccf4803;p=ceph.git mgr/dashboard: add an assertion for type narrowing This change makes this file pass mypy checking on mypy 0.981. Signed-off-by: John Mulligan (cherry picked from commit e1df7d939ff9f3445b129c9ace5387bd639c8e7a) --- diff --git a/src/pybind/mgr/dashboard/controllers/_rest_controller.py b/src/pybind/mgr/dashboard/controllers/_rest_controller.py index 6b4afc27672c..0224c366f3bc 100644 --- a/src/pybind/mgr/dashboard/controllers/_rest_controller.py +++ b/src/pybind/mgr/dashboard/controllers/_rest_controller.py @@ -70,6 +70,7 @@ class RESTController(BaseController, skip_registry=True): for k, v in cls._method_mapping.items(): func = getattr(cls, k, None) while hasattr(func, "__wrapped__"): + assert func func = func.__wrapped__ if v['resource'] and func: path_params = cls.get_path_param_names()