mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-28 11:36:32 +00:00
Update gdbus.py
This commit is contained in:
parent
34d67a7bcd
commit
43e6ca8f4a
@ -18,11 +18,18 @@ class DbusError(Exception):
|
|||||||
class Dbus(object):
|
class Dbus(object):
|
||||||
"""Dbus handler."""
|
"""Dbus handler."""
|
||||||
|
|
||||||
def __init__(self, loop, bus_name, object_path):
|
def __init__(self, bus_name, object_path):
|
||||||
"""Initialize dbus object."""
|
"""Initialize dbus object."""
|
||||||
self.loop = loop
|
|
||||||
self.bus_name = bus_name
|
self.bus_name = bus_name
|
||||||
self.object_path = object_path
|
self.object_path = object_path
|
||||||
|
self.methods = []
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
async def connect(bus_name, object_path):
|
||||||
|
"""Read object data."""
|
||||||
|
|
||||||
|
async def _init_proxy(self):
|
||||||
|
"""Read object data."""
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _gvariant(raw):
|
def _gvariant(raw):
|
||||||
@ -44,8 +51,7 @@ class Dbus(object):
|
|||||||
*command,
|
*command,
|
||||||
stdin=asyncio.subprocess.DEVNULL,
|
stdin=asyncio.subprocess.DEVNULL,
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.PIPE,
|
||||||
stderr=asyncio.subprocess.DEVNULL,
|
stderr=asyncio.subprocess.DEVNULL
|
||||||
loop=self.loop
|
|
||||||
)
|
)
|
||||||
|
|
||||||
data, _ = await proc.communicate()
|
data, _ = await proc.communicate()
|
||||||
@ -63,6 +69,9 @@ class Dbus(object):
|
|||||||
|
|
||||||
def __getattr__(self, name):
|
def __getattr__(self, name):
|
||||||
"""Mapping to dbus method."""
|
"""Mapping to dbus method."""
|
||||||
|
if name not in self.methods:
|
||||||
|
raise AttributeError()
|
||||||
|
|
||||||
def _method_wrapper(*args):
|
def _method_wrapper(*args):
|
||||||
"""Wrap method.
|
"""Wrap method.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user