Browse Source

Fix deprecation warnings

pull/8/head 2.1.1
Richard Neumann 3 years ago
parent
commit
2de14a6c8f
  1. 13
      rcon/__init__.py

13
rcon/__init__.py

@ -1,5 +1,6 @@
"""RCON client library.""" """RCON client library."""
from typing import Any, Coroutine
from warnings import warn from warnings import warn
from rcon.source import rcon as _rcon from rcon.source import rcon as _rcon
@ -10,18 +11,20 @@ class Client(_Client):
"""Backwards compatibility.""" """Backwards compatibility."""
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
warn( warn(
'rcon.Client() is deprecated. Use rcon.source.Client() instead.', '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.""" """Backwards compatibility."""
warn( warn(
'rcon.rcon() is deprecated. Use rcon.source.rcon() instead.', 'rcon.rcon() is deprecated. Use rcon.source.rcon() instead.',
DeprecationWarning DeprecationWarning,
stacklevel=2
) )
return await _rcon(*args, **kwargs) return _rcon(*args, **kwargs)

Loading…
Cancel
Save