Enable Ruff ICN001 (#87775)
This commit is contained in:
parent
67499e0204
commit
f5b651750c
5 changed files with 17 additions and 12 deletions
|
@ -4,7 +4,7 @@ from __future__ import annotations
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
import numpy
|
||||
import numpy as np
|
||||
import requests
|
||||
import voluptuous as vol
|
||||
|
||||
|
@ -165,7 +165,7 @@ class OpenCVImageProcessor(ImageProcessingEntity):
|
|||
|
||||
def process_image(self, image):
|
||||
"""Process the image."""
|
||||
cv_image = cv2.imdecode(numpy.asarray(bytearray(image)), cv2.IMREAD_UNCHANGED)
|
||||
cv_image = cv2.imdecode(np.asarray(bytearray(image)), cv2.IMREAD_UNCHANGED)
|
||||
|
||||
matches = {}
|
||||
total_matches = 0
|
||||
|
|
|
@ -11,7 +11,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation, device_registry
|
||||
from homeassistant.helpers import config_validation as cv, device_registry
|
||||
|
||||
from .const import (
|
||||
CONFIG_ENTRY_HOST,
|
||||
|
@ -33,7 +33,7 @@ NOTIFICATION_TITLE = "UPnP/IGD Setup"
|
|||
|
||||
PLATFORMS = [Platform.BINARY_SENSOR, Platform.SENSOR]
|
||||
|
||||
CONFIG_SCHEMA = config_validation.removed(DOMAIN, raise_if_present=False)
|
||||
CONFIG_SCHEMA = cv.removed(DOMAIN, raise_if_present=False)
|
||||
|
||||
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
|
|
|
@ -244,6 +244,7 @@ select = [
|
|||
"D", # docstrings
|
||||
"E", # pycodestyle
|
||||
"F", # pyflakes/autoflake
|
||||
"ICN001", # import concentions; {name} should be imported as {asname}
|
||||
"PGH004", # Use specific rule codes when using noqa
|
||||
"PLC0414", # Useless import alias. Import alias does not rename original package.
|
||||
"SIM105", # Use contextlib.suppress({exception}) instead of try-except-pass
|
||||
|
@ -268,6 +269,10 @@ ignore = [
|
|||
"E731", # do not assign a lambda expression, use a def
|
||||
]
|
||||
|
||||
[tool.ruff.flake8-import-conventions.extend-aliases]
|
||||
voluptuous = "vol"
|
||||
"homeassistant.helpers.config_validation" = "cv"
|
||||
|
||||
[tool.ruff.flake8-pytest-style]
|
||||
fixture-parentheses = false
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import voluptuous
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.homekit.const import (
|
||||
|
@ -1416,7 +1416,7 @@ async def test_options_flow_exclude_mode_skips_category_entities(
|
|||
|
||||
# sonos_config_switch.entity_id is a config category entity
|
||||
# so it should not be selectable since it will always be excluded
|
||||
with pytest.raises(voluptuous.error.MultipleInvalid):
|
||||
with pytest.raises(vol.error.MultipleInvalid):
|
||||
await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"],
|
||||
user_input={"entities": [sonos_config_switch.entity_id]},
|
||||
|
@ -1506,7 +1506,7 @@ async def test_options_flow_exclude_mode_skips_hidden_entities(
|
|||
|
||||
# sonos_hidden_switch.entity_id is a hidden entity
|
||||
# so it should not be selectable since it will always be excluded
|
||||
with pytest.raises(voluptuous.error.MultipleInvalid):
|
||||
with pytest.raises(vol.error.MultipleInvalid):
|
||||
await hass.config_entries.options.async_configure(
|
||||
result2["flow_id"],
|
||||
user_input={"entities": [sonos_hidden_switch.entity_id]},
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
"""Constants for kraken tests."""
|
||||
import pandas
|
||||
import pandas as pd
|
||||
|
||||
TRADEABLE_ASSET_PAIR_RESPONSE = pandas.DataFrame(
|
||||
TRADEABLE_ASSET_PAIR_RESPONSE = pd.DataFrame(
|
||||
{"wsname": ["ADA/XBT", "ADA/ETH", "XBT/EUR", "XBT/GBP", "XBT/USD", "XBT/JPY"]},
|
||||
columns=["wsname"],
|
||||
index=["ADAXBT", "ADAETH", "XBTEUR", "XXBTZGBP", "XXBTZUSD", "XXBTZJPY"],
|
||||
)
|
||||
|
||||
MISSING_PAIR_TRADEABLE_ASSET_PAIR_RESPONSE = pandas.DataFrame(
|
||||
MISSING_PAIR_TRADEABLE_ASSET_PAIR_RESPONSE = pd.DataFrame(
|
||||
{"wsname": ["ADA/XBT", "ADA/ETH", "XBT/EUR", "XBT/GBP", "XBT/JPY"]},
|
||||
columns=["wsname"],
|
||||
index=["ADAXBT", "ADAETH", "XBTEUR", "XXBTZGBP", "XXBTZJPY"],
|
||||
)
|
||||
|
||||
TICKER_INFORMATION_RESPONSE = pandas.DataFrame(
|
||||
TICKER_INFORMATION_RESPONSE = pd.DataFrame(
|
||||
{
|
||||
"a": [
|
||||
[0.000349400, 15949, 15949.000],
|
||||
|
@ -85,7 +85,7 @@ TICKER_INFORMATION_RESPONSE = pandas.DataFrame(
|
|||
index=["ADAXBT", "ADAETH", "XBTEUR", "XXBTZGBP", "XXBTZUSD", "XXBTZJPY"],
|
||||
)
|
||||
|
||||
MISSING_PAIR_TICKER_INFORMATION_RESPONSE = pandas.DataFrame(
|
||||
MISSING_PAIR_TICKER_INFORMATION_RESPONSE = pd.DataFrame(
|
||||
{
|
||||
"a": [
|
||||
[0.000349400, 15949, 15949.000],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue