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 33311c9 commit c508420
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
16 changes: 1 addition & 15 deletions cantok/tokens/abstract/abstract_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,13 @@
from abc import ABC, abstractmethod
from threading import RLock
from typing import List, Dict, Awaitable, Optional, Union, Any
from collections.abc import Iterable

try:
from typing import TypeAlias
except ImportError: # pragma: no cover
from typing_extensions import TypeAlias

from cantok.errors import CancellationError
from cantok.tokens.abstract.cancel_cause import CancelCause
from cantok.tokens.abstract.report import CancellationReport
from cantok.tokens.abstract.coroutine_wrapper import WaitCoroutineWrapper
from cantok.types import IterableWithTokens

if sys.version_info > (3, 9):
from typing import TypeAlias
else: # pragma: no cover
from typing_extensions import TypeAlias

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

class AbstractToken(ABC):
exception = CancellationError
Expand Down
11 changes: 1 addition & 10 deletions cantok/tokens/timeout_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,12 @@
from collections.abc import Iterable
import sys

try:
from typing import TypeAlias
except ImportError: # pragma: no cover
from typing_extensions import TypeAlias

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


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 Down
13 changes: 13 additions & 0 deletions cantok/types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys
from collections.abc import Iterable


if sys.version_info > (3, 9):
from typing import TypeAlias # pragma: no cover
else:
from typing_extensions import TypeAlias # pragma: no cover

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

0 comments on commit c508420

Please sign in to comment.