]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/mgr: extend return types valid for Responder wrapped functions
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 6 May 2022 17:48:47 +0000 (13:48 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 23 Aug 2022 17:01:45 +0000 (13:01 -0400)
One wonders why this wasn't found by the test code, but oh well.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/object_format.py

index ab3e0c707624a0b1be887b8d2a0bce5fea2928fa..d4c04fd91447eb98699dcfbc44e3534f74696ee5 100644 (file)
@@ -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)