From 49b49967ebab28ee41d836bf683b0e2a25460efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Br=C3=BCnnler?= Date: Tue, 3 Dec 2024 17:31:57 +0100 Subject: [PATCH 1/3] Relax type of keys --- stubs/tabulate/tabulate/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/tabulate/tabulate/__init__.pyi b/stubs/tabulate/tabulate/__init__.pyi index 383c29242ea6..684d5ef02b2d 100644 --- a/stubs/tabulate/tabulate/__init__.pyi +++ b/stubs/tabulate/tabulate/__init__.pyi @@ -44,7 +44,7 @@ multiline_formats: dict[str, str] def simple_separated_format(separator: str) -> TableFormat: ... def tabulate( - tabular_data: Mapping[str, Iterable[Any]] | Iterable[Iterable[Any]], + tabular_data: Mapping[object, Iterable[Any]] | Iterable[Iterable[Any]], headers: str | dict[str, str] | Sequence[str] = (), tablefmt: str | TableFormat = "simple", floatfmt: str | Iterable[str] = "g", From 5271d80e9fa3f8cb990b145e1717be6c6e7a5832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Br=C3=BCnnler?= Date: Wed, 4 Dec 2024 18:19:23 +0100 Subject: [PATCH 2/3] Use Any for key type --- stubs/tabulate/tabulate/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/tabulate/tabulate/__init__.pyi b/stubs/tabulate/tabulate/__init__.pyi index 684d5ef02b2d..b6a51b4e0a64 100644 --- a/stubs/tabulate/tabulate/__init__.pyi +++ b/stubs/tabulate/tabulate/__init__.pyi @@ -44,7 +44,7 @@ multiline_formats: dict[str, str] def simple_separated_format(separator: str) -> TableFormat: ... def tabulate( - tabular_data: Mapping[object, Iterable[Any]] | Iterable[Iterable[Any]], + tabular_data: Mapping[Any, Iterable[Any]] | Iterable[Iterable[Any]], headers: str | dict[str, str] | Sequence[str] = (), tablefmt: str | TableFormat = "simple", floatfmt: str | Iterable[str] = "g", From fa7d311b259d30b16d11c80d04862ec516023fa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20Br=C3=BCnnler?= Date: Thu, 5 Dec 2024 23:26:13 +0100 Subject: [PATCH 3/3] Add comment Co-authored-by: Sebastian Rittau --- stubs/tabulate/tabulate/__init__.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/tabulate/tabulate/__init__.pyi b/stubs/tabulate/tabulate/__init__.pyi index b6a51b4e0a64..f258717ad56f 100644 --- a/stubs/tabulate/tabulate/__init__.pyi +++ b/stubs/tabulate/tabulate/__init__.pyi @@ -44,6 +44,7 @@ multiline_formats: dict[str, str] def simple_separated_format(separator: str) -> TableFormat: ... def tabulate( + # The key is converted using str(). tabular_data: Mapping[Any, Iterable[Any]] | Iterable[Iterable[Any]], headers: str | dict[str, str] | Sequence[str] = (), tablefmt: str | TableFormat = "simple",