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 6ec807b commit 4e8d40b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cantok/tokens/abstract/abstract_token.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sys
from sys import getrefcount
from abc import ABC, abstractmethod
from threading import RLock
from typing import List, Dict, Awaitable, Optional, Union, Any
from typing import TypeAlias, List, Dict, Awaitable, Optional, Union, Any
from collections.abc import Iterable

from cantok.errors import CancellationError
Expand All @@ -10,6 +11,11 @@
from cantok.tokens.abstract.coroutine_wrapper import WaitCoroutineWrapper


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

class AbstractToken(ABC):
exception = CancellationError
rollback_if_nondirect_polling = False
Expand Down Expand Up @@ -79,7 +85,7 @@ def __add__(self, item: 'AbstractToken') -> 'AbstractToken':
def __bool__(self) -> bool:
return self.keep_on()

def filter_tokens(self, tokens: Iterable['AbstractToken']) -> List['AbstractToken']:
def filter_tokens(self, tokens: IterableWithTokens) -> List['AbstractToken']:
from cantok import DefaultToken

result: List[AbstractToken] = []
Expand Down

0 comments on commit 4e8d40b

Please sign in to comment.