From 516f7d81ca5be87871ce6a4fd630fb74fe1841e1 Mon Sep 17 00:00:00 2001 From: Jakob van Santen Date: Tue, 7 Jan 2025 18:26:58 +0100 Subject: [PATCH] fix: revert type annotations on collections.to_set This turns out to be tricky to type with union args, see e.g. https://github.com/python/mypy/issues/18321 --- ampel/util/collections.py | 8 -------- pyproject.toml | 2 +- tests/test_collections.py | 8 -------- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/ampel/util/collections.py b/ampel/util/collections.py index 8608d05f..8a9e6ad3 100755 --- a/ampel/util/collections.py +++ b/ampel/util/collections.py @@ -90,14 +90,6 @@ def try_reduce(arg: Any) -> Any: return arg -@overload -def to_set(arg: StrictIterable[T]) -> set[T]: - ... - -@overload -def to_set(arg: _T) -> set[_T]: - ... - def to_set(arg) -> set: """ Reminder of python questionable logic: diff --git a/pyproject.toml b/pyproject.toml index 2567dd1e..7faa1302 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ampel-interface" -version = "0.10.4a1" +version = "0.10.4a2" description = "Base classes for the Ampel analysis platform" authors = ["Valery Brinnel"] maintainers = ["Jakob van Santen "] diff --git a/tests/test_collections.py b/tests/test_collections.py index 9b73c7db..2261ec62 100644 --- a/tests/test_collections.py +++ b/tests/test_collections.py @@ -1,4 +1,3 @@ -from typing import assert_type from ampel.util.collections import to_set @@ -7,10 +6,3 @@ def test_to_set(): assert to_set("abc") == {'abc'} assert to_set(("abc",)) == {'abc'} - - class sentinel: - pass - - assert_type(to_set("abc"), set[str]) - assert_type(to_set(("abc",)), set[str]) - assert_type(to_set({1: sentinel()}.values()), set[sentinel]) \ No newline at end of file