diff --git a/homeassistant/components/androidtv/media_player.py b/homeassistant/components/androidtv/media_player.py index 8e4b04cb507..19cae59a1b4 100644 --- a/homeassistant/components/androidtv/media_player.py +++ b/homeassistant/components/androidtv/media_player.py @@ -187,6 +187,7 @@ def adb_decorator(override_available=False): @functools.wraps(func) async def _adb_exception_catcher(self, *args, **kwargs): """Call an ADB-related method and catch exceptions.""" + # pylint: disable=protected-access if not self.available and not override_available: return None diff --git a/homeassistant/components/decora/light.py b/homeassistant/components/decora/light.py index f4b48ccb01b..e29222c8eee 100644 --- a/homeassistant/components/decora/light.py +++ b/homeassistant/components/decora/light.py @@ -70,6 +70,7 @@ def retry(method): "Decora connect error for device %s. Reconnecting", device.name, ) + # pylint: disable=protected-access device._switch.connect() return wrapper_retry diff --git a/homeassistant/components/esphome/__init__.py b/homeassistant/components/esphome/__init__.py index eba60a3d5a1..fd9b5dfd6d2 100644 --- a/homeassistant/components/esphome/__init__.py +++ b/homeassistant/components/esphome/__init__.py @@ -633,6 +633,7 @@ def esphome_state_property(func: _PropT) -> _PropT: @property # type: ignore[misc] @functools.wraps(func) def _wrapper(self): # type: ignore[no-untyped-def] + # pylint: disable=protected-access if not self._has_state: return None val = func(self) diff --git a/homeassistant/components/light/__init__.py b/homeassistant/components/light/__init__.py index 5e8bf473da3..36588704c85 100644 --- a/homeassistant/components/light/__init__.py +++ b/homeassistant/components/light/__init__.py @@ -295,7 +295,9 @@ def filter_turn_on_params(light, params): if not supported_features & SUPPORT_WHITE_VALUE: params.pop(ATTR_WHITE_VALUE, None) - supported_color_modes = light._light_internal_supported_color_modes + supported_color_modes = ( + light._light_internal_supported_color_modes # pylint:disable=protected-access + ) if not brightness_supported(supported_color_modes): params.pop(ATTR_BRIGHTNESS, None) if COLOR_MODE_COLOR_TEMP not in supported_color_modes: @@ -366,7 +368,9 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool: # noqa: ): profiles.apply_default(light.entity_id, light.is_on, params) - legacy_supported_color_modes = light._light_internal_supported_color_modes + legacy_supported_color_modes = ( + light._light_internal_supported_color_modes # pylint: disable=protected-access + ) supported_color_modes = light.supported_color_modes # Backwards compatibility: if an RGBWW color is specified, convert to RGB + W # for legacy lights diff --git a/homeassistant/components/limitlessled/light.py b/homeassistant/components/limitlessled/light.py index 35bfafd602d..e45a4a2ced0 100644 --- a/homeassistant/components/limitlessled/light.py +++ b/homeassistant/components/limitlessled/light.py @@ -189,6 +189,7 @@ def state(new_state): def wrapper(self, **kwargs): """Wrap a group state change.""" + # pylint: disable=protected-access pipeline = Pipeline() transition_time = DEFAULT_TRANSITION diff --git a/homeassistant/components/minio/minio_helper.py b/homeassistant/components/minio/minio_helper.py index cc7b7f8a3e7..4f10da10998 100644 --- a/homeassistant/components/minio/minio_helper.py +++ b/homeassistant/components/minio/minio_helper.py @@ -42,6 +42,7 @@ def get_minio_notification_response( ): """Start listening to minio events. Copied from minio-py.""" query = {"prefix": prefix, "suffix": suffix, "events": events} + # pylint: disable=protected-access return minio_client._url_open( "GET", bucket_name=bucket_name, query=query, preload_content=False ) diff --git a/homeassistant/components/plex/media_browser.py b/homeassistant/components/plex/media_browser.py index 59895c0d613..4b2bb502d69 100644 --- a/homeassistant/components/plex/media_browser.py +++ b/homeassistant/components/plex/media_browser.py @@ -329,7 +329,7 @@ def library_section_payload(section): children_media_class = ITEM_TYPE_MEDIA_CLASS[section.TYPE] except KeyError as err: raise UnknownMediaType(f"Unknown type received: {section.TYPE}") from err - server_id = section._server.machineIdentifier + server_id = section._server.machineIdentifier # pylint: disable=protected-access return BrowseMedia( title=section.title, media_class=MEDIA_CLASS_DIRECTORY, @@ -362,7 +362,7 @@ def hub_payload(hub): media_content_id = f"{hub.librarySectionID}/{hub.hubIdentifier}" else: media_content_id = f"server/{hub.hubIdentifier}" - server_id = hub._server.machineIdentifier + server_id = hub._server.machineIdentifier # pylint: disable=protected-access payload = { "title": hub.title, "media_class": MEDIA_CLASS_DIRECTORY, @@ -376,7 +376,7 @@ def hub_payload(hub): def station_payload(station): """Create response payload for a music station.""" - server_id = station._server.machineIdentifier + server_id = station._server.machineIdentifier # pylint: disable=protected-access return BrowseMedia( title=station.title, media_class=ITEM_TYPE_MEDIA_CLASS[station.type], diff --git a/homeassistant/components/recorder/purge.py b/homeassistant/components/recorder/purge.py index 532aef3c53d..a15d22810f4 100644 --- a/homeassistant/components/recorder/purge.py +++ b/homeassistant/components/recorder/purge.py @@ -204,7 +204,7 @@ def _evict_purged_states_from_old_states_cache( ) -> None: """Evict purged states from the old states cache.""" # Make a map from old_state_id to entity_id - old_states = instance._old_states + old_states = instance._old_states # pylint: disable=protected-access old_state_reversed = { old_state.state_id: entity_id for entity_id, old_state in old_states.items() @@ -221,7 +221,9 @@ def _evict_purged_attributes_from_attributes_cache( ) -> None: """Evict purged attribute ids from the attribute ids cache.""" # Make a map from attributes_id to the attributes json - state_attributes_ids = instance._state_attributes_ids + state_attributes_ids = ( + instance._state_attributes_ids # pylint: disable=protected-access + ) state_attributes_ids_reversed = { attributes_id: attributes for attributes, attributes_id in state_attributes_ids.items() @@ -376,7 +378,7 @@ def _purge_filtered_events( _purge_event_ids(session, event_ids) if EVENT_STATE_CHANGED in excluded_event_types: session.query(StateAttributes).delete(synchronize_session=False) - instance._state_attributes_ids = {} + instance._state_attributes_ids = {} # pylint: disable=protected-access @retryable_database_job("purge") diff --git a/homeassistant/components/recorder/statistics.py b/homeassistant/components/recorder/statistics.py index 2ad2530fb83..f01190097df 100644 --- a/homeassistant/components/recorder/statistics.py +++ b/homeassistant/components/recorder/statistics.py @@ -448,7 +448,7 @@ def compile_hourly_statistics( } # Get last hour's last sum - if instance._db_supports_row_number: + if instance._db_supports_row_number: # pylint: disable=[protected-access] subquery = ( session.query(*QUERY_STATISTICS_SUMMARY_SUM) .filter(StatisticsShortTerm.start >= bindparam("start_time")) diff --git a/homeassistant/components/recorder/util.py b/homeassistant/components/recorder/util.py index 9d12f1d7473..487b8dd22f7 100644 --- a/homeassistant/components/recorder/util.py +++ b/homeassistant/components/recorder/util.py @@ -359,7 +359,9 @@ def setup_connection_for_dialect( version = _extract_version_from_server_response(version_string) if version and version < MIN_VERSION_SQLITE_ROWNUM: - instance._db_supports_row_number = False + instance._db_supports_row_number = ( # pylint: disable=[protected-access] + False + ) if not version or version < MIN_VERSION_SQLITE: _warn_unsupported_version( version or version_string, "SQLite", MIN_VERSION_SQLITE @@ -381,14 +383,18 @@ def setup_connection_for_dialect( if is_maria_db: if version and version < MIN_VERSION_MARIA_DB_ROWNUM: - instance._db_supports_row_number = False + instance._db_supports_row_number = ( # pylint: disable=[protected-access] + False + ) if not version or version < MIN_VERSION_MARIA_DB: _warn_unsupported_version( version or version_string, "MariaDB", MIN_VERSION_MARIA_DB ) else: if version and version < MIN_VERSION_MYSQL_ROWNUM: - instance._db_supports_row_number = False + instance._db_supports_row_number = ( # pylint: disable=[protected-access] + False + ) if not version or version < MIN_VERSION_MYSQL: _warn_unsupported_version( version or version_string, "MySQL", MIN_VERSION_MYSQL diff --git a/homeassistant/components/spotify/media_player.py b/homeassistant/components/spotify/media_player.py index 3e77c5893c0..2b62fdd78c4 100644 --- a/homeassistant/components/spotify/media_player.py +++ b/homeassistant/components/spotify/media_player.py @@ -96,6 +96,7 @@ def spotify_exception_handler(func): """ def wrapper(self, *args, **kwargs): + # pylint: disable=protected-access try: result = func(self, *args, **kwargs) self._attr_available = True diff --git a/homeassistant/components/tradfri/coordinator.py b/homeassistant/components/tradfri/coordinator.py index 039ff34c9f7..5a516e8f46e 100644 --- a/homeassistant/components/tradfri/coordinator.py +++ b/homeassistant/components/tradfri/coordinator.py @@ -76,7 +76,7 @@ class TradfriDeviceDataUpdateCoordinator(DataUpdateCoordinator[Device]): if self._exception: exc = self._exception self._exception = None # Clear stored exception - raise exc # pylint: disable-msg=raising-bad-type + raise exc except RequestError as err: raise UpdateFailed(f"Error communicating with API: {err}.") from err diff --git a/homeassistant/components/vlc_telnet/media_player.py b/homeassistant/components/vlc_telnet/media_player.py index 5b7c5fbb524..99b37f97e0c 100644 --- a/homeassistant/components/vlc_telnet/media_player.py +++ b/homeassistant/components/vlc_telnet/media_player.py @@ -88,6 +88,7 @@ def catch_vlc_errors( except CommandError as err: LOGGER.error("Command error: %s", err) except ConnectError as err: + # pylint: disable=protected-access if self._available: LOGGER.error("Connection error: %s", err) self._available = False diff --git a/homeassistant/components/websocket_api/decorators.py b/homeassistant/components/websocket_api/decorators.py index 223c09eb5fd..296271c7cfd 100644 --- a/homeassistant/components/websocket_api/decorators.py +++ b/homeassistant/components/websocket_api/decorators.py @@ -132,6 +132,7 @@ def websocket_command( def decorate(func: const.WebSocketCommandHandler) -> const.WebSocketCommandHandler: """Decorate ws command function.""" + # pylint: disable=protected-access func._ws_schema = messages.BASE_COMMAND_MESSAGE_SCHEMA.extend(schema) # type: ignore[attr-defined] func._ws_command = command # type: ignore[attr-defined] return func diff --git a/homeassistant/components/zha/core/gateway.py b/homeassistant/components/zha/core/gateway.py index 18213c396cc..6c600bf93d6 100644 --- a/homeassistant/components/zha/core/gateway.py +++ b/homeassistant/components/zha/core/gateway.py @@ -98,8 +98,6 @@ if TYPE_CHECKING: from ..entity import ZhaEntity from .store import ZhaStorage - # pylint: disable-next=broken-collections-callable - # Safe inside TYPE_CHECKING block _LogFilterType = Union[Filter, Callable[[LogRecord], int]] _LOGGER = logging.getLogger(__name__) diff --git a/requirements_test.txt b/requirements_test.txt index 34a4936b3d8..02405093237 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -13,7 +13,7 @@ freezegun==1.2.1 mock-open==1.4.0 mypy==0.942 pre-commit==2.17.0 -pylint==2.13.0 +pylint==2.13.2 pipdeptree==2.2.1 pylint-strict-informational==0.1 pytest-aiohttp==0.3.0