Use a generic instead of Any in MenuHelper (#3574)
This commit also removes an unused _get_table_header method.
This commit is contained in:
parent
2843d01600
commit
1e7a4831ae
|
|
@ -1,13 +1,11 @@
|
|||
from typing import Any
|
||||
|
||||
from archinstall.lib.output import FormattedOutput
|
||||
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
||||
|
||||
|
||||
class MenuHelper:
|
||||
class MenuHelper[ValueT]:
|
||||
def __init__(
|
||||
self,
|
||||
data: list[Any],
|
||||
data: list[ValueT],
|
||||
additional_options: list[str] = [],
|
||||
) -> None:
|
||||
self._separator = ''
|
||||
|
|
@ -30,12 +28,8 @@ class MenuHelper:
|
|||
|
||||
return group
|
||||
|
||||
def _get_table_header(self, data_formatted: dict[str, Any]) -> list[str]:
|
||||
table_header = [key for key, val in data_formatted.items() if val is None]
|
||||
return table_header
|
||||
|
||||
def _table_to_data_mapping(self, data: list[Any]) -> dict[str, Any | None]:
|
||||
display_data: dict[str, Any | None] = {}
|
||||
def _table_to_data_mapping(self, data: list[ValueT]) -> dict[str, ValueT | str | None]:
|
||||
display_data: dict[str, ValueT | str | None] = {}
|
||||
|
||||
if data:
|
||||
table = FormattedOutput.as_table(data)
|
||||
|
|
|
|||
Loading…
Reference in New Issue