Skip to content

Commit

Permalink
🎨 format from Home Assistant standard (#376)
Browse files Browse the repository at this point in the history
Signed-off-by: Ludy87 <Ludy87@users.noreply.github.com>
  • Loading branch information
Ludy87 authored Feb 6, 2024
1 parent c824b36 commit 611c919
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 68 deletions.
4 changes: 1 addition & 3 deletions custom_components/xplora_watch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ENTITY_ID, CONF_NAME, Platform
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import aiohttp_client, discovery
from homeassistant.helpers import config_validation as cv
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers import aiohttp_client, config_validation as cv, discovery, entity_registry as er
from homeassistant.helpers.typing import ConfigType

from .const import DATA_HASS_CONFIG, DOMAIN
Expand Down
6 changes: 1 addition & 5 deletions custom_components/xplora_watch/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
import logging
from typing import Any

from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
BinarySensorEntityDescription,
)
from homeassistant.components.binary_sensor import BinarySensorDeviceClass, BinarySensorEntity, BinarySensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_ID,
Expand Down
12 changes: 4 additions & 8 deletions custom_components/xplora_watch/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,18 @@

from __future__ import annotations

import logging
from collections import OrderedDict
import logging
from types import MappingProxyType
from typing import Any

import voluptuous as vol
from pyxplora_api.exception_classes import Error, LoginError, PhoneOrEmailFail
from pyxplora_api.pyxplora_api_async import PyXploraApi
from pyxplora_api.status import UserContactType
import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant import config_entries, core
from homeassistant.config_entries import (
ConfigEntry,
OptionsFlow,
OptionsFlowWithConfigEntry,
)
from homeassistant.config_entries import ConfigEntry, OptionsFlow, OptionsFlowWithConfigEntry
from homeassistant.const import (
ATTR_LATITUDE,
ATTR_LONGITUDE,
Expand All @@ -33,6 +28,7 @@
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import aiohttp_client
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.selector import (
BooleanSelector,
NumberSelector,
Expand Down
9 changes: 1 addition & 8 deletions custom_components/xplora_watch/const_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@
TextSelectorType,
)

from .const import (
CONF_PHONENUMBER,
CONF_TIMEZONE,
CONF_USERLANG,
DEFAULT_LANGUAGE,
SUPPORTED_LANGUAGES,
XPLORA_USER_LANGS,
)
from .const import CONF_PHONENUMBER, CONF_TIMEZONE, CONF_USERLANG, DEFAULT_LANGUAGE, SUPPORTED_LANGUAGES, XPLORA_USER_LANGS

DEFAULT_DATA_SCHEMA = {
vol.Required(CONF_PASSWORD): TextSelector(TextSelectorConfig(type=TextSelectorType.PASSWORD)),
Expand Down
15 changes: 3 additions & 12 deletions custom_components/xplora_watch/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import annotations

import logging
from datetime import datetime, timedelta
import logging
from typing import Any

import aiohttp
Expand All @@ -12,18 +12,9 @@
from pyxplora_api.pyxplora_api_async import PyXploraApi
from pyxplora_api.status import LocationType, WatchOnlineStatus

from homeassistant.components.device_tracker.const import (
ATTR_BATTERY,
ATTR_LOCATION_NAME,
)
from homeassistant.components.device_tracker.const import ATTR_BATTERY, ATTR_LOCATION_NAME
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
CONF_COUNTRY_CODE,
CONF_EMAIL,
CONF_LANGUAGE,
CONF_PASSWORD,
CONF_SCAN_INTERVAL,
)
from homeassistant.const import CONF_COUNTRY_CODE, CONF_EMAIL, CONF_LANGUAGE, CONF_PASSWORD, CONF_SCAN_INTERVAL
from homeassistant.core import HomeAssistant
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
Expand Down
5 changes: 1 addition & 4 deletions custom_components/xplora_watch/device_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@

from homeassistant.components.device_tracker import SourceType
from homeassistant.components.device_tracker.config_entry import TrackerEntity
from homeassistant.components.device_tracker.const import (
ATTR_BATTERY,
ATTR_LOCATION_NAME,
)
from homeassistant.components.device_tracker.const import ATTR_BATTERY, ATTR_LOCATION_NAME
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ID, CONF_NAME
from homeassistant.core import HomeAssistant
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xplora_watch/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from __future__ import annotations

import logging
from collections.abc import Callable
import logging

from homeassistant.config_entries import ConfigEntry
from homeassistant.core import callback
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xplora_watch/geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
https://raw.githubusercontent.com/OpenCageData/python-opencage-geocoder/master/LICENSE.txt
"""

from __future__ import annotations
from __future__ import annotations # noqa: I001

import collections
import os
Expand Down
2 changes: 1 addition & 1 deletion custom_components/xplora_watch/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"pydub",
"marshmallow-enum"
],
"version": "v2.13.6"
"version": "v2.13.7"
}
14 changes: 2 additions & 12 deletions custom_components/xplora_watch/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,9 @@
import logging
from typing import Any

from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
)
from homeassistant.components.sensor import SensorDeviceClass, SensorEntity, SensorEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import (
ATTR_ID,
CONF_NAME,
PERCENTAGE,
EntityCategory,
UnitOfLength,
)
from homeassistant.const import ATTR_ID, CONF_NAME, PERCENTAGE, EntityCategory, UnitOfLength
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
Expand Down
4 changes: 2 additions & 2 deletions custom_components/xplora_watch/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import logging
from typing import Any

import voluptuous as vol
from pyxplora_api.exception_classes import NoAdminError
import voluptuous as vol

import homeassistant.helpers.config_validation as cv
from homeassistant.core import HomeAssistant, ServiceCall, callback
import homeassistant.helpers.config_validation as cv

from .const import (
ATTR_SERVICE_DELETE_MSG,
Expand Down
14 changes: 4 additions & 10 deletions custom_components/xplora_watch/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@

from pyxplora_api.pyxplora_api_async import PyXploraApi

from homeassistant.components.switch import (
SwitchDeviceClass,
SwitchEntity,
SwitchEntityDescription,
)
from homeassistant.components.switch import SwitchDeviceClass, SwitchEntity, SwitchEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_ID, CONF_LANGUAGE, CONF_NAME
from homeassistant.core import HomeAssistant, callback
Expand Down Expand Up @@ -205,11 +201,9 @@ def __init__(

self._silent = silent

self._attr_name: str = (
f'{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {silent["start"]}-{silent["end"]} ({coordinator.username})'.replace( # noqa: E501
"_", " "
).title()
)
self._attr_name: str = f'{ward.get(CONF_NAME)} {ATTR_WATCH} {description.key} {silent["start"]}-{silent["end"]} ({coordinator.username})'.replace( # noqa: E501
"_", " "
).title()

self._attr_unique_id = (
f'{ward.get(CONF_NAME)}_{ATTR_WATCH}_{description.key}_{silent["vendorId"]}_{wuid}_{coordinator.user_id}'.replace(
Expand Down
2 changes: 1 addition & 1 deletion scripts/update/hacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import json
import os
import sys
from pathlib import Path
import sys

HACS_FILE = Path(f"{os.getcwd()}/hacs.json")

Expand Down

0 comments on commit 611c919

Please sign in to comment.