From fc8791de92114c7a30daade15e5d51ffd13af601 Mon Sep 17 00:00:00 2001 From: Lucas Hoffmann Date: Fri, 3 Jan 2025 02:01:29 +0100 Subject: [PATCH] Merge Union-Literal type annotations --- khard/contacts.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/khard/contacts.py b/khard/contacts.py index 3a720ce..d6d93ce 100644 --- a/khard/contacts.py +++ b/khard/contacts.py @@ -45,9 +45,8 @@ def multi_property_key(item: str) -> tuple[Literal[0], str]: ... @overload def multi_property_key(item: dict[T, Any]) -> tuple[Literal[1], T]: ... @overload -def multi_property_key(item: Union[str, dict[T, Any]]) -> tuple[Union[Literal[0], Literal[1]], Union[str, T]]: ... -def multi_property_key(item: Union[str, dict[T, Any]] - ) -> tuple[int, Union[T, str]]: +def multi_property_key(item: Union[str, dict[T, Any]]) -> tuple[Literal[0, 1], Union[T, str]]: ... +def multi_property_key(item: Union[str, dict[T, Any]]) -> tuple[Literal[0, 1], Union[T, str]]: """Key function to pass to sorted(), allowing sorting of dicts with lists and strings. Dicts will be sorted by their label, after other types.