Skip to content

Commit

Permalink
fucking stupid tuping
Browse files Browse the repository at this point in the history
  • Loading branch information
pomponchik committed Aug 8, 2024
1 parent 19cac44 commit 6ec807b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cantok/tokens/timeout_token.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from time import monotonic_ns, perf_counter
from typing import Union, Callable, List, Dict, Any
from typing import TypeAlias, Union, Callable, List, Dict, Any
from collections.abc import Iterable
import sys

from cantok import AbstractToken
from cantok import ConditionToken
from cantok.errors import TimeoutCancellationError


if sys.version_info >= (3, 8):
IterableWithTokens: TypeAlias = Iterable[AbstractToken] # pragma: no cover
else:
IterableWithTokens = Iterable # pragma: no cover

class TimeoutToken(ConditionToken):
exception = TimeoutCancellationError

Expand All @@ -33,7 +39,7 @@ def function() -> bool:

super().__init__(function, *tokens, cancelled=cancelled)

def filter_tokens(self, tokens: Iterable[AbstractToken]) -> List[AbstractToken]:
def filter_tokens(self, tokens: IterableWithTokens) -> List[AbstractToken]:
result: List[AbstractToken] = []

for token in tokens:
Expand Down

0 comments on commit 6ec807b

Please sign in to comment.