Update isort configuration and sorts imports in codebase (#1739)

* Add known first party to isort configuration

* Run isort on supervisor and tests folder
This commit is contained in:
Franck Nijhof 2020-05-21 13:30:54 +02:00 committed by GitHub
parent 5e5fd3a79b
commit 1d83c0c77a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 111 additions and 128 deletions

View File

@ -11,6 +11,7 @@ default_section = THIRDPARTY
forced_separate = tests forced_separate = tests
combine_as_imports = true combine_as_imports = true
use_parentheses = true use_parentheses = true
known_first_party = supervisor,tests
[flake8] [flake8]
max-line-length = 88 max-line-length = 88

View File

@ -1,5 +1,6 @@
"""Supervisor add-on build environment.""" """Supervisor add-on build environment."""
from __future__ import annotations from __future__ import annotations
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING, Dict from typing import TYPE_CHECKING, Dict

View File

@ -12,8 +12,8 @@ from ..const import (
FILE_HASSIO_ADDONS, FILE_HASSIO_ADDONS,
) )
from ..coresys import CoreSys, CoreSysAttributes from ..coresys import CoreSys, CoreSysAttributes
from ..utils.json import JsonConfig
from ..store.addon import AddonStore from ..store.addon import AddonStore
from ..utils.json import JsonConfig
from .addon import Addon from .addon import Addon
from .validate import SCHEMA_ADDONS_FILE from .validate import SCHEMA_ADDONS_FILE

View File

