Skip to content

Commit

Permalink
fix: revert type annotations on collections.to_set
Browse files Browse the repository at this point in the history
This turns out to be tricky to type with union args, see e.g. python/mypy#18321
  • Loading branch information
jvansanten committed Jan 7, 2025
1 parent b453a55 commit 516f7d8
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 17 deletions.
8 changes: 0 additions & 8 deletions ampel/util/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <jakob.van.santen@desy.de>"]
Expand Down
8 changes: 0 additions & 8 deletions tests/test_collections.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import assert_type

from ampel.util.collections import to_set

Expand All @@ -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])

0 comments on commit 516f7d8

Please sign in to comment.