mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-10 18:56:30 +00:00
code cleanups
This commit is contained in:
parent
808fc0f8b6
commit
8f357739ec
@ -17,7 +17,7 @@ from .snapshots import SnapshotManager
|
|||||||
from .tasks import Tasks
|
from .tasks import Tasks
|
||||||
from .updater import Updater
|
from .updater import Updater
|
||||||
from .services import ServiceManager
|
from .services import ServiceManager
|
||||||
from .services.discovery import Discovery
|
from .services import Discovery
|
||||||
from .host import AlsaAudio
|
from .host import AlsaAudio
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -11,7 +11,7 @@ from .misc.scheduler import Scheduler
|
|||||||
from .misc.systemd import Systemd
|
from .misc.systemd import Systemd
|
||||||
|
|
||||||
|
|
||||||
class CoreSys(object):
|
class CoreSys:
|
||||||
"""Class that handle all shared data."""
|
"""Class that handle all shared data."""
|
||||||
|
|
||||||
def __init__(self, loop):
|
def __init__(self, loop):
|
||||||
@ -238,7 +238,7 @@ class CoreSys(object):
|
|||||||
return self._loop.create_task(coroutine)
|
return self._loop.create_task(coroutine)
|
||||||
|
|
||||||
|
|
||||||
class CoreSysAttributes(object):
|
class CoreSysAttributes:
|
||||||
"""Inheret basic CoreSysAttributes."""
|
"""Inheret basic CoreSysAttributes."""
|
||||||
|
|
||||||
coresys = None
|
coresys = None
|
||||||
|
@ -14,7 +14,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
CommandReturn = attr.make_class('CommandReturn', ['exit_code', 'output'])
|
CommandReturn = attr.make_class('CommandReturn', ['exit_code', 'output'])
|
||||||
|
|
||||||
|
|
||||||
class DockerAPI(object):
|
class DockerAPI:
|
||||||
"""Docker hassio wrapper.
|
"""Docker hassio wrapper.
|
||||||
|
|
||||||
This class is not AsyncIO safe!
|
This class is not AsyncIO safe!
|
||||||
|
@ -8,7 +8,7 @@ from ..const import DOCKER_NETWORK_MASK, DOCKER_NETWORK, DOCKER_NETWORK_RANGE
|
|||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class DockerNetwork(object):
|
class DockerNetwork:
|
||||||
"""Internal HassIO Network.
|
"""Internal HassIO Network.
|
||||||
|
|
||||||
This class is not AsyncIO safe!
|
This class is not AsyncIO safe!
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
|
|
||||||
|
|
||||||
class DockerStats(object):
|
class DockerStats:
|
||||||
"""Hold stats data from container inside."""
|
"""Hold stats data from container inside."""
|
||||||
|
|
||||||
def __init__(self, stats):
|
def __init__(self, stats):
|
||||||
|
@ -1,2 +1,6 @@
|
|||||||
"""Host function like audio/dbus/systemd."""
|
"""Host function like audio/dbus/systemd."""
|
||||||
|
|
||||||
from .alsa import AlsaAudio # noqa
|
from .alsa import AlsaAudio # noqa
|
||||||
|
|
||||||
|
|
||||||
|
class HostManager:
|
||||||
|
@ -8,7 +8,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
COMMAND = "socat UDP-RECVFROM:53,fork UDP-SENDTO:127.0.0.11:53"
|
COMMAND = "socat UDP-RECVFROM:53,fork UDP-SENDTO:127.0.0.11:53"
|
||||||
|
|
||||||
|
|
||||||
class DNSForward(object):
|
class DNSForward:
|
||||||
"""Manage DNS forwarding to internal DNS."""
|
"""Manage DNS forwarding to internal DNS."""
|
||||||
|
|
||||||
def __init__(self, loop):
|
def __init__(self, loop):
|
||||||
|
@ -23,7 +23,7 @@ GPIO_DEVICES = Path("/sys/class/gpio")
|
|||||||
RE_TTY = re.compile(r"tty[A-Z]+")
|
RE_TTY = re.compile(r"tty[A-Z]+")
|
||||||
|
|
||||||
|
|
||||||
class Hardware(object):
|
class Hardware:
|
||||||
"""Represent a interface to procfs, sysfs and udev."""
|
"""Represent a interface to procfs, sysfs and udev."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -10,7 +10,7 @@ CALL = 'callback'
|
|||||||
TASK = 'task'
|
TASK = 'task'
|
||||||
|
|
||||||
|
|
||||||
class Scheduler(object):
|
class Scheduler:
|
||||||
"""Schedule task inside HassIO."""
|
"""Schedule task inside HassIO."""
|
||||||
|
|
||||||
def __init__(self, loop):
|
def __init__(self, loop):
|
||||||
|
@ -10,7 +10,7 @@ DBUS_NAME = 'org.freedesktop.systemd1'
|
|||||||
DBUS_OBJECT = '/org/freedesktop/systemd1'
|
DBUS_OBJECT = '/org/freedesktop/systemd1'
|
||||||
|
|
||||||
|
|
||||||
class Systemd(object):
|
class Systemd:
|
||||||
"""Systemd function handler."""
|
"""Systemd function handler."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Handle internal services discovery."""
|
"""Handle internal services discovery."""
|
||||||
|
|
||||||
|
from .discovery import Discovery # noqa
|
||||||
from .mqtt import MQTTService
|
from .mqtt import MQTTService
|
||||||
from .data import ServicesData
|
from .data import ServicesData
|
||||||
from ..const import SERVICE_MQTT
|
from ..const import SERVICE_MQTT
|
||||||
|
@ -84,7 +84,7 @@ class Discovery(CoreSysAttributes):
|
|||||||
EVENT_DISCOVERY_DEL, {ATTR_UUID: message.uuid}))
|
EVENT_DISCOVERY_DEL, {ATTR_UUID: message.uuid}))
|
||||||
|
|
||||||
|
|
||||||
class Message(object):
|
class Message:
|
||||||
"""Represent a single Discovery message."""
|
"""Represent a single Discovery message."""
|
||||||
|
|
||||||
def __init__(self, provider, component, platform, config, uuid=None):
|
def __init__(self, provider, component, platform, config, uuid=None):
|
||||||
|
@ -27,7 +27,7 @@ def process_lock(method):
|
|||||||
return wrap_api
|
return wrap_api
|
||||||
|
|
||||||
|
|
||||||
class AsyncThrottle(object):
|
class AsyncThrottle:
|
||||||
"""
|
"""
|
||||||
Decorator that prevents a function from being called more than once every
|
Decorator that prevents a function from being called more than once every
|
||||||
time period.
|
time period.
|
||||||
|
@ -14,7 +14,7 @@ CALL = ("gdbus call --system --dest {bus} --object-path {inf} "
|
|||||||
"--method {inf}.{method} {args}")
|
"--method {inf}.{method} {args}")
|
||||||
|
|
||||||
|
|
||||||
class DBus(object):
|
class DBus:
|
||||||
"""DBus handler."""
|
"""DBus handler."""
|
||||||
|
|
||||||
def __init__(self, bus_name, object_path):
|
def __init__(self, bus_name, object_path):
|
||||||
@ -109,7 +109,7 @@ class DBus(object):
|
|||||||
return DBusCallWrapper(self, interface)
|
return DBusCallWrapper(self, interface)
|
||||||
|
|
||||||
|
|
||||||
class DBusCallWrapper(object):
|
class DBusCallWrapper:
|
||||||
"""Wrapper a DBus interface for a call."""
|
"""Wrapper a DBus interface for a call."""
|
||||||
|
|
||||||
def __init__(self, dbus, interface):
|
def __init__(self, dbus, interface):
|
||||||
|
@ -21,7 +21,7 @@ def read_json_file(jsonfile):
|
|||||||
return json.loads(cfile.read())
|
return json.loads(cfile.read())
|
||||||
|
|
||||||
|
|
||||||
class JsonConfig(object):
|
class JsonConfig:
|
||||||
"""Hass core object for handle it."""
|
"""Hass core object for handle it."""
|
||||||
|
|
||||||
def __init__(self, json_file, schema):
|
def __init__(self, json_file, schema):
|
||||||
|
@ -12,7 +12,7 @@ MOD_READ = 'r'
|
|||||||
MOD_WRITE = 'w'
|
MOD_WRITE = 'w'
|
||||||
|
|
||||||
|
|
||||||
class SecureTarFile(object):
|
class SecureTarFile:
|
||||||
"""Handle encrypted files for tarfile library."""
|
"""Handle encrypted files for tarfile library."""
|
||||||
|
|
||||||
def __init__(self, name, mode, key=None, gzip=True):
|
def __init__(self, name, mode, key=None, gzip=True):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user