mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-09 18:26:30 +00:00
Update gdbus.py
This commit is contained in:
parent
6f770b78af
commit
7363951a9a
@ -2,12 +2,18 @@
|
||||
import asyncio
|
||||
import logging
|
||||
import shlex
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from ..exceptions import DBusFatalError, DBusParseError
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
RE_GVARIANT_TULPE = re.compile(r"^\((.*),\)$")
|
||||
RE_GVARIANT_VARIANT = re.compile(
|
||||
r"(?<=(?: |{|\[))<((?:'|\").*?(?:'|\")|\d+(?:\.\d+)?)>(?=(?:|]|}|,))")
|
||||
RE_GVARIANT_STRING = re.compile(r"(?<=(?: |{|\[))'(.*?)'(?=(?:|]|}|,))")
|
||||
|
||||
INTROSPECT = ("gdbus introspect --system --dest {bus} "
|
||||
"--object-path {obj} --xml")
|
||||
CALL = ("gdbus call --system --dest {bus} --object-path {inf} "
|
||||
@ -60,6 +66,7 @@ class DBus:
|
||||
@staticmethod
|
||||
def _gvariant(raw):
|
||||
"""Parse GVariant input to python."""
|
||||
raw = RE_GVARIANT_TULPE.sub(r"[\1]", raw)
|
||||
return raw
|
||||
|
||||
async def call_dbus(self, interface, method, *args):
|
||||
|
Loading…
x
Reference in New Issue
Block a user