Use a generic instead of Any in MenuHelper (#3574)

This commit also removes an unused _get_table_header method.
This commit is contained in:
correctmost 2025-06-04 01:55:07 +00:00 committed by GitHub
parent 2843d01600
commit 1e7a4831ae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 10 deletions

View File

@ -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)