]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: allow ResultGroup to take an initial list of results
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 2 May 2024 20:39:34 +0000 (16:39 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Mon, 17 Jun 2024 15:16:59 +0000 (11:16 -0400)
Can save a line of code later.

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

index e6a2bb83e07b80a097147a5badc728e56f4805f5..77bda1e6a29af05c369a7ef5d038cec01637c58a 100644 (file)
@@ -1,4 +1,4 @@
-from typing import Iterator, List, Optional
+from typing import Iterable, Iterator, List, Optional
 
 import errno
 
@@ -84,8 +84,10 @@ class ResultGroup:
 
     # Compatible with object formatter, thus suitable for being returned
     # directly to mgr module.
-    def __init__(self) -> None:
-        self._contents: List[Result] = []
+    def __init__(
+        self, initial_results: Optional[Iterable[Result]] = None
+    ) -> None:
+        self._contents: List[Result] = list(initial_results or [])
 
     def append(self, result: Result) -> None:
         self._contents.append(result)