diff --git a/pyee/asyncio.py b/pyee/asyncio.py index 49509d5..60000f4 100644 --- a/pyee/asyncio.py +++ b/pyee/asyncio.py @@ -1,12 +1,10 @@ # -*- coding: utf-8 -*- from asyncio import AbstractEventLoop, ensure_future, Future, iscoroutine, wait -from typing import Any, Callable, cast, Dict, Optional, Set, Tuple +from typing import Any, Callable, cast, Dict, Optional, Self, Set, Tuple from pyee.base import EventEmitter -Self = Any - __all__ = ["AsyncIOEventEmitter"] diff --git a/pyee/base.py b/pyee/base.py index 168e57d..ca4f866 100644 --- a/pyee/base.py +++ b/pyee/base.py @@ -10,14 +10,13 @@ Mapping, Optional, overload, + Self, Set, Tuple, TypeVar, Union, ) -Self = Any - class PyeeException(Exception): """An exception internal to pyee. Deprecated in favor of PyeeError.""" diff --git a/pyee/executor.py b/pyee/executor.py index eda832c..01faa59 100644 --- a/pyee/executor.py +++ b/pyee/executor.py @@ -2,12 +2,10 @@ from concurrent.futures import Executor, Future, ThreadPoolExecutor from types import TracebackType -from typing import Any, Callable, Dict, Optional, Tuple, Type +from typing import Any, Callable, Dict, Optional, Self, Tuple, Type from pyee.base import EventEmitter -Self = Any - __all__ = ["ExecutorEventEmitter"] diff --git a/pyee/trio.py b/pyee/trio.py index 3893a85..a3cf51a 100644 --- a/pyee/trio.py +++ b/pyee/trio.py @@ -7,9 +7,9 @@ AsyncGenerator, Awaitable, Callable, - cast, Dict, Optional, + Self, Tuple, Type, ) @@ -18,8 +18,6 @@ from pyee.base import EventEmitter, PyeeError -Self = Any - __all__ = ["TrioEventEmitter"] @@ -126,7 +124,7 @@ async def __aenter__(self: Self) -> "TrioEventEmitter": self._context: Optional[AbstractAsyncContextManager["TrioEventEmitter"]] = ( self.context() ) - return await cast(Any, self._context).__aenter__() + return await self._context.__aenter__() async def __aexit__( self: Self, diff --git a/pyee/twisted.py b/pyee/twisted.py index bf0d4df..4f52ff2 100644 --- a/pyee/twisted.py +++ b/pyee/twisted.py @@ -1,16 +1,13 @@ # -*- coding: utf-8 -*- from asyncio import iscoroutine -from typing import Any, Callable, cast, Dict, Optional, Tuple +from typing import Any, Callable, Dict, Optional, Self, Tuple from twisted.internet.defer import Deferred, ensureDeferred from twisted.python.failure import Failure from pyee.base import EventEmitter, PyeeError -Self = Any - - __all__ = ["TwistedEventEmitter"] @@ -90,6 +87,6 @@ def _emit_handle_potential_error(self: Self, event: str, error: Any) -> None: else: self.emit("error", PyeeError(f"Unexpected failure object: {error}")) else: - cast(Any, super(TwistedEventEmitter, self))._emit_handle_potential_error( + (super(TwistedEventEmitter, self))._emit_handle_potential_error( event, error ) diff --git a/pyproject.toml b/pyproject.toml index de05e41..227cac4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,9 +21,6 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13",