From 2de14a6c8ff561a1683ad21e299d149f12427bec Mon Sep 17 00:00:00 2001 From: Richard Neumann Date: Mon, 14 Feb 2022 13:22:52 +0100 Subject: [PATCH] Fix deprecation warnings --- rcon/__init__.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/rcon/__init__.py b/rcon/__init__.py index dff29c7..40228f3 100644 --- a/rcon/__init__.py +++ b/rcon/__init__.py @@ -1,5 +1,6 @@ """RCON client library.""" +from typing import Any, Coroutine from warnings import warn from rcon.source import rcon as _rcon @@ -10,18 +11,20 @@ class Client(_Client): """Backwards compatibility.""" def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) warn( 'rcon.Client() is deprecated. Use rcon.source.Client() instead.', - DeprecationWarning + DeprecationWarning, + stacklevel=2 ) + super().__init__(*args, **kwargs) -async def rcon(*args, **kwargs) -> str: +def rcon(*args, **kwargs) -> Coroutine[Any, Any, str]: """Backwards compatibility.""" warn( 'rcon.rcon() is deprecated. Use rcon.source.rcon() instead.', - DeprecationWarning + DeprecationWarning, + stacklevel=2 ) - return await _rcon(*args, **kwargs) + return _rcon(*args, **kwargs)