typing: Use Mapping, not dict

dict is invariant. Mapping is not.

Change-Id: Ic2b1e88f02526581c7662d037228fc0e6539084a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
Stephen Finucane
2025-12-11 14:49:37 +00:00
parent 009a567f8f
commit edac60e6b7

View File

@@ -481,8 +481,8 @@ def get_client_class(
return importutils.import_class(client_path)
FormattableColumnT = ty.TypeVar(
'FormattableColumnT', bound=cliff_columns.FormattableColumn[ty.Any]
FormatterT = (
type[cliff_columns.FormattableColumn[ty.Any]] | functools.partial[ty.Any]
)
@@ -490,7 +490,7 @@ def get_dict_properties(
item: dict[str, _T],
fields: collections.abc.Sequence[str],
mixed_case_fields: collections.abc.Sequence[str] | None = None,
formatters: dict[str, type[FormattableColumnT]] | None = None,
formatters: collections.abc.Mapping[str, FormatterT] | None = None,
) -> tuple[ty.Any, ...]:
"""Return a tuple containing the item properties.
@@ -541,7 +541,7 @@ def get_item_properties(
item: dict[str, _T],
fields: collections.abc.Sequence[str],
mixed_case_fields: collections.abc.Sequence[str] | None = None,
formatters: dict[str, type[FormattableColumnT]] | None = None,
formatters: collections.abc.Mapping[str, FormatterT] | None = None,
) -> tuple[ty.Any, ...]:
"""Return a tuple containing the item properties.