Enable all TID ruff rules (#126312)

* Enable ruff rule TID252

* One more

* comment
pull/126319/head
epenet 2024-09-20 12:25:51 +02:00 committed by GitHub
parent 7433d2eca9
commit cd95c133af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 11 additions and 5 deletions

View File

@ -26,7 +26,7 @@ from homeassistant.helpers.script import (
debug_stop,
)
from .. import trace
from .. import trace # noqa: TID252 (see PR 125822)
TRACE_DOMAINS = ("automation", "script")

View File

@ -1119,7 +1119,8 @@ def custom_serializer(schema: Any) -> Any:
def _custom_serializer(schema: Any, *, allow_section: bool) -> Any:
"""Serialize additional types for voluptuous_serialize."""
from .. import data_entry_flow # pylint: disable=import-outside-toplevel
from homeassistant import data_entry_flow # pylint: disable=import-outside-toplevel
from . import selector # pylint: disable=import-outside-toplevel
if schema is positive_time_period_dict:

View File

@ -14,8 +14,8 @@ from typing import Any, TypedDict
from homeassistant import core, setup
from homeassistant.const import Platform
from homeassistant.loader import bind_hass
from homeassistant.util.signal_type import SignalTypeFormat
from ..util.signal_type import SignalTypeFormat
from .dispatcher import async_dispatcher_connect, async_dispatcher_send_internal
from .typing import ConfigType, DiscoveryInfoType

View File

@ -773,7 +773,7 @@ select = [
"T100", # Trace found: {name} used
"T20", # flake8-print
"TCH", # flake8-type-checking
"TID251", # Banned imports
"TID", # Tidy imports
"TRY", # tryceratops
"UP", # pyupgrade
"UP031", # Use format specifiers instead of percent format
@ -911,6 +911,11 @@ split-on-trailing-comma = false
"homeassistant/scripts/*" = ["T201"]
"script/*" = ["T20"]
# Allow relative imports within auth and within components
"homeassistant/auth/*/*" = ["TID252"]
"homeassistant/components/*/*/*" = ["TID252"]
"tests/components/*/*/*" = ["TID252"]
# Temporary
"homeassistant/**" = ["PTH"]
"tests/**" = ["PTH"]

View File

@ -11,7 +11,7 @@ from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import debounce
from homeassistant.util.dt import utcnow
from ..common import async_fire_time_changed
from tests.common import async_fire_time_changed
_LOGGER = logging.getLogger(__name__)