diff --git a/homeassistant/backports/functools.py b/homeassistant/backports/functools.py index 83d66a39f71..212c8516b48 100644 --- a/homeassistant/backports/functools.py +++ b/homeassistant/backports/functools.py @@ -8,7 +8,7 @@ from typing import Any, Generic, Self, TypeVar, overload _T = TypeVar("_T") -class cached_property(Generic[_T]): # pylint: disable=invalid-name +class cached_property(Generic[_T]): """Backport of Python 3.12's cached_property. Includes https://github.com/python/cpython/pull/101890/files diff --git a/homeassistant/config.py b/homeassistant/config.py index 0d9e1d9034e..7c3bd2e7bfe 100644 --- a/homeassistant/config.py +++ b/homeassistant/config.py @@ -257,10 +257,10 @@ CORE_CONFIG_SCHEMA = vol.All( vol.Optional(CONF_INTERNAL_URL): cv.url, vol.Optional(CONF_EXTERNAL_URL): cv.url, vol.Optional(CONF_ALLOWLIST_EXTERNAL_DIRS): vol.All( - cv.ensure_list, [vol.IsDir()] # pylint: disable=no-value-for-parameter + cv.ensure_list, [vol.IsDir()] ), vol.Optional(LEGACY_CONF_WHITELIST_EXTERNAL_DIRS): vol.All( - cv.ensure_list, [vol.IsDir()] # pylint: disable=no-value-for-parameter + cv.ensure_list, [vol.IsDir()] ), vol.Optional(CONF_ALLOWLIST_EXTERNAL_URLS): vol.All( cv.ensure_list, [cv.url] @@ -297,7 +297,6 @@ CORE_CONFIG_SCHEMA = vol.All( ], _no_duplicate_auth_mfa_module, ), - # pylint: disable-next=no-value-for-parameter vol.Optional(CONF_MEDIA_DIRS): cv.schema_with_slug_keys(vol.IsDir()), vol.Optional(CONF_LEGACY_TEMPLATES): cv.boolean, vol.Optional(CONF_CURRENCY): _validate_currency, diff --git a/homeassistant/core.py b/homeassistant/core.py index 49c288188f3..18c5c355ae9 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -108,7 +108,7 @@ _P = ParamSpec("_P") # Internal; not helpers.typing.UNDEFINED due to circular dependency _UNDEF: dict[Any, Any] = {} _CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) -CALLBACK_TYPE = Callable[[], None] # pylint: disable=invalid-name +CALLBACK_TYPE = Callable[[], None] CORE_STORAGE_KEY = "core.config" CORE_STORAGE_VERSION = 1 @@ -847,8 +847,7 @@ class HomeAssistant: if ( not handle.cancelled() and (args := handle._args) # pylint: disable=protected-access - # pylint: disable-next=unidiomatic-typecheck - and type(job := args[0]) is HassJob + and type(job := args[0]) is HassJob # noqa: E721 and job.cancel_on_shutdown ): handle.cancel() diff --git a/homeassistant/helpers/config_validation.py b/homeassistant/helpers/config_validation.py index 5e0d66e0a9a..a4018101d0e 100644 --- a/homeassistant/helpers/config_validation.py +++ b/homeassistant/helpers/config_validation.py @@ -102,8 +102,6 @@ import homeassistant.util.dt as dt_util from . import script_variables as script_variables_helper, template as template_helper -# pylint: disable=invalid-name - TIME_PERIOD_ERROR = "offset {} should be format 'HH:MM', 'HH:MM:SS' or 'HH:MM:SS.F'" @@ -743,7 +741,6 @@ def socket_timeout(value: Any | None) -> object: raise vol.Invalid(f"Invalid socket timeout: {err}") from err -# pylint: disable=no-value-for-parameter def url( value: Any, _schema_list: frozenset[UrlProtocolSchema] = EXTERNAL_URL_PROTOCOL_SCHEMA_LIST, @@ -1360,7 +1357,7 @@ STATE_CONDITION_ATTRIBUTE_SCHEMA = vol.Schema( ) -def STATE_CONDITION_SCHEMA(value: Any) -> dict: # pylint: disable=invalid-name +def STATE_CONDITION_SCHEMA(value: Any) -> dict: """Validate a state condition.""" if not isinstance(value, dict): raise vol.Invalid("Expected a dictionary") diff --git a/homeassistant/helpers/json.py b/homeassistant/helpers/json.py index 33054bcb1b0..e94093cfd2f 100644 --- a/homeassistant/helpers/json.py +++ b/homeassistant/helpers/json.py @@ -11,7 +11,7 @@ from typing import TYPE_CHECKING, Any, Final import orjson from homeassistant.util.file import write_utf8_file, write_utf8_file_atomic -from homeassistant.util.json import ( # pylint: disable=unused-import # noqa: F401 +from homeassistant.util.json import ( # noqa: F401 JSON_DECODE_EXCEPTIONS, JSON_ENCODE_EXCEPTIONS, SerializationError, diff --git a/homeassistant/helpers/schema_config_entry_flow.py b/homeassistant/helpers/schema_config_entry_flow.py index 18d59f4f90d..e9d86f79eec 100644 --- a/homeassistant/helpers/schema_config_entry_flow.py +++ b/homeassistant/helpers/schema_config_entry_flow.py @@ -348,7 +348,7 @@ class SchemaConfigFlowHandler(config_entries.ConfigFlow, ABC): """ @callback - def async_create_entry( # pylint: disable=arguments-differ + def async_create_entry( self, data: Mapping[str, Any], **kwargs: Any, @@ -409,7 +409,7 @@ class SchemaOptionsFlowHandler(config_entries.OptionsFlowWithConfigEntry): return _async_step @callback - def async_create_entry( # pylint: disable=arguments-differ + def async_create_entry( self, data: Mapping[str, Any], **kwargs: Any, diff --git a/homeassistant/helpers/storage.py b/homeassistant/helpers/storage.py index c83481365ab..0e92cc6ff01 100644 --- a/homeassistant/helpers/storage.py +++ b/homeassistant/helpers/storage.py @@ -237,7 +237,6 @@ class Store(Generic[_T]): self.minor_version, ) if len(inspect.signature(self._async_migrate_func).parameters) == 2: - # pylint: disable-next=no-value-for-parameter stored = await self._async_migrate_func(data["version"], data["data"]) else: try: diff --git a/homeassistant/loader.py b/homeassistant/loader.py index 697e47187ce..40161bd3be9 100644 --- a/homeassistant/loader.py +++ b/homeassistant/loader.py @@ -897,7 +897,7 @@ async def async_get_integrations( for domain in domains: int_or_fut = cache.get(domain, _UNDEF) # Integration is never subclassed, so we can check for type - if type(int_or_fut) is Integration: # pylint: disable=unidiomatic-typecheck + if type(int_or_fut) is Integration: # noqa: E721 results[domain] = int_or_fut elif int_or_fut is not _UNDEF: in_progress[domain] = cast(asyncio.Future[None], int_or_fut) diff --git a/homeassistant/util/color.py b/homeassistant/util/color.py index 6ccb7f14ea2..d9f2a4b96ff 100644 --- a/homeassistant/util/color.py +++ b/homeassistant/util/color.py @@ -180,8 +180,8 @@ COLORS = { class XYPoint: """Represents a CIE 1931 XY coordinate pair.""" - x: float = attr.ib() # pylint: disable=invalid-name - y: float = attr.ib() # pylint: disable=invalid-name + x: float = attr.ib() + y: float = attr.ib() @attr.s() @@ -205,9 +205,6 @@ def color_name_to_rgb(color_name: str) -> RGBColor: return hex_value -# pylint: disable=invalid-name - - def color_RGB_to_xy( iR: int, iG: int, iB: int, Gamut: GamutType | None = None ) -> tuple[float, float]: diff --git a/homeassistant/util/distance.py b/homeassistant/util/distance.py index 509760fff19..45b105aea9f 100644 --- a/homeassistant/util/distance.py +++ b/homeassistant/util/distance.py @@ -3,7 +3,7 @@ from __future__ import annotations from collections.abc import Callable -# pylint: disable-next=unused-import,hass-deprecated-import +# pylint: disable-next=hass-deprecated-import from homeassistant.const import ( # noqa: F401 LENGTH, LENGTH_CENTIMETERS, diff --git a/homeassistant/util/json.py b/homeassistant/util/json.py index 60aa920ed6a..7f81c281340 100644 --- a/homeassistant/util/json.py +++ b/homeassistant/util/json.py @@ -11,7 +11,7 @@ import orjson from homeassistant.exceptions import HomeAssistantError -from .file import WriteError # pylint: disable=unused-import # noqa: F401 +from .file import WriteError # noqa: F401 _SENTINEL = object() _LOGGER = logging.getLogger(__name__) diff --git a/homeassistant/util/location.py b/homeassistant/util/location.py index a251aec268e..44fcaa07067 100644 --- a/homeassistant/util/location.py +++ b/homeassistant/util/location.py @@ -89,7 +89,6 @@ def vincenty( if point1[0] == point2[0] and point1[1] == point2[1]: return 0.0 - # pylint: disable=invalid-name U1 = math.atan((1 - FLATTENING) * math.tan(math.radians(point1[0]))) U2 = math.atan((1 - FLATTENING) * math.tan(math.radians(point2[0]))) L = math.radians(point2[1] - point1[1]) diff --git a/homeassistant/util/pressure.py b/homeassistant/util/pressure.py index 78a69e15a34..9c5082e95ed 100644 --- a/homeassistant/util/pressure.py +++ b/homeassistant/util/pressure.py @@ -1,7 +1,7 @@ """Pressure util functions.""" from __future__ import annotations -# pylint: disable-next=unused-import,hass-deprecated-import +# pylint: disable-next=hass-deprecated-import from homeassistant.const import ( # noqa: F401 PRESSURE, PRESSURE_BAR, diff --git a/homeassistant/util/speed.py b/homeassistant/util/speed.py index a1b6e0a7227..80a3609ab4d 100644 --- a/homeassistant/util/speed.py +++ b/homeassistant/util/speed.py @@ -1,7 +1,7 @@ """Distance util functions.""" from __future__ import annotations -# pylint: disable-next=unused-import,hass-deprecated-import +# pylint: disable-next=hass-deprecated-import from homeassistant.const import ( # noqa: F401 SPEED, SPEED_FEET_PER_SECOND, @@ -16,7 +16,7 @@ from homeassistant.const import ( # noqa: F401 ) from homeassistant.helpers.frame import report -from .unit_conversion import ( # pylint: disable=unused-import # noqa: F401 +from .unit_conversion import ( # noqa: F401 _FOOT_TO_M as FOOT_TO_M, _HRS_TO_SECS as HRS_TO_SECS, _IN_TO_M as IN_TO_M, diff --git a/homeassistant/util/temperature.py b/homeassistant/util/temperature.py index 409fecd1090..74d56e84d94 100644 --- a/homeassistant/util/temperature.py +++ b/homeassistant/util/temperature.py @@ -1,5 +1,5 @@ """Temperature util functions.""" -# pylint: disable-next=unused-import,hass-deprecated-import +# pylint: disable-next=hass-deprecated-import from homeassistant.const import ( # noqa: F401 TEMP_CELSIUS, TEMP_FAHRENHEIT, diff --git a/homeassistant/util/timeout.py b/homeassistant/util/timeout.py index 6c1de55748f..e2e969d46d2 100644 --- a/homeassistant/util/timeout.py +++ b/homeassistant/util/timeout.py @@ -49,7 +49,7 @@ class _GlobalFreezeContext: self._loop.call_soon_threadsafe(self._enter) return self - def __exit__( # pylint: disable=useless-return + def __exit__( self, exc_type: type[BaseException], exc_val: BaseException, @@ -117,7 +117,7 @@ class _ZoneFreezeContext: self._loop.call_soon_threadsafe(self._enter) return self - def __exit__( # pylint: disable=useless-return + def __exit__( self, exc_type: type[BaseException], exc_val: BaseException, diff --git a/homeassistant/util/volume.py b/homeassistant/util/volume.py index 7d70d23c00c..8aae8ff104e 100644 --- a/homeassistant/util/volume.py +++ b/homeassistant/util/volume.py @@ -1,7 +1,7 @@ """Volume conversion util functions.""" from __future__ import annotations -# pylint: disable-next=unused-import,hass-deprecated-import +# pylint: disable-next=hass-deprecated-import from homeassistant.const import ( # noqa: F401 UNIT_NOT_RECOGNIZED_TEMPLATE, VOLUME, diff --git a/homeassistant/util/yaml/loader.py b/homeassistant/util/yaml/loader.py index b5840a79e8d..2e31b212f1f 100644 --- a/homeassistant/util/yaml/loader.py +++ b/homeassistant/util/yaml/loader.py @@ -28,7 +28,7 @@ from .objects import Input, NodeDictClass, NodeListClass, NodeStrClass # mypy: allow-untyped-calls, no-warn-return-any -JSON_TYPE = list | dict | str # pylint: disable=invalid-name +JSON_TYPE = list | dict | str _DictT = TypeVar("_DictT", bound=dict) _LOGGER = logging.getLogger(__name__) diff --git a/pyproject.toml b/pyproject.toml index cdbcf851a1b..2ae9c96734c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -120,18 +120,6 @@ fail-on = [ [tool.pylint.BASIC] class-const-naming-style = "any" -good-names = [ - "_", - "ev", - "ex", - "fp", - "i", - "id", - "j", - "k", - "Run", - "ip", -] [tool.pylint."MESSAGES CONTROL"] # Reasons disabled: diff --git a/script/hassfest/manifest.py b/script/hassfest/manifest.py index 4a15acb2d1d..65e37aa515d 100644 --- a/script/hassfest/manifest.py +++ b/script/hassfest/manifest.py @@ -254,12 +254,8 @@ INTEGRATION_MANIFEST_SCHEMA = vol.Schema( } ) ], - vol.Required("documentation"): vol.All( - vol.Url(), documentation_url # pylint: disable=no-value-for-parameter - ), - vol.Optional( - "issue_tracker" - ): vol.Url(), # pylint: disable=no-value-for-parameter + vol.Required("documentation"): vol.All(vol.Url(), documentation_url), + vol.Optional("issue_tracker"): vol.Url(), vol.Optional("quality_scale"): vol.In(SUPPORTED_QUALITY_SCALES), vol.Optional("requirements"): [str], vol.Optional("dependencies"): [str], diff --git a/script/lint_and_test.py b/script/lint_and_test.py index 5a3d448c1f4..27963758415 100755 --- a/script/lint_and_test.py +++ b/script/lint_and_test.py @@ -40,7 +40,7 @@ def printc(the_color, *args): def validate_requirements_ok(): """Validate requirements, returns True of ok.""" - # pylint: disable-next=import-error,import-outside-toplevel + # pylint: disable-next=import-outside-toplevel from gen_requirements_all import main as req_main return req_main(True) == 0 diff --git a/tests/common.py b/tests/common.py index df8722a563c..0b63a9a2ef6 100644 --- a/tests/common.py +++ b/tests/common.py @@ -681,7 +681,6 @@ def ensure_auth_manager_loaded(auth_mgr): class MockModule: """Representation of a fake module.""" - # pylint: disable=invalid-name def __init__( self, domain=None, @@ -756,7 +755,6 @@ class MockPlatform: __name__ = "homeassistant.components.light.bla" __file__ = "homeassistant/components/blah/light" - # pylint: disable=invalid-name def __init__( self, setup_platform=None, diff --git a/tests/helpers/test_config_validation.py b/tests/helpers/test_config_validation.py index b5c8cc1716e..80fc1bf2241 100644 --- a/tests/helpers/test_config_validation.py +++ b/tests/helpers/test_config_validation.py @@ -1221,7 +1221,7 @@ def test_enum() -> None: schema("value3") -def test_socket_timeout(): # pylint: disable=invalid-name +def test_socket_timeout(): """Test socket timeout validator.""" schema = vol.Schema(cv.socket_timeout) diff --git a/tests/helpers/test_service.py b/tests/helpers/test_service.py index 56ee3f74140..803a57e12ed 100644 --- a/tests/helpers/test_service.py +++ b/tests/helpers/test_service.py @@ -11,7 +11,7 @@ import voluptuous as vol # To prevent circular import when running just this file from homeassistant import exceptions from homeassistant.auth.permissions import PolicyPermissions -import homeassistant.components # noqa: F401, pylint: disable=unused-import +import homeassistant.components # noqa: F401 from homeassistant.const import ( ATTR_ENTITY_ID, ENTITY_MATCH_ALL, diff --git a/tests/test_config.py b/tests/test_config.py index 407ca9ef54d..aeb25313302 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -311,7 +311,6 @@ def test_remove_lib_on_upgrade( mock_open = mock.mock_open() with patch("homeassistant.config.open", mock_open, create=True): opened_file = mock_open.return_value - # pylint: disable=no-member opened_file.readline.return_value = ha_version hass.config.path = mock.Mock() config_util.process_ha_config_upgrade(hass) @@ -335,7 +334,6 @@ def test_remove_lib_on_upgrade_94( mock_open = mock.mock_open() with patch("homeassistant.config.open", mock_open, create=True): opened_file = mock_open.return_value - # pylint: disable=no-member opened_file.readline.return_value = ha_version hass.config.path = mock.Mock() config_util.process_ha_config_upgrade(hass) @@ -356,7 +354,6 @@ def test_process_config_upgrade(hass: HomeAssistant) -> None: config_util, "__version__", "0.91.0" ): opened_file = mock_open.return_value - # pylint: disable=no-member opened_file.readline.return_value = ha_version config_util.process_ha_config_upgrade(hass) @@ -372,7 +369,6 @@ def test_config_upgrade_same_version(hass: HomeAssistant) -> None: mock_open = mock.mock_open() with patch("homeassistant.config.open", mock_open, create=True): opened_file = mock_open.return_value - # pylint: disable=no-member opened_file.readline.return_value = ha_version config_util.process_ha_config_upgrade(hass) @@ -386,7 +382,6 @@ def test_config_upgrade_no_file(hass: HomeAssistant) -> None: mock_open.side_effect = [FileNotFoundError(), mock.DEFAULT, mock.DEFAULT] with patch("homeassistant.config.open", mock_open, create=True): opened_file = mock_open.return_value - # pylint: disable=no-member config_util.process_ha_config_upgrade(hass) assert opened_file.write.call_count == 1 assert opened_file.write.call_args == mock.call(__version__) diff --git a/tests/util/test_color.py b/tests/util/test_color.py index 60b1fd547fc..7c5e959aabc 100644 --- a/tests/util/test_color.py +++ b/tests/util/test_color.py @@ -31,7 +31,6 @@ GAMUT_INVALID_4 = color_util.GamutType( ) -# pylint: disable=invalid-name def test_color_RGB_to_xy_brightness() -> None: """Test color_RGB_to_xy_brightness.""" assert color_util.color_RGB_to_xy_brightness(0, 0, 0) == (0, 0, 0) diff --git a/tests/util/yaml/test_init.py b/tests/util/yaml/test_init.py index bd99889234f..4f60c5836b5 100644 --- a/tests/util/yaml/test_init.py +++ b/tests/util/yaml/test_init.py @@ -354,8 +354,6 @@ def load_yaml(fname, string, secrets=None): class TestSecrets(unittest.TestCase): """Test the secrets parameter in the yaml utility.""" - # pylint: disable=invalid-name - def setUp(self): """Create & load secrets file.""" config_dir = get_test_config_dir()