From 99e89d78e0ac2814a4290f07364103a6145594fa Mon Sep 17 00:00:00 2001 From: topsworld Date: Tue, 10 Dec 2024 19:11:25 +0800 Subject: [PATCH] style: pylint check add ignore item --- custom_components/xiaomi_home/__init__.py | 1 + custom_components/xiaomi_home/light.py | 5 ++--- custom_components/xiaomi_home/miot/miot_client.py | 1 + custom_components/xiaomi_home/miot/miot_cloud.py | 1 + custom_components/xiaomi_home/miot/miot_device.py | 1 + custom_components/xiaomi_home/miot/miot_ev.py | 1 + custom_components/xiaomi_home/miot/miot_i18n.py | 1 + custom_components/xiaomi_home/miot/miot_lan.py | 1 + custom_components/xiaomi_home/miot/miot_mdns.py | 1 + custom_components/xiaomi_home/miot/miot_mips.py | 1 + custom_components/xiaomi_home/miot/miot_spec.py | 1 + custom_components/xiaomi_home/miot/miot_storage.py | 1 + custom_components/xiaomi_home/miot/web_pages.py | 1 + 13 files changed, 14 insertions(+), 3 deletions(-) diff --git a/custom_components/xiaomi_home/__init__.py b/custom_components/xiaomi_home/__init__.py index 88a7965c..3b534e3c 100644 --- a/custom_components/xiaomi_home/__init__.py +++ b/custom_components/xiaomi_home/__init__.py @@ -68,6 +68,7 @@ async def async_setup(hass: HomeAssistant, hass_config: dict) -> bool: + # pylint: disable=unused-argument hass.data.setdefault(DOMAIN, {}) # {[entry_id:str]: MIoTClient}, miot client instance hass.data[DOMAIN].setdefault('miot_clients', {}) diff --git a/custom_components/xiaomi_home/light.py b/custom_components/xiaomi_home/light.py index a11710b5..610882e5 100644 --- a/custom_components/xiaomi_home/light.py +++ b/custom_components/xiaomi_home/light.py @@ -56,7 +56,6 @@ ATTR_BRIGHTNESS, ATTR_COLOR_TEMP_KELVIN, ATTR_RGB_COLOR, - ATTR_HS_COLOR, ATTR_EFFECT, LightEntity, LightEntityFeature, @@ -64,8 +63,7 @@ ) from homeassistant.util.color import ( value_to_brightness, - brightness_to_value, - color_hs_to_RGB + brightness_to_value ) from .miot.miot_spec import MIoTSpecProperty @@ -96,6 +94,7 @@ async def async_setup_entry( class Light(MIoTServiceEntity, LightEntity): """Light entities for Xiaomi Home.""" + # pylint: disable=unused-argument _prop_on: Optional[MIoTSpecProperty] _prop_brightness: Optional[MIoTSpecProperty] _prop_color_temp: Optional[MIoTSpecProperty] diff --git a/custom_components/xiaomi_home/miot/miot_client.py b/custom_components/xiaomi_home/miot/miot_client.py index 317afeb4..3b757d43 100644 --- a/custom_components/xiaomi_home/miot/miot_client.py +++ b/custom_components/xiaomi_home/miot/miot_client.py @@ -13,6 +13,7 @@ from homeassistant.core import HomeAssistant from homeassistant.components import zeroconf +# pylint: disable=relative-beyond-top-level from .common import MIoTMatcher from .const import ( DEFAULT_CTRL_MODE, DEFAULT_INTEGRATION_LANGUAGE, DEFAULT_NICK_NAME, DOMAIN, diff --git a/custom_components/xiaomi_home/miot/miot_cloud.py b/custom_components/xiaomi_home/miot/miot_cloud.py index fc9ea35a..803985ba 100644 --- a/custom_components/xiaomi_home/miot/miot_cloud.py +++ b/custom_components/xiaomi_home/miot/miot_cloud.py @@ -56,6 +56,7 @@ from urllib.parse import urlencode import requests +# pylint: disable=relative-beyond-top-level from .common import calc_group_id from .const import ( DEFAULT_OAUTH2_API_HOST, diff --git a/custom_components/xiaomi_home/miot/miot_device.py b/custom_components/xiaomi_home/miot/miot_device.py index 12217d95..c890460a 100644 --- a/custom_components/xiaomi_home/miot/miot_device.py +++ b/custom_components/xiaomi_home/miot/miot_device.py @@ -78,6 +78,7 @@ from homeassistant.components.switch import SwitchDeviceClass from homeassistant.util import slugify +# pylint: disable=relative-beyond-top-level from .specs.specv2entity import ( SPEC_ACTION_TRANS_MAP, SPEC_DEVICE_TRANS_MAP, diff --git a/custom_components/xiaomi_home/miot/miot_ev.py b/custom_components/xiaomi_home/miot/miot_ev.py index 424bd281..5d3958ec 100644 --- a/custom_components/xiaomi_home/miot/miot_ev.py +++ b/custom_components/xiaomi_home/miot/miot_ev.py @@ -53,6 +53,7 @@ import logging import threading +# pylint: disable=relative-beyond-top-level from .miot_error import MIoTEvError _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/xiaomi_home/miot/miot_i18n.py b/custom_components/xiaomi_home/miot/miot_i18n.py index 856fde5c..5f116944 100644 --- a/custom_components/xiaomi_home/miot/miot_i18n.py +++ b/custom_components/xiaomi_home/miot/miot_i18n.py @@ -50,6 +50,7 @@ import os from typing import Optional +# pylint: disable=relative-beyond-top-level from .common import load_json_file _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/xiaomi_home/miot/miot_lan.py b/custom_components/xiaomi_home/miot/miot_lan.py index c3ff7cba..aceeef39 100644 --- a/custom_components/xiaomi_home/miot/miot_lan.py +++ b/custom_components/xiaomi_home/miot/miot_lan.py @@ -66,6 +66,7 @@ from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes +# pylint: disable=relative-beyond-top-level from .miot_error import MIoTErrorCode from .miot_ev import MIoTEventLoop, TimeoutHandle from .miot_network import InterfaceStatus, MIoTNetwork, NetworkInfo diff --git a/custom_components/xiaomi_home/miot/miot_mdns.py b/custom_components/xiaomi_home/miot/miot_mdns.py index 78ed0cd9..4f13649b 100644 --- a/custom_components/xiaomi_home/miot/miot_mdns.py +++ b/custom_components/xiaomi_home/miot/miot_mdns.py @@ -63,6 +63,7 @@ AsyncZeroconf, AsyncServiceBrowser) +# pylint: disable=relative-beyond-top-level from .miot_error import MipsServiceError _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/xiaomi_home/miot/miot_mips.py b/custom_components/xiaomi_home/miot/miot_mips.py index e1e76cc5..888ace27 100644 --- a/custom_components/xiaomi_home/miot/miot_mips.py +++ b/custom_components/xiaomi_home/miot/miot_mips.py @@ -66,6 +66,7 @@ Client, MQTTv5) +# pylint: disable=relative-beyond-top-level from .common import MIoTMatcher from .const import MIHOME_MQTT_KEEPALIVE from .miot_error import MIoTErrorCode, MIoTMipsError diff --git a/custom_components/xiaomi_home/miot/miot_spec.py b/custom_components/xiaomi_home/miot/miot_spec.py index d72e0b9b..cab84972 100644 --- a/custom_components/xiaomi_home/miot/miot_spec.py +++ b/custom_components/xiaomi_home/miot/miot_spec.py @@ -54,6 +54,7 @@ from urllib.request import Request, urlopen import logging +# pylint: disable=relative-beyond-top-level from .const import DEFAULT_INTEGRATION_LANGUAGE, SPEC_STD_LIB_EFFECTIVE_TIME from .miot_error import MIoTSpecError from .miot_storage import ( diff --git a/custom_components/xiaomi_home/miot/miot_storage.py b/custom_components/xiaomi_home/miot/miot_storage.py index 88ac8be7..19f4b4fd 100644 --- a/custom_components/xiaomi_home/miot/miot_storage.py +++ b/custom_components/xiaomi_home/miot/miot_storage.py @@ -66,6 +66,7 @@ from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import ed25519 +# pylint: disable=relative-beyond-top-level from .common import load_json_file from .const import ( DEFAULT_INTEGRATION_LANGUAGE, diff --git a/custom_components/xiaomi_home/miot/web_pages.py b/custom_components/xiaomi_home/miot/web_pages.py index 16348c56..e4cde5a7 100644 --- a/custom_components/xiaomi_home/miot/web_pages.py +++ b/custom_components/xiaomi_home/miot/web_pages.py @@ -46,6 +46,7 @@ MIoT redirect web pages. """ +# pylint: disable=line-too-long def oauth_redirect_page(lang: str, status: str) -> str: """Return oauth redirect page."""