mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Update pylint to 2.13.2 (#68704)
This commit is contained in:
parent
ea2b5a80db
commit
53110f8cb7
@ -187,6 +187,7 @@ def adb_decorator(override_available=False):
|
|||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
async def _adb_exception_catcher(self, *args, **kwargs):
|
async def _adb_exception_catcher(self, *args, **kwargs):
|
||||||
"""Call an ADB-related method and catch exceptions."""
|
"""Call an ADB-related method and catch exceptions."""
|
||||||
|
# pylint: disable=protected-access
|
||||||
if not self.available and not override_available:
|
if not self.available and not override_available:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ def retry(method):
|
|||||||
"Decora connect error for device %s. Reconnecting",
|
"Decora connect error for device %s. Reconnecting",
|
||||||
device.name,
|
device.name,
|
||||||
)
|
)
|
||||||
|
# pylint: disable=protected-access
|
||||||
device._switch.connect()
|
device._switch.connect()
|
||||||
|
|
||||||
return wrapper_retry
|
return wrapper_retry
|
||||||
|
@ -633,6 +633,7 @@ def esphome_state_property(func: _PropT) -> _PropT:
|
|||||||
@property # type: ignore[misc]
|
@property # type: ignore[misc]
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
def _wrapper(self): # type: ignore[no-untyped-def]
|
def _wrapper(self): # type: ignore[no-untyped-def]
|
||||||
|
# pylint: disable=protected-access
|
||||||
if not self._has_state:
|
if not self._has_state:
|
||||||
return None
|
return None
|
||||||
val = func(self)
|
val = func(self)
|
||||||
|
@ -295,7 +295,9 @@ def filter_turn_on_params(light, params):
|
|||||||
if not supported_features & SUPPORT_WHITE_VALUE:
|
if not supported_features & SUPPORT_WHITE_VALUE:
|
||||||
params.pop(ATTR_WHITE_VALUE, None)
|
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):
|
if not brightness_supported(supported_color_modes):
|
||||||
params.pop(ATTR_BRIGHTNESS, None)
|
params.pop(ATTR_BRIGHTNESS, None)
|
||||||
if COLOR_MODE_COLOR_TEMP not in supported_color_modes:
|
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)
|
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
|
supported_color_modes = light.supported_color_modes
|
||||||
# Backwards compatibility: if an RGBWW color is specified, convert to RGB + W
|
# Backwards compatibility: if an RGBWW color is specified, convert to RGB + W
|
||||||
# for legacy lights
|
# for legacy lights
|
||||||
|
@ -189,6 +189,7 @@ def state(new_state):
|
|||||||
|
|
||||||
def wrapper(self, **kwargs):
|
def wrapper(self, **kwargs):
|
||||||
"""Wrap a group state change."""
|
"""Wrap a group state change."""
|
||||||
|
# pylint: disable=protected-access
|
||||||
|
|
||||||
pipeline = Pipeline()
|
pipeline = Pipeline()
|
||||||
transition_time = DEFAULT_TRANSITION
|
transition_time = DEFAULT_TRANSITION
|
||||||
|
@ -42,6 +42,7 @@ def get_minio_notification_response(
|
|||||||
):
|
):
|
||||||
"""Start listening to minio events. Copied from minio-py."""
|
"""Start listening to minio events. Copied from minio-py."""
|
||||||
query = {"prefix": prefix, "suffix": suffix, "events": events}
|
query = {"prefix": prefix, "suffix": suffix, "events": events}
|
||||||
|
# pylint: disable=protected-access
|
||||||
return minio_client._url_open(
|
return minio_client._url_open(
|
||||||
"GET", bucket_name=bucket_name, query=query, preload_content=False
|
"GET", bucket_name=bucket_name, query=query, preload_content=False
|
||||||
)
|
)
|
||||||
|
@ -329,7 +329,7 @@ def library_section_payload(section):
|
|||||||
children_media_class = ITEM_TYPE_MEDIA_CLASS[section.TYPE]
|
children_media_class = ITEM_TYPE_MEDIA_CLASS[section.TYPE]
|
||||||
except KeyError as err:
|
except KeyError as err:
|
||||||
raise UnknownMediaType(f"Unknown type received: {section.TYPE}") from 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(
|
return BrowseMedia(
|
||||||
title=section.title,
|
title=section.title,
|
||||||
media_class=MEDIA_CLASS_DIRECTORY,
|
media_class=MEDIA_CLASS_DIRECTORY,
|
||||||
@ -362,7 +362,7 @@ def hub_payload(hub):
|
|||||||
media_content_id = f"{hub.librarySectionID}/{hub.hubIdentifier}"
|
media_content_id = f"{hub.librarySectionID}/{hub.hubIdentifier}"
|
||||||
else:
|
else:
|
||||||
media_content_id = f"server/{hub.hubIdentifier}"
|
media_content_id = f"server/{hub.hubIdentifier}"
|
||||||
server_id = hub._server.machineIdentifier
|
server_id = hub._server.machineIdentifier # pylint: disable=protected-access
|
||||||
payload = {
|
payload = {
|
||||||
"title": hub.title,
|
"title": hub.title,
|
||||||
"media_class": MEDIA_CLASS_DIRECTORY,
|
"media_class": MEDIA_CLASS_DIRECTORY,
|
||||||
@ -376,7 +376,7 @@ def hub_payload(hub):
|
|||||||
|
|
||||||
def station_payload(station):
|
def station_payload(station):
|
||||||
"""Create response payload for a music station."""
|
"""Create response payload for a music station."""
|
||||||
server_id = station._server.machineIdentifier
|
server_id = station._server.machineIdentifier # pylint: disable=protected-access
|
||||||
return BrowseMedia(
|
return BrowseMedia(
|
||||||
title=station.title,
|
title=station.title,
|
||||||
media_class=ITEM_TYPE_MEDIA_CLASS[station.type],
|
media_class=ITEM_TYPE_MEDIA_CLASS[station.type],
|
||||||
|
@ -204,7 +204,7 @@ def _evict_purged_states_from_old_states_cache(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Evict purged states from the old states cache."""
|
"""Evict purged states from the old states cache."""
|
||||||
# Make a map from old_state_id to entity_id
|
# 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_reversed = {
|
||||||
old_state.state_id: entity_id
|
old_state.state_id: entity_id
|
||||||
for entity_id, old_state in old_states.items()
|
for entity_id, old_state in old_states.items()
|
||||||
@ -221,7 +221,9 @@ def _evict_purged_attributes_from_attributes_cache(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Evict purged attribute ids from the attribute ids cache."""
|
"""Evict purged attribute ids from the attribute ids cache."""
|
||||||
# Make a map from attributes_id to the attributes json
|
# 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 = {
|
state_attributes_ids_reversed = {
|
||||||
attributes_id: attributes
|
attributes_id: attributes
|
||||||
for attributes, attributes_id in state_attributes_ids.items()
|
for attributes, attributes_id in state_attributes_ids.items()
|
||||||
@ -376,7 +378,7 @@ def _purge_filtered_events(
|
|||||||
_purge_event_ids(session, event_ids)
|
_purge_event_ids(session, event_ids)
|
||||||
if EVENT_STATE_CHANGED in excluded_event_types:
|
if EVENT_STATE_CHANGED in excluded_event_types:
|
||||||
session.query(StateAttributes).delete(synchronize_session=False)
|
session.query(StateAttributes).delete(synchronize_session=False)
|
||||||
instance._state_attributes_ids = {}
|
instance._state_attributes_ids = {} # pylint: disable=protected-access
|
||||||
|
|
||||||
|
|
||||||
@retryable_database_job("purge")
|
@retryable_database_job("purge")
|
||||||
|
@ -448,7 +448,7 @@ def compile_hourly_statistics(
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Get last hour's last sum
|
# Get last hour's last sum
|
||||||
if instance._db_supports_row_number:
|
if instance._db_supports_row_number: # pylint: disable=[protected-access]
|
||||||
subquery = (
|
subquery = (
|
||||||
session.query(*QUERY_STATISTICS_SUMMARY_SUM)
|
session.query(*QUERY_STATISTICS_SUMMARY_SUM)
|
||||||
.filter(StatisticsShortTerm.start >= bindparam("start_time"))
|
.filter(StatisticsShortTerm.start >= bindparam("start_time"))
|
||||||
|
@ -359,7 +359,9 @@ def setup_connection_for_dialect(
|
|||||||
version = _extract_version_from_server_response(version_string)
|
version = _extract_version_from_server_response(version_string)
|
||||||
|
|
||||||
if version and version < MIN_VERSION_SQLITE_ROWNUM:
|
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:
|
if not version or version < MIN_VERSION_SQLITE:
|
||||||
_warn_unsupported_version(
|
_warn_unsupported_version(
|
||||||
version or version_string, "SQLite", MIN_VERSION_SQLITE
|
version or version_string, "SQLite", MIN_VERSION_SQLITE
|
||||||
@ -381,14 +383,18 @@ def setup_connection_for_dialect(
|
|||||||
|
|
||||||
if is_maria_db:
|
if is_maria_db:
|
||||||
if version and version < MIN_VERSION_MARIA_DB_ROWNUM:
|
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:
|
if not version or version < MIN_VERSION_MARIA_DB:
|
||||||
_warn_unsupported_version(
|
_warn_unsupported_version(
|
||||||
version or version_string, "MariaDB", MIN_VERSION_MARIA_DB
|
version or version_string, "MariaDB", MIN_VERSION_MARIA_DB
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if version and version < MIN_VERSION_MYSQL_ROWNUM:
|
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:
|
if not version or version < MIN_VERSION_MYSQL:
|
||||||
_warn_unsupported_version(
|
_warn_unsupported_version(
|
||||||
version or version_string, "MySQL", MIN_VERSION_MYSQL
|
version or version_string, "MySQL", MIN_VERSION_MYSQL
|
||||||
|
@ -96,6 +96,7 @@ def spotify_exception_handler(func):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
|
# pylint: disable=protected-access
|
||||||
try:
|
try:
|
||||||
result = func(self, *args, **kwargs)
|
result = func(self, *args, **kwargs)
|
||||||
self._attr_available = True
|
self._attr_available = True
|
||||||
|
@ -76,7 +76,7 @@ class TradfriDeviceDataUpdateCoordinator(DataUpdateCoordinator[Device]):
|
|||||||
if self._exception:
|
if self._exception:
|
||||||
exc = self._exception
|
exc = self._exception
|
||||||
self._exception = None # Clear stored exception
|
self._exception = None # Clear stored exception
|
||||||
raise exc # pylint: disable-msg=raising-bad-type
|
raise exc
|
||||||
except RequestError as err:
|
except RequestError as err:
|
||||||
raise UpdateFailed(f"Error communicating with API: {err}.") from err
|
raise UpdateFailed(f"Error communicating with API: {err}.") from err
|
||||||
|
|
||||||
|
@ -88,6 +88,7 @@ def catch_vlc_errors(
|
|||||||
except CommandError as err:
|
except CommandError as err:
|
||||||
LOGGER.error("Command error: %s", err)
|
LOGGER.error("Command error: %s", err)
|
||||||
except ConnectError as err:
|
except ConnectError as err:
|
||||||
|
# pylint: disable=protected-access
|
||||||
if self._available:
|
if self._available:
|
||||||
LOGGER.error("Connection error: %s", err)
|
LOGGER.error("Connection error: %s", err)
|
||||||
self._available = False
|
self._available = False
|
||||||
|
@ -132,6 +132,7 @@ def websocket_command(
|
|||||||
|
|
||||||
def decorate(func: const.WebSocketCommandHandler) -> const.WebSocketCommandHandler:
|
def decorate(func: const.WebSocketCommandHandler) -> const.WebSocketCommandHandler:
|
||||||
"""Decorate ws command function."""
|
"""Decorate ws command function."""
|
||||||
|
# pylint: disable=protected-access
|
||||||
func._ws_schema = messages.BASE_COMMAND_MESSAGE_SCHEMA.extend(schema) # type: ignore[attr-defined]
|
func._ws_schema = messages.BASE_COMMAND_MESSAGE_SCHEMA.extend(schema) # type: ignore[attr-defined]
|
||||||
func._ws_command = command # type: ignore[attr-defined]
|
func._ws_command = command # type: ignore[attr-defined]
|
||||||
return func
|
return func
|
||||||
|
@ -98,8 +98,6 @@ if TYPE_CHECKING:
|
|||||||
from ..entity import ZhaEntity
|
from ..entity import ZhaEntity
|
||||||
from .store import ZhaStorage
|
from .store import ZhaStorage
|
||||||
|
|
||||||
# pylint: disable-next=broken-collections-callable
|
|
||||||
# Safe inside TYPE_CHECKING block
|
|
||||||
_LogFilterType = Union[Filter, Callable[[LogRecord], int]]
|
_LogFilterType = Union[Filter, Callable[[LogRecord], int]]
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
@ -13,7 +13,7 @@ freezegun==1.2.1
|
|||||||
mock-open==1.4.0
|
mock-open==1.4.0
|
||||||
mypy==0.942
|
mypy==0.942
|
||||||
pre-commit==2.17.0
|
pre-commit==2.17.0
|
||||||
pylint==2.13.0
|
pylint==2.13.2
|
||||||
pipdeptree==2.2.1
|
pipdeptree==2.2.1
|
||||||
pylint-strict-informational==0.1
|
pylint-strict-informational==0.1
|
||||||
pytest-aiohttp==0.3.0
|
pytest-aiohttp==0.3.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user