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