@ -13,17 +13,17 @@ from .cli import APICli
from .discovery import APIDiscovery from .discovery import APIDiscovery
from .dns import APICoreDNS from .dns import APICoreDNS
from .hardware import APIHardware from .hardware import APIHardware
from .os import APIOS
from .homeassistant import APIHomeAssistant from .homeassistant import APIHomeAssistant
from .host import APIHost from .host import APIHost
from .info import APIInfo from .info import APIInfo
from .ingress import APIIngress from .ingress import APIIngress
from .multicast import APIMulticast
from .os import APIOS
from .proxy import APIProxy from .proxy import APIProxy
from .security import SecurityMiddleware from .security import SecurityMiddleware
from .services import APIServices from .services import APIServices
from .snapshots import APISnapshots from .snapshots import APISnapshots
from .supervisor import APISupervisor from .supervisor import APISupervisor
from .multicast import APIMulticast
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -54,7 +54,6 @@ from ..const import (
ATTR_INSTALLED, ATTR_INSTALLED,
ATTR_IP_ADDRESS, ATTR_IP_ADDRESS,
ATTR_KERNEL_MODULES, ATTR_KERNEL_MODULES,
ATTR_VERSION_LATEST,
ATTR_LOGO, ATTR_LOGO,
ATTR_LONG_DESCRIPTION, ATTR_LONG_DESCRIPTION,
ATTR_MACHINE, ATTR_MACHINE,
@ -83,6 +82,7 @@ from ..const import (
ATTR_UDEV, ATTR_UDEV,
ATTR_URL, ATTR_URL,
ATTR_VERSION, ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_VIDEO, ATTR_VIDEO,
ATTR_WEBUI, ATTR_WEBUI,
BOOT_AUTO, BOOT_AUTO,

View File

@ -18,7 +18,6 @@ from ..const import (
ATTR_HOST, ATTR_HOST,
ATTR_INDEX, ATTR_INDEX,
ATTR_INPUT, ATTR_INPUT,
ATTR_VERSION_LATEST,
ATTR_MEMORY_LIMIT, ATTR_MEMORY_LIMIT,
ATTR_MEMORY_PERCENT, ATTR_MEMORY_PERCENT,
ATTR_MEMORY_USAGE, ATTR_MEMORY_USAGE,
@ -27,6 +26,7 @@ from ..const import (
ATTR_NETWORK_TX, ATTR_NETWORK_TX,
ATTR_OUTPUT, ATTR_OUTPUT,
ATTR_VERSION, ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_VOLUME, ATTR_VOLUME,
CONTENT_TYPE_BINARY, CONTENT_TYPE_BINARY,
) )

View File

@ -7,8 +7,6 @@ from aiohttp import web
import voluptuous as vol import voluptuous as vol
from ..const import ( from ..const import (
ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_BLK_READ, ATTR_BLK_READ,
ATTR_BLK_WRITE, ATTR_BLK_WRITE,
ATTR_CPU_PERCENT, ATTR_CPU_PERCENT,
@ -17,6 +15,8 @@ from ..const import (
ATTR_MEMORY_USAGE, ATTR_MEMORY_USAGE,
ATTR_NETWORK_RX, ATTR_NETWORK_RX,
ATTR_NETWORK_TX, ATTR_NETWORK_TX,
ATTR_VERSION,
ATTR_VERSION_LATEST,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from .utils import api_process, api_validate from .utils import api_process, api_validate

View File

@ -1,19 +1,18 @@
"""Init file for Supervisor network RESTful API.""" """Init file for Supervisor network RESTful API."""
import voluptuous as vol import voluptuous as vol
from .utils import api_process, api_validate
from ..const import ( from ..const import (
ATTR_ADDON, ATTR_ADDON,
ATTR_UUID,
ATTR_CONFIG, ATTR_CONFIG,
ATTR_DISCOVERY, ATTR_DISCOVERY,
ATTR_SERVICE, ATTR_SERVICE,
ATTR_UUID,
REQUEST_FROM, REQUEST_FROM,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import APIError, APIForbidden
from ..discovery.validate import valid_discovery_service from ..discovery.validate import valid_discovery_service
from ..exceptions import APIError, APIForbidden
from .utils import api_process, api_validate
SCHEMA_DISCOVERY = vol.Schema( SCHEMA_DISCOVERY = vol.Schema(
{ {

View File

@ -11,7 +11,6 @@ from ..const import (
ATTR_BLK_WRITE, ATTR_BLK_WRITE,
ATTR_CPU_PERCENT, ATTR_CPU_PERCENT,
ATTR_HOST, ATTR_HOST,
ATTR_VERSION_LATEST,
ATTR_LOCALS, ATTR_LOCALS,
ATTR_MEMORY_LIMIT, ATTR_MEMORY_LIMIT,
ATTR_MEMORY_PERCENT, ATTR_MEMORY_PERCENT,
@ -20,6 +19,7 @@ from ..const import (
ATTR_NETWORK_TX, ATTR_NETWORK_TX,
ATTR_SERVERS, ATTR_SERVERS,
ATTR_VERSION, ATTR_VERSION,
ATTR_VERSION_LATEST,
CONTENT_TYPE_BINARY, CONTENT_TYPE_BINARY,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes

View File

@ -5,16 +5,16 @@ from typing import Any, Dict
from aiohttp import web from aiohttp import web
from .utils import api_process
from ..const import ( from ..const import (
ATTR_SERIAL, ATTR_AUDIO,
ATTR_DISK, ATTR_DISK,
ATTR_GPIO, ATTR_GPIO,
ATTR_AUDIO,
ATTR_INPUT, ATTR_INPUT,
ATTR_OUTPUT, ATTR_OUTPUT,
ATTR_SERIAL,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from .utils import api_process
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -16,11 +16,11 @@ from multidict import CIMultiDict, istr
from ..addons.addon import Addon from ..addons.addon import Addon
from ..const import ( from ..const import (
ATTR_ADMIN, ATTR_ADMIN,
ATTR_ENABLE,
ATTR_ICON, ATTR_ICON,
ATTR_PANELS,
ATTR_SESSION, ATTR_SESSION,
ATTR_TITLE, ATTR_TITLE,
ATTR_PANELS,
ATTR_ENABLE,
COOKIE_INGRESS, COOKIE_INGRESS,
HEADER_TOKEN, HEADER_TOKEN,
HEADER_TOKEN_OLD, HEADER_TOKEN_OLD,

View File

@ -10,13 +10,13 @@ from ..const import (
ATTR_BLK_READ, ATTR_BLK_READ,
ATTR_BLK_WRITE, ATTR_BLK_WRITE,
ATTR_CPU_PERCENT, ATTR_CPU_PERCENT,
ATTR_VERSION_LATEST,
ATTR_MEMORY_LIMIT, ATTR_MEMORY_LIMIT,
ATTR_MEMORY_PERCENT, ATTR_MEMORY_PERCENT,
ATTR_MEMORY_USAGE, ATTR_MEMORY_USAGE,
ATTR_NETWORK_RX, ATTR_NETWORK_RX,
ATTR_NETWORK_TX, ATTR_NETWORK_TX,
ATTR_VERSION, ATTR_VERSION,
ATTR_VERSION_LATEST,
CONTENT_TYPE_BINARY, CONTENT_TYPE_BINARY,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes

View File

@ -6,12 +6,7 @@ from typing import Any, Awaitable, Dict
from aiohttp import web from aiohttp import web
import voluptuous as vol import voluptuous as vol
from ..const import ( from ..const import ATTR_BOARD, ATTR_BOOT, ATTR_VERSION, ATTR_VERSION_LATEST
ATTR_BOARD,
ATTR_BOOT,
ATTR_VERSION,
ATTR_VERSION_LATEST,
)
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from .utils import api_process, api_validate from .utils import api_process, api_validate

View File

@ -5,12 +5,12 @@ import logging
import aiohttp import aiohttp
from aiohttp import web from aiohttp import web
from aiohttp.web_exceptions import HTTPBadGateway, HTTPUnauthorized
from aiohttp.client_exceptions import ClientConnectorError from aiohttp.client_exceptions import ClientConnectorError
from aiohttp.hdrs import CONTENT_TYPE, AUTHORIZATION from aiohttp.hdrs import AUTHORIZATION, CONTENT_TYPE
from aiohttp.web_exceptions import HTTPBadGateway, HTTPUnauthorized
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import HomeAssistantAuthError, HomeAssistantAPIError, APIError from ..exceptions import APIError, HomeAssistantAPIError, HomeAssistantAuthError
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -5,7 +5,6 @@ import re
from aiohttp.web import middleware from aiohttp.web import middleware
from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized from aiohttp.web_exceptions import HTTPForbidden, HTTPUnauthorized
from .utils import excract_supervisor_token
from ..const import ( from ..const import (
REQUEST_FROM, REQUEST_FROM,
ROLE_ADMIN, ROLE_ADMIN,
@ -15,6 +14,7 @@ from ..const import (
ROLE_MANAGER, ROLE_MANAGER,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from .utils import excract_supervisor_token
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,16 +1,16 @@
"""Init file for Supervisor network RESTful API.""" """Init file for Supervisor network RESTful API."""
from .utils import api_process, api_validate
from ..const import ( from ..const import (
ATTR_AVAILABLE, ATTR_AVAILABLE,
ATTR_PROVIDERS, ATTR_PROVIDERS,
ATTR_SLUG,
ATTR_SERVICES, ATTR_SERVICES,
REQUEST_FROM, ATTR_SLUG,
PROVIDE_SERVICE, PROVIDE_SERVICE,
REQUEST_FROM,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import APIError, APIForbidden from ..exceptions import APIError, APIForbidden
from .utils import api_process, api_validate
class APIServices(CoreSysAttributes): class APIServices(CoreSysAttributes):

View File

@ -7,26 +7,26 @@ from tempfile import TemporaryDirectory
from aiohttp import web from aiohttp import web
import voluptuous as vol import voluptuous as vol
from .utils import api_process, api_validate
from ..snapshots.validate import ALL_FOLDERS
from ..const import ( from ..const import (
ATTR_NAME,
ATTR_SLUG,
ATTR_DATE,
ATTR_ADDONS, ATTR_ADDONS,
ATTR_REPOSITORIES, ATTR_DATE,
ATTR_HOMEASSISTANT,
ATTR_VERSION,
ATTR_SIZE,
ATTR_FOLDERS, ATTR_FOLDERS,
ATTR_TYPE, ATTR_HOMEASSISTANT,
ATTR_SNAPSHOTS, ATTR_NAME,
ATTR_PASSWORD, ATTR_PASSWORD,
ATTR_PROTECTED, ATTR_PROTECTED,
ATTR_REPOSITORIES,
ATTR_SIZE,
ATTR_SLUG,
ATTR_SNAPSHOTS,
ATTR_TYPE,
ATTR_VERSION,
CONTENT_TYPE_TAR, CONTENT_TYPE_TAR,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import APIError from ..exceptions import APIError
from ..snapshots.validate import ALL_FOLDERS
from .utils import api_process, api_validate
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -20,12 +20,11 @@ from ..const import (
ATTR_ICON, ATTR_ICON,
ATTR_INSTALLED, ATTR_INSTALLED,
ATTR_IP_ADDRESS, ATTR_IP_ADDRESS,
ATTR_VERSION_LATEST,
ATTR_LOGGING, ATTR_LOGGING,
ATTR_LOGO, ATTR_LOGO,
ATTR_MEMORY_LIMIT, ATTR_MEMORY_LIMIT,
ATTR_MEMORY_USAGE,
ATTR_MEMORY_PERCENT, ATTR_MEMORY_PERCENT,
ATTR_MEMORY_USAGE,
ATTR_NAME, ATTR_NAME,
ATTR_NETWORK_RX, ATTR_NETWORK_RX,
ATTR_NETWORK_TX, ATTR_NETWORK_TX,
@ -34,11 +33,12 @@ from ..const import (
ATTR_STATE, ATTR_STATE,
ATTR_TIMEZONE, ATTR_TIMEZONE,
ATTR_VERSION, ATTR_VERSION,
ATTR_VERSION_LATEST,
ATTR_WAIT_BOOT, ATTR_WAIT_BOOT,
CONTENT_TYPE_BINARY, CONTENT_TYPE_BINARY,
SUPERVISOR_VERSION, SUPERVISOR_VERSION,
UpdateChannels,
LogLevel, LogLevel,
UpdateChannels,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import APIError from ..exceptions import APIError

View File

@ -1,5 +1,6 @@
"""Handle core shared data.""" """Handle core shared data."""
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
from typing import TYPE_CHECKING, Optional from typing import TYPE_CHECKING, Optional

View File

@ -1,12 +1,12 @@
"""D-Bus interface objects.""" """D-Bus interface objects."""
import logging import logging
from .systemd import Systemd from ..coresys import CoreSys, CoreSysAttributes
from .hostname import Hostname
from .rauc import Rauc
from .nmi_dns import NMIDnsManager
from ..coresys import CoreSysAttributes, CoreSys
from ..exceptions import DBusNotConnectedError from ..exceptions import DBusNotConnectedError
from .hostname import Hostname
from .nmi_dns import NMIDnsManager
from .rauc import Rauc
from .systemd import Systemd
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -2,10 +2,10 @@
import logging import logging
from typing import Optional from typing import Optional
from .interface import DBusInterface
from .utils import dbus_connected
from ..exceptions import DBusError, DBusInterfaceError from ..exceptions import DBusError, DBusInterfaceError
from ..utils.gdbus import DBus from ..utils.gdbus import DBus
from .interface import DBusInterface
from .utils import dbus_connected
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,13 +1,13 @@
"""D-Bus interface for hostname.""" """D-Bus interface for hostname."""
import logging import logging
from typing import Optional, List from typing import List, Optional
import attr import attr
from .interface import DBusInterface
from .utils import dbus_connected
from ..exceptions import DBusError, DBusInterfaceError from ..exceptions import DBusError, DBusInterfaceError
from ..utils.gdbus import DBus from ..utils.gdbus import DBus
from .interface import DBusInterface
from .utils import dbus_connected
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,12 +1,12 @@
"""D-Bus interface for rauc.""" """D-Bus interface for rauc."""
from enum import Enum
import logging import logging
from typing import Optional from typing import Optional
from enum import Enum
from .interface import DBusInterface
from .utils import dbus_connected
from ..exceptions import DBusError, DBusInterfaceError from ..exceptions import DBusError, DBusInterfaceError
from ..utils.gdbus import DBus from ..utils.gdbus import DBus
from .interface import DBusInterface
from .utils import dbus_connected
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,10 +1,10 @@
"""Interface to Systemd over D-Bus.""" """Interface to Systemd over D-Bus."""
import logging import logging
from .interface import DBusInterface
from .utils import dbus_connected
from ..exceptions import DBusError, DBusInterfaceError from ..exceptions import DBusError, DBusInterfaceError
from ..utils.gdbus import DBus from ..utils.gdbus import DBus
from .interface import DBusInterface
from .utils import dbus_connected
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -3,8 +3,8 @@ from __future__ import annotations
from contextlib import suppress from contextlib import suppress
import logging import logging
from typing import Any, Dict, List, Optional, TYPE_CHECKING from typing import TYPE_CHECKING, Any, Dict, List, Optional
from uuid import uuid4, UUID from uuid import UUID, uuid4
import attr import attr
import voluptuous as vol import voluptuous as vol

View File

@ -5,7 +5,6 @@ from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema( SCHEMA = vol.Schema(
{vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port} {vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port}
) )

View File

@ -5,7 +5,6 @@ from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema( SCHEMA = vol.Schema(
{vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port} {vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port}
) )

View File

@ -3,8 +3,7 @@ import voluptuous as vol
from supervisor.validate import network_port from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT, ATTR_API_KEY, ATTR_SERIAL from ..const import ATTR_API_KEY, ATTR_HOST, ATTR_PORT, ATTR_SERIAL
SCHEMA = vol.Schema( SCHEMA = vol.Schema(
{ {

View File

@ -5,7 +5,6 @@ from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema( SCHEMA = vol.Schema(
{ {
vol.Coerce(str): vol.Schema( vol.Coerce(str): vol.Schema(

View File

@ -3,12 +3,7 @@ import voluptuous as vol
from supervisor.validate import network_port from supervisor.validate import network_port
from ..const import ( from ..const import ATTR_HOST, ATTR_PASSWORD, ATTR_PORT, ATTR_USERNAME
ATTR_HOST,
ATTR_PASSWORD,
ATTR_PORT,
ATTR_USERNAME,
)
# pylint: disable=no-value-for-parameter # pylint: disable=no-value-for-parameter
SCHEMA = vol.Schema( SCHEMA = vol.Schema(

View File

@ -5,7 +5,6 @@ from supervisor.validate import network_port
from ..const import ATTR_HOST, ATTR_PORT from ..const import ATTR_HOST, ATTR_PORT
SCHEMA = vol.Schema( SCHEMA = vol.Schema(
{vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port} {vol.Required(ATTR_HOST): vol.Coerce(str), vol.Required(ATTR_PORT): network_port}
) )

View File

@ -1,6 +1,6 @@
"""Validate services schema.""" """Validate services schema."""
from pathlib import Path
from importlib import import_module from importlib import import_module
from pathlib import Path
import voluptuous as vol import voluptuous as vol

View File

@ -8,7 +8,7 @@ import attr
import docker import docker
from packaging import version as pkg_version from packaging import version as pkg_version
from ..const import SOCKET_DOCKER, DNS_SUFFIX from ..const import DNS_SUFFIX, SOCKET_DOCKER
from ..exceptions import DockerAPIError from ..exceptions import DockerAPIError
from .network import DockerNetwork from .network import DockerNetwork

View File

@ -2,10 +2,10 @@
from contextlib import suppress from contextlib import suppress
import logging import logging
from ..const import ENV_TIME, ENV_TOKEN
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import DockerAPIError from ..exceptions import DockerAPIError
from .interface import DockerInterface from .interface import DockerInterface
from ..const import ENV_TIME, ENV_TOKEN
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -8,13 +8,9 @@ import aiohttp
from cpe import CPE from cpe import CPE
from .const import URL_HASSOS_OTA from .const import URL_HASSOS_OTA
from .coresys import CoreSysAttributes, CoreSys from .coresys import CoreSys, CoreSysAttributes
from .exceptions import (
DBusError,
HassOSNotSupportedError,
HassOSUpdateError,
)
from .dbus.rauc import RaucState from .dbus.rauc import RaucState
from .exceptions import DBusError, HassOSNotSupportedError, HassOSUpdateError
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,7 +1,7 @@
"""AppArmor control for host.""" """AppArmor control for host."""
import logging import logging
import shutil
from pathlib import Path from pathlib import Path
import shutil
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import DBusError, HostAppArmorError from ..exceptions import DBusError, HostAppArmorError

View File

@ -5,10 +5,10 @@ from typing import Optional
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import ( from ..exceptions import (
HostNotSupportedError,
HostError,
DBusNotConnectedError,
DBusError, DBusError,
DBusNotConnectedError,
HostError,
HostNotSupportedError,
) )
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -2,8 +2,8 @@
import logging import logging
from typing import List from typing import List
from ..coresys import CoreSysAttributes, CoreSys from ..coresys import CoreSys, CoreSysAttributes
from ..exceptions import HostNotSupportedError, DBusNotConnectedError, DBusError from ..exceptions import DBusError, DBusNotConnectedError, HostNotSupportedError
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -6,7 +6,7 @@ from typing import Optional
import pyudev import pyudev
from .coresys import CoreSysAttributes, CoreSys from .coresys import CoreSys, CoreSysAttributes
from .utils import AsyncCallFilter from .utils import AsyncCallFilter
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,8 +1,8 @@
"""Setup the internal DNS service for host applications.""" """Setup the internal DNS service for host applications."""
import asyncio import asyncio
from ipaddress import IPv4Address
import logging import logging
import shlex import shlex
from ipaddress import IPv4Address
from typing import Optional from typing import Optional
import async_timeout import async_timeout

View File

@ -5,7 +5,6 @@ import voluptuous as vol
from ..const import ATTR_ACCESS_TOKEN, ATTR_IMAGE, ATTR_SERVERS, ATTR_VERSION from ..const import ATTR_ACCESS_TOKEN, ATTR_IMAGE, ATTR_SERVERS, ATTR_VERSION
from ..validate import dns_server_list, docker_image, token from ..validate import dns_server_list, docker_image, token
SCHEMA_DNS_CONFIG = vol.Schema( SCHEMA_DNS_CONFIG = vol.Schema(
{ {
vol.Optional(ATTR_VERSION): vol.Maybe(vol.Coerce(str)), vol.Optional(ATTR_VERSION): vol.Maybe(vol.Coerce(str)),

View File

@ -2,10 +2,11 @@
import logging import logging
from typing import Any, Dict, List from typing import Any, Dict, List
import voluptuous as vol
from supervisor.addons.addon import Addon from supervisor.addons.addon import Addon
from supervisor.exceptions import ServicesError from supervisor.exceptions import ServicesError
from supervisor.validate import network_port from supervisor.validate import network_port
import voluptuous as vol
from ..const import ( from ..const import (
ATTR_ADDON, ATTR_ADDON,

View File

@ -2,10 +2,11 @@
import logging import logging
from typing import Any, Dict, List from typing import Any, Dict, List
import voluptuous as vol
from supervisor.addons.addon import Addon from supervisor.addons.addon import Addon
from supervisor.exceptions import ServicesError from supervisor.exceptions import ServicesError
from supervisor.validate import network_port from supervisor.validate import network_port
import voluptuous as vol
from ..const import ( from ..const import (
ATTR_ADDON, ATTR_ADDON,

View File

@ -6,7 +6,6 @@ from .const import SERVICE_MQTT, SERVICE_MYSQL
from .modules.mqtt import SCHEMA_CONFIG_MQTT from .modules.mqtt import SCHEMA_CONFIG_MQTT
from .modules.mysql import SCHEMA_CONFIG_MYSQL from .modules.mysql import SCHEMA_CONFIG_MYSQL
SCHEMA_SERVICES_CONFIG = vol.Schema( SCHEMA_SERVICES_CONFIG = vol.Schema(
{ {
vol.Optional(SERVICE_MQTT, default=dict): schema_or(SCHEMA_CONFIG_MQTT), vol.Optional(SERVICE_MQTT, default=dict): schema_or(SCHEMA_CONFIG_MQTT),

View File

@ -3,11 +3,11 @@ import asyncio
import logging import logging
from pathlib import Path from pathlib import Path
from .snapshot import Snapshot
from .utils import create_slug
from ..const import FOLDER_HOMEASSISTANT, SNAPSHOT_FULL, SNAPSHOT_PARTIAL from ..const import FOLDER_HOMEASSISTANT, SNAPSHOT_FULL, SNAPSHOT_PARTIAL
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..utils.dt import utcnow from ..utils.dt import utcnow
from .snapshot import Snapshot
from .utils import create_slug
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,7 +1,7 @@
"""Util add-on functions.""" """Util add-on functions."""
import hashlib import hashlib
import shutil
import re import re
import shutil
RE_DIGITS = re.compile(r"\d+") RE_DIGITS = re.compile(r"\d+")

View File

@ -1,8 +1,8 @@
"""Init file for Supervisor add-ons.""" """Init file for Supervisor add-ons."""
import logging import logging
from ..coresys import CoreSys
from ..addons.model import AddonModel, Data from ..addons.model import AddonModel, Data
from ..coresys import CoreSys
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,16 +1,16 @@
"""Init file for Supervisor add-on Git.""" """Init file for Supervisor add-on Git."""
import asyncio import asyncio
import logging
import functools as ft import functools as ft
import logging
from pathlib import Path from pathlib import Path
import shutil import shutil
import git import git
from .utils import get_hash_from_repository from ..const import ATTR_BRANCH, ATTR_URL, URL_HASSIO_ADDONS
from ..const import URL_HASSIO_ADDONS, ATTR_URL, ATTR_BRANCH
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..validate import RE_REPOSITORY from ..validate import RE_REPOSITORY
from .utils import get_hash_from_repository
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,15 +1,15 @@
"""Represent a Supervisor repository.""" """Represent a Supervisor repository."""
from .git import GitRepoHassIO, GitRepoCustom
from .utils import get_hash_from_repository
from ..const import ( from ..const import (
REPOSITORY_CORE, ATTR_MAINTAINER,
REPOSITORY_LOCAL,
ATTR_NAME, ATTR_NAME,
ATTR_URL, ATTR_URL,
ATTR_MAINTAINER, REPOSITORY_CORE,
REPOSITORY_LOCAL,
) )
from ..coresys import CoreSysAttributes from ..coresys import CoreSysAttributes
from ..exceptions import APIError from ..exceptions import APIError
from .git import GitRepoCustom, GitRepoHassIO
from .utils import get_hash_from_repository
UNKNOWN = "unknown" UNKNOWN = "unknown"

View File

@ -2,8 +2,7 @@
import voluptuous as vol import voluptuous as vol
from ..const import ATTR_NAME, ATTR_URL, ATTR_MAINTAINER from ..const import ATTR_MAINTAINER, ATTR_NAME, ATTR_URL
# pylint: disable=no-value-for-parameter # pylint: disable=no-value-for-parameter
SCHEMA_REPOSITORY_CONFIG = vol.Schema( SCHEMA_REPOSITORY_CONFIG = vol.Schema(

View File

@ -9,7 +9,7 @@ from typing import Awaitable, Optional
import aiohttp import aiohttp
from .const import URL_HASSIO_APPARMOR, SUPERVISOR_VERSION from .const import SUPERVISOR_VERSION, URL_HASSIO_APPARMOR
from .coresys import CoreSys, CoreSysAttributes from .coresys import CoreSys, CoreSysAttributes
from .docker.stats import DockerStats from .docker.stats import DockerStats
from .docker.supervisor import DockerSupervisor from .docker.supervisor import DockerSupervisor

View File

@ -2,19 +2,19 @@
from __future__ import annotations from __future__ import annotations
import asyncio import asyncio
import logging
import json import json
import shlex import logging
import re import re
import shlex
from signal import SIGINT from signal import SIGINT
from typing import Any, Dict, List, Optional, Set from typing import Any, Dict, List, Optional, Set
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
from ..exceptions import ( from ..exceptions import (
DBusFatalError, DBusFatalError,
DBusParseError,
DBusInterfaceError, DBusInterfaceError,
DBusNotConnectedError, DBusNotConnectedError,
DBusParseError,
) )
_LOGGER: logging.Logger = logging.getLogger(__name__) _LOGGER: logging.Logger = logging.getLogger(__name__)

View File

@ -1,7 +1,7 @@
"""Validate Add-on configs.""" """Validate Add-on configs."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.addons import validate as vd from supervisor.addons import validate as vd

View File

@ -1,5 +1,5 @@
"""Common test functions.""" """Common test functions."""
from unittest.mock import patch, PropertyMock, MagicMock from unittest.mock import MagicMock, PropertyMock, patch
import pytest import pytest

View File

@ -1,7 +1,7 @@
"""Test adguard discovery.""" """Test adguard discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test adguard discovery.""" """Test adguard discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test DeConz discovery.""" """Test DeConz discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test HomeMatic discovery.""" """Test HomeMatic discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test MQTT discovery.""" """Test MQTT discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test Zwave MQTT discovery.""" """Test Zwave MQTT discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test unifi discovery.""" """Test unifi discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery.validate import valid_discovery_config from supervisor.discovery.validate import valid_discovery_config

View File

@ -1,7 +1,7 @@
"""Test validate of discovery.""" """Test validate of discovery."""
import voluptuous as vol
import pytest import pytest
import voluptuous as vol
from supervisor.discovery import validate from supervisor.discovery import validate

View File

@ -1,8 +1,8 @@
"""Test hardware utils.""" """Test hardware utils."""
from unittest.mock import patch, PropertyMock
from pathlib import Path from pathlib import Path
from unittest.mock import PropertyMock, patch
from supervisor.misc.hardware import Hardware, Device from supervisor.misc.hardware import Device, Hardware
def test_read_all_devices(): def test_read_all_devices():

View File

@ -1,8 +1,9 @@
"""Test validators.""" """Test validators."""
import supervisor.validate
import voluptuous.error
import pytest import pytest
import voluptuous.error
import supervisor.validate
GOOD_V4 = [ GOOD_V4 = [
"dns://10.0.0.1", # random local "dns://10.0.0.1", # random local

View File

@ -2,7 +2,7 @@
import attr import attr
from supervisor.utils.tar import secure_path, exclude_filter from supervisor.utils.tar import exclude_filter, secure_path
@attr.s @attr.s