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.lib.output import FormattedOutput
|
||||||
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
from archinstall.tui.menu_item import MenuItem, MenuItemGroup
|
||||||
|
|
||||||
|
|
||||||
class MenuHelper:
|
class MenuHelper[ValueT]:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
data: list[Any],
|
data: list[ValueT],
|
||||||
additional_options: list[str] = [],
|
additional_options: list[str] = [],
|
||||||
) -> None:
|
) -> None:
|
||||||
self._separator = ''
|
self._separator = ''
|
||||||
|
|
@ -30,12 +28,8 @@ class MenuHelper:
|
||||||
|
|
||||||
return group
|
return group
|
||||||
|
|
||||||
def _get_table_header(self, data_formatted: dict[str, Any]) -> list[str]:
|
def _table_to_data_mapping(self, data: list[ValueT]) -> dict[str, ValueT | str | None]:
|
||||||
table_header = [key for key, val in data_formatted.items() if val is None]
|
display_data: dict[str, ValueT | str | None] = {}
|
||||||
return table_header
|
|
||||||
|
|
||||||
def _table_to_data_mapping(self, data: list[Any]) -> dict[str, Any | None]:
|
|
||||||
display_data: dict[str, Any | None] = {}
|
|
||||||
|
|
||||||
if data:
|
if data:
|
||||||
table = FormattedOutput.as_table(data)
|
table = FormattedOutput.as_table(data)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue