Update pylint to 2.13.2 (#68704)
parent
ea2b5a80db
commit
53110f8cb7
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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],
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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__)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue