From: John Mulligan Date: Sat, 20 Jan 2024 16:07:54 +0000 (-0500) Subject: pybind/mgr/dashboard: correct type signature of CRUDEndpoint arg X-Git-Tag: v19.3.0~130^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=86f23452752032f6768d312e2d772dca8b3c6beb;p=ceph.git pybind/mgr/dashboard: correct type signature of CRUDEndpoint arg Typing issue was found by mypy 1.5.1. The type only accepted values of str but based on the data and code using set_column data the boolean assignments to the 'isHidden' key were correct and so I updated the type to also accept bool. A more correct fix might be to use typing.TypedDict - this would require python 3.8 (or typing extensions) and someone more familiar with the dashboard code :-) Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/dashboard/controllers/_crud.py b/src/pybind/mgr/dashboard/controllers/_crud.py index d65649cadb4b..855832ff5508 100644 --- a/src/pybind/mgr/dashboard/controllers/_crud.py +++ b/src/pybind/mgr/dashboard/controllers/_crud.py @@ -332,7 +332,7 @@ class CRUDEndpoint: CRUDClassMetadata: Optional[RESTController] = None def __init__(self, router: APIRouter, doc: APIDoc, - set_column: Optional[Dict[str, Dict[str, str]]] = None, + set_column: Optional[Dict[str, Dict[str, Union[str, bool]]]] = None, actions: Optional[List[TableAction]] = None, permissions: Optional[List[str]] = None, forms: Optional[List[Form]] = None, column_key: Optional[str] = None,