diff --git a/streamable/functions.py b/streamable/functions.py index ea9d351..84a19d9 100644 --- a/streamable/functions.py +++ b/streamable/functions.py @@ -14,9 +14,6 @@ cast, ) -with suppress(ImportError): - from typing import Literal - from streamable.iters import ( AsyncConcurrentMappingIterable, ByKeyGroupingIterator, @@ -45,6 +42,9 @@ validate_truncate_args, ) +with suppress(ImportError): + from typing import Literal + T = TypeVar("T") U = TypeVar("U") diff --git a/streamable/iters.py b/streamable/iters.py index fce16f6..3625b03 100644 --- a/streamable/iters.py +++ b/streamable/iters.py @@ -26,12 +26,8 @@ cast, ) -from streamable.util.loggertools import get_logger - -with suppress(ImportError): - from typing import Literal - from streamable.util.functiontools import catch_and_raise_as +from streamable.util.loggertools import get_logger T = TypeVar("T") U = TypeVar("U") @@ -46,6 +42,9 @@ FutureResultCollection, ) +with suppress(ImportError): + from typing import Literal + class CatchingIterator(Iterator[T]): def __init__( diff --git a/streamable/stream.py b/streamable/stream.py index 2504c7b..7e0e212 100644 --- a/streamable/stream.py +++ b/streamable/stream.py @@ -21,12 +21,8 @@ overload, ) -from streamable.util.loggertools import get_logger - -with suppress(ImportError): - from typing import Literal - from streamable.util.constants import NO_REPLACEMENT +from streamable.util.loggertools import get_logger from streamable.util.validationtools import ( validate_concurrency, validate_group_interval, @@ -37,6 +33,9 @@ validate_via, ) +with suppress(ImportError): + from typing import Literal + # fmt: off if TYPE_CHECKING: import builtins if TYPE_CHECKING: from streamable.visitors import Visitor