File: __init__.py

package info (click to toggle)
python-rcon 2.4.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 348 kB
  • sloc: python: 1,224; makefile: 42; sh: 6
file content (34 lines) | stat: -rw-r--r-- 966 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""RCON client library."""

from typing import Any, Coroutine
from warnings import warn

from rcon.exceptions import EmptyResponse, SessionTimeout, WrongPassword
from rcon.source import rcon as _rcon
from rcon.source import Client as _Client


__all__ = ["EmptyResponse", "SessionTimeout", "WrongPassword", "Client", "rcon"]


class Client(_Client):
    """Wrapper for the rcon.source.Client for backwards compatibility."""

    def __init__(self, *args, **kwargs):
        warn(
            "rcon.Client() is deprecated. Use rcon.source.Client() instead.",
            DeprecationWarning,
            stacklevel=2,
        )
        super().__init__(*args, **kwargs)


def rcon(*args, **kwargs) -> Coroutine[Any, Any, str]:
    """Wrapper for rcon.source.rcon() for backwards compatibility."""

    warn(
        "rcon.rcon() is deprecated. Use rcon.source.rcon() instead.",
        DeprecationWarning,
        stacklevel=2,
    )
    return _rcon(*args, **kwargs)