From edac60e6b7ac874f41b12c508e6e32672622941d Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 11 Dec 2025 14:49:37 +0000 Subject: [PATCH] typing: Use Mapping, not dict dict is invariant. Mapping is not. Change-Id: Ic2b1e88f02526581c7662d037228fc0e6539084a Signed-off-by: Stephen Finucane --- osc_lib/utils/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osc_lib/utils/__init__.py b/osc_lib/utils/__init__.py index 8fc5439f..2b8d0116 100644 --- a/osc_lib/utils/__init__.py +++ b/osc_lib/utils/__init__.py @@ -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.