diff --git a/aiologger/handlers/base.py b/aiologger/handlers/base.py index e0f4ff9..139b28a 100644 --- a/aiologger/handlers/base.py +++ b/aiologger/handlers/base.py @@ -6,7 +6,6 @@ from typing import Optional, Union from aiologger import settings -from aiologger.utils import loop_compat from aiologger.filters import Filterer from aiologger.formatters.base import Formatter from aiologger.formatters.json import JsonFormatter @@ -18,7 +17,6 @@ _default_formatter = Formatter() -@loop_compat class Handler(Filterer): """ Handler instances dispatch logging events to specific destinations. diff --git a/aiologger/handlers/files.py b/aiologger/handlers/files.py index ff34f00..0a7ed1a 100644 --- a/aiologger/handlers/files.py +++ b/aiologger/handlers/files.py @@ -17,10 +17,9 @@ from aiologger.handlers.base import Handler from aiologger.records import LogRecord -from aiologger.utils import classproperty, get_running_loop, loop_compat +from aiologger.utils import classproperty, get_running_loop -@loop_compat class AsyncFileHandler(Handler): terminator = "\n" diff --git a/aiologger/handlers/streams.py b/aiologger/handlers/streams.py index 64674e7..9386d9e 100644 --- a/aiologger/handlers/streams.py +++ b/aiologger/handlers/streams.py @@ -3,7 +3,7 @@ from asyncio import AbstractEventLoop, StreamWriter from typing import Union, Optional -from aiologger.utils import get_running_loop, loop_compat +from aiologger.utils import get_running_loop from aiologger.filters import Filter from aiologger.formatters.base import Formatter from aiologger.handlers.base import Handler @@ -12,7 +12,6 @@ from aiologger.records import LogRecord -@loop_compat class AsyncStreamHandler(Handler): terminator = "\n" diff --git a/aiologger/logger.py b/aiologger/logger.py index 5b9fb3d..d6c1467 100644 --- a/aiologger/logger.py +++ b/aiologger/logger.py @@ -11,12 +11,7 @@ from aiologger.handlers.streams import AsyncStreamHandler from aiologger.levels import LogLevel, check_level from aiologger.records import LogRecord -from aiologger.utils import ( - get_current_frame, - create_task, - loop_compat, - bind_loop, -) +from aiologger.utils import get_current_frame, create_task _HandlerFactory = Callable[[], Awaitable[Iterable[Handler]]] @@ -48,7 +43,6 @@ def o_o(): _srcfile = o_o.__code__.co_filename -@loop_compat class Logger(Filterer): def __init__(self, *, name="aiologger", level=LogLevel.NOTSET) -> None: super(Logger, self).__init__() @@ -73,7 +67,7 @@ def with_default_handlers( ): self = cls(name=name, level=level, **kwargs) # type: ignore - _AsyncStreamHandler = bind_loop(AsyncStreamHandler, kwargs) + _AsyncStreamHandler = AsyncStreamHandler self.add_handler( _AsyncStreamHandler( stream=sys.stdout, diff --git a/aiologger/loggers/json.py b/aiologger/loggers/json.py index 75c0c11..3a52253 100644 --- a/aiologger/loggers/json.py +++ b/aiologger/loggers/json.py @@ -4,7 +4,7 @@ from typing import Dict, Iterable, Callable, Tuple, Any, Optional, Mapping from aiologger import Logger -from aiologger.utils import create_task, loop_compat +from aiologger.utils import create_task from aiologger.formatters.base import Formatter from aiologger.formatters.json import ExtendedJsonFormatter from aiologger.levels import LogLevel @@ -12,7 +12,6 @@ from aiologger.records import ExtendedLogRecord -@loop_compat class JsonLogger(Logger): def __init__( self, diff --git a/aiologger/utils.py b/aiologger/utils.py index 7e68986..6781b10 100644 --- a/aiologger/utils.py +++ b/aiologger/utils.py @@ -72,28 +72,6 @@ def __init__(self, *args, **kwargs): _F = TypeVar("_F", bound=Callable[..., object]) -if sys.version_info >= (3, 10): - - def loop_compat(v: _T) -> _T: - return v - - def bind_loop(v: _F, kwargs: dict) -> _F: - return v - - -else: - loop_compat = _LoopCompat.decorate - - def bind_loop(v: _F, kwargs: dict) -> _F: - """ - bind a loop kwarg, without letting mypy know about it - """ - try: - return cast(_F, functools.partial(v, loop=kwargs["loop"])) - except KeyError: - pass - return v - class classproperty: def __init__(self, func):