|
| 1 | +import types |
| 2 | +from typing import Any, Literal, TypedDict, overload |
| 3 | +from typing_extensions import Self |
| 4 | + |
| 5 | +from gi.repository import Gio |
| 6 | + |
| 7 | +from .bus_names import OwnMixin, WatchMixin |
| 8 | +from .proxy import ProxyMixin |
| 9 | +from .publication import PublicationMixin |
| 10 | +from .registration import RegistrationMixin |
| 11 | +from .request_name import RequestNameMixin |
| 12 | +from .subscription import SubscriptionMixin |
| 13 | + |
| 14 | +# Gio.DBusConnection.pydbus: Bus |
| 15 | + |
| 16 | +def bus_get(type: Gio.BusType) -> Bus: ... |
| 17 | +def connect(address: str) -> Bus: ... |
| 18 | + |
| 19 | +class DBusOrgFreedesktopDBus: |
| 20 | + # Incomplete DBUS.org.freedesktop.DBus |
| 21 | + Features: list[str] |
| 22 | + |
| 23 | + def GetId(self) -> str: ... |
| 24 | + |
| 25 | +class DBusOrgFreedesktopPolicyKit1Authority: |
| 26 | + # Incomplete DBUS.org.freedesktop.PolicyKit1.Authority |
| 27 | + BackendName: str |
| 28 | + BackendVersion: str |
| 29 | + |
| 30 | +OrgBluezDict = TypedDict( |
| 31 | + "OrgBluezDict", |
| 32 | + { |
| 33 | + "org.bluez.AgentManager1": dict[Any, Any], |
| 34 | + "org.bluez.ProfileManager1": dict[Any, Any], |
| 35 | + "org.freedesktop.DBus.Introspectable": dict[Any, Any], |
| 36 | + }, |
| 37 | +) |
| 38 | +OrgBluesHci0Dict = TypedDict("OrgBluesHci0Dict", {"org.bluez.Adapter1": dict[str, Any]}) |
| 39 | + |
| 40 | +DBusOrgFreedesktopDBusObjectManagerManagedObjectsDict = TypedDict( |
| 41 | + "DBusOrgFreedesktopDBusObjectManagerManagedObjectsDict", {"/org/bluez": OrgBluezDict, "/org/bluez/hci0": OrgBluesHci0Dict} |
| 42 | +) |
| 43 | + |
| 44 | +class DBusOrgFreedesktopDBusObjectManager: |
| 45 | + x: int |
| 46 | + y: int |
| 47 | + |
| 48 | + @staticmethod |
| 49 | + def GetManagedObjects() -> dict[str, Any]: ... |
| 50 | + |
| 51 | +class Bluez: |
| 52 | + def __getitem__(self, key: Literal["org.freedesktop.DBus.ObjectManager"]) -> DBusOrgFreedesktopDBusObjectManager: ... |
| 53 | + |
| 54 | +class Notifications: |
| 55 | + Inhibited: bool |
| 56 | + |
| 57 | + def UnInhibit(self, key: int) -> int | None: ... |
| 58 | + def Inhibit(self, name: str, reason: str, unk1: Any) -> int | None: ... |
| 59 | + |
| 60 | +class Bus(ProxyMixin, RequestNameMixin, OwnMixin, WatchMixin, SubscriptionMixin, RegistrationMixin, PublicationMixin): |
| 61 | + Type: type[Gio.BusType] = ... |
| 62 | + autoclose: bool |
| 63 | + con: Gio.DBusConnection |
| 64 | + |
| 65 | + def __init__(self, gio_con: Gio.DBusConnection) -> None: ... |
| 66 | + def __enter__(self) -> Self: ... |
| 67 | + def __exit__( |
| 68 | + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: types.TracebackType | None |
| 69 | + ) -> None: ... |
| 70 | + @property |
| 71 | + def dbus(self) -> DBusOrgFreedesktopDBus: ... |
| 72 | + @property |
| 73 | + def polkit_authority(self) -> DBusOrgFreedesktopPolicyKit1Authority: ... |
| 74 | + @overload # type: ignore[override] |
| 75 | + def get( |
| 76 | + self, domain: Literal["org.freedesktop.Notifications"], path: Literal["/org/freedesktop/Notifications"] |
| 77 | + ) -> Notifications: ... |
| 78 | + @overload |
| 79 | + def get(self, domain: Literal["org.bluez"], path: Literal["/"]) -> Bluez: ... |
| 80 | + @overload |
| 81 | + def get(self, domain: str, path: str) -> Any: ... |
| 82 | + |
| 83 | +def SystemBus() -> Bus: ... |
| 84 | +def SessionBus() -> Bus: ... |
0 commit comments