Skip to content

Commit e996a64

Browse files
committed
Hoist the uuid_formatter attribute to the top pool listing class
Signed-off-by: mulhern <amulhern@redhat.com>
1 parent cbdff52 commit e996a64

1 file changed

Lines changed: 8 additions & 18 deletions

File tree

src/stratis_cli/_actions/_list_pool.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,12 @@ def display(self):
230230
List the pools.
231231
"""
232232

233+
def __init__(self, uuid_formatter: Callable[[UUID | str], str]):
234+
"""
235+
Initializer.
236+
"""
237+
self.uuid_formatter = uuid_formatter
238+
233239

234240
class Default(ListPool):
235241
"""
@@ -320,7 +326,7 @@ def __init__(self, uuid_formatter: Callable[[str | UUID], str], selection: PoolI
320326
:param uuid_formatter: str or UUID -> str
321327
:param PoolId selection: how to select pools to list
322328
"""
323-
self.uuid_formatter = uuid_formatter
329+
super().__init__(uuid_formatter)
324330
self.selection = selection
325331

326332
def _print_detail_view(
@@ -444,14 +450,6 @@ class DefaultTable(Default): # pylint: disable=too-few-public-methods
444450
List several pools with a table view.
445451
"""
446452

447-
def __init__(self, uuid_formatter: Callable[[str | UUID], str]):
448-
"""
449-
Initializer.
450-
:param uuid_formatter: function to format a UUID str or UUID
451-
:param uuid_formatter: str or UUID -> str
452-
"""
453-
self.uuid_formatter = uuid_formatter
454-
455453
def display(self):
456454
"""
457455
List pools in table view.
@@ -596,7 +594,7 @@ def __init__(self, uuid_formatter: Callable[[str | UUID], str], selection: PoolI
596594
:param uuid_formatter: str or UUID -> str
597595
:param PoolId selection: how to select pools to list
598596
"""
599-
self.uuid_formatter = uuid_formatter
597+
super().__init__(uuid_formatter)
600598
self.selection = selection
601599

602600
def _print_detail_view(self, pool_uuid: str, pool: StoppedPool):
@@ -690,14 +688,6 @@ class StoppedTable(Stopped): # pylint: disable=too-few-public-methods
690688
Table view of one or many stopped pools.
691689
"""
692690

693-
def __init__(self, uuid_formatter: Callable[[str | UUID], str]):
694-
"""
695-
Initializer.
696-
:param uuid_formatter: function to format a UUID str or UUID
697-
:param uuid_formatter: str or UUID -> str
698-
"""
699-
self.uuid_formatter = uuid_formatter
700-
701691
def display(self):
702692
"""
703693
List stopped pools.

0 commit comments

Comments
 (0)