From: John Mulligan Date: Fri, 6 May 2022 17:48:47 +0000 (-0400) Subject: pybind/mgr: extend return types valid for Responder wrapped functions X-Git-Tag: v18.0.0~130^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=370901a4e66f5d5a03c18cfd3808e7026d291385;p=ceph.git pybind/mgr: extend return types valid for Responder wrapped functions One wonders why this wasn't found by the test code, but oh well. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/object_format.py b/src/pybind/mgr/object_format.py index ab3e0c707624..d4c04fd91447 100644 --- a/src/pybind/mgr/object_format.py +++ b/src/pybind/mgr/object_format.py @@ -190,12 +190,6 @@ class Format(str, enum.Enum): SimpleData = Any -ObjectResponseFuncType = Union[ - Callable[..., Dict[Any, Any]], - Callable[..., List[Any]], -] - - class SimpleDataProvider(Protocol): def to_simplified(self) -> SimpleData: """Return a simplified representation of the current object. @@ -443,6 +437,16 @@ class ErrorResponse(ErrorResponseBase): return err +ObjectResponseFuncType = Union[ + Callable[..., Dict[Any, Any]], + Callable[..., List[Any]], + Callable[..., SimpleDataProvider], + Callable[..., JSONDataProvider], + Callable[..., YAMLDataProvider], + Callable[..., ReturnValueProvider], +] + + def _get_requested_format(f: ObjectResponseFuncType, kw: Dict[str, Any]) -> str: # todo: leave 'format' in kw dict iff its part of f's signature return kw.pop("format", None)