Skip to content

Commit

Permalink
broke brains because of typesafety
Browse files Browse the repository at this point in the history
  • Loading branch information
romanmatveevsky committed Aug 12, 2024
1 parent afe493f commit 7a2a8fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions returns/methods/partition.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

from typing import Iterable, List, TypeVar, Union
from typing import Iterable, List, TypeVar

from returns.interfaces.specific import ioresult, result
from returns.interfaces.specific import result
from returns.primitives.exceptions import UnwrapFailedError

_ValueType = TypeVar('_ValueType', covariant=True)
Expand All @@ -11,10 +11,7 @@

def partition(
containers: Iterable[
Union[
result.ResultBasedN[_ValueType, _ErrorType, _AdditionalType],
ioresult.IOResultBasedN[_ValueType, _ErrorType, _AdditionalType],
]
result.UnwrappableResult[_ValueType, _ErrorType, _AdditionalType, _ValueType, _ErrorType],
],
) -> tuple[List[_ValueType], List[_ErrorType]]:
"""
Expand Down
2 changes: 1 addition & 1 deletion typesafety/test_methods/test_partition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
from returns.io import IO, IOResult, IOSuccess
x: Tuple[IOResult[int, str], IOResult[int, str]]
reveal_type(partition(x)) # N: Revealed type is "Tuple[builtins.list[IO[builtin.int]], builtins.list[IO[builtin.int]]"
reveal_type(partition(x)) # N: Revealed type is "Tuple[builtins.list[IO[builtin.int]], builtins.list[IO[builtin.str]]"

0 comments on commit 7a2a8fc

Please sign in to comment.