Skip to content

Commit

Permalink
📁 ruff
Browse files Browse the repository at this point in the history
> Made via .github/workflows/a_pre_commit.yml
  • Loading branch information
GitHub Action [email protected] authored and GitHub Action [email protected] committed Feb 5, 2024
1 parent 002b468 commit 257b67d
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 80 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
19 changes: 7 additions & 12 deletions custom_components/xplora_watch/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@

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 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 +23,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 All @@ -46,6 +37,10 @@
TextSelectorConfig,
TextSelectorType,
)
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

from .const import (
CONF_HOME_LATITUDE,
Expand Down
12 changes: 2 additions & 10 deletions custom_components/xplora_watch/const_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

from __future__ import annotations

import voluptuous as vol

from homeassistant.const import CONF_COUNTRY_CODE, CONF_EMAIL, CONF_LANGUAGE, CONF_PASSWORD
from homeassistant.helpers.selector import (
SelectOptionDict,
Expand All @@ -14,15 +12,9 @@
TextSelectorConfig,
TextSelectorType,
)
import voluptuous as vol

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
24 changes: 7 additions & 17 deletions custom_components/xplora_watch/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,21 @@

from __future__ import annotations

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

import aiohttp
from pyxplora_api.const import DEFAULT_TIMEOUT
from pyxplora_api.model import ChatsNew
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
from pyxplora_api.const import DEFAULT_TIMEOUT
from pyxplora_api.model import ChatsNew
from pyxplora_api.pyxplora_api_async import PyXploraApi
from pyxplora_api.status import LocationType, WatchOnlineStatus

from .const import (
API_KEY_MAPBOX,
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
4 changes: 2 additions & 2 deletions custom_components/xplora_watch/geocoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from __future__ import annotations

import collections
import os
import sys
from datetime import datetime
from decimal import Decimal
import os
import sys

import backoff
import requests
Expand Down
3 changes: 1 addition & 2 deletions custom_components/xplora_watch/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
from typing import Any

from geopy import distance
from pydub import AudioSegment

from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_LATITUDE, ATTR_LONGITUDE, CONF_LANGUAGE
from homeassistant.core import HomeAssistant
from homeassistant.loader import DATA_CUSTOM_COMPONENTS
from homeassistant.util.yaml import save_yaml
from homeassistant.util.yaml.loader import load_yaml
from pydub import AudioSegment

from .const import (
ATTR_SERVICE_DELETE_MSG,
Expand Down
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
7 changes: 3 additions & 4 deletions custom_components/xplora_watch/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import logging
from typing import Any

import voluptuous as vol
from pyxplora_api.exception_classes import NoAdminError

import homeassistant.helpers.config_validation as cv
from homeassistant.core import HomeAssistant, ServiceCall, callback
import homeassistant.helpers.config_validation as cv
from pyxplora_api.exception_classes import NoAdminError
import voluptuous as vol

from .const import (
ATTR_SERVICE_DELETE_MSG,
Expand Down
9 changes: 2 additions & 7 deletions custom_components/xplora_watch/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@
import logging
from typing import Any

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
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from pyxplora_api.pyxplora_api_async import PyXploraApi

from .const import (
ATTR_SERVICE_USER,
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 257b67d

Please sign in to comment.