From 8bc772c65aa3e5429f1961717a448f9f00ca8f8d Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 2 May 2024 16:39:34 -0400 Subject: [PATCH] mgr/smb: allow ResultGroup to take an initial list of results Can save a line of code later. Signed-off-by: John Mulligan --- src/pybind/mgr/smb/results.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/smb/results.py b/src/pybind/mgr/smb/results.py index e6a2bb83e07b8..77bda1e6a29af 100644 --- a/src/pybind/mgr/smb/results.py +++ b/src/pybind/mgr/smb/results.py @@ -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) -- 2.39.5