mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Lint
This commit is contained in:
parent
4de97abc3a
commit
0ccffc3e55
@ -144,8 +144,8 @@ class Data:
|
|||||||
# pylint: disable=no-self-use
|
# pylint: disable=no-self-use
|
||||||
def hash_password(self, password: str, for_storage: bool = False) -> bytes:
|
def hash_password(self, password: str, for_storage: bool = False) -> bytes:
|
||||||
"""Encode a password."""
|
"""Encode a password."""
|
||||||
hashed = bcrypt.hashpw(password.encode(), bcrypt.gensalt(rounds=12))
|
hashed: bytes = bcrypt.hashpw(password.encode(), bcrypt.gensalt(rounds=12))
|
||||||
# type: bytes
|
|
||||||
if for_storage:
|
if for_storage:
|
||||||
hashed = base64.b64encode(hashed)
|
hashed = base64.b64encode(hashed)
|
||||||
return hashed
|
return hashed
|
||||||
|
@ -539,8 +539,7 @@ class CastDevice(MediaPlayerDevice):
|
|||||||
self.media_status = None
|
self.media_status = None
|
||||||
self.media_status_received = None
|
self.media_status_received = None
|
||||||
self._dynamic_group_cast_info = None # type: ChromecastInfo
|
self._dynamic_group_cast_info = None # type: ChromecastInfo
|
||||||
self._dynamic_group_cast = None
|
self._dynamic_group_cast = None # type: Optional[pychromecast.Chromecast]
|
||||||
# type: Optional[pychromecast.Chromecast]
|
|
||||||
self.dynamic_group_media_status = None
|
self.dynamic_group_media_status = None
|
||||||
self.dynamic_group_media_status_received = None
|
self.dynamic_group_media_status_received = None
|
||||||
self.mz_media_status = {}
|
self.mz_media_status = {}
|
||||||
@ -549,8 +548,9 @@ class CastDevice(MediaPlayerDevice):
|
|||||||
self._available = False # type: bool
|
self._available = False # type: bool
|
||||||
self._dynamic_group_available = False # type: bool
|
self._dynamic_group_available = False # type: bool
|
||||||
self._status_listener = None # type: Optional[CastStatusListener]
|
self._status_listener = None # type: Optional[CastStatusListener]
|
||||||
self._dynamic_group_status_listener = None
|
self._dynamic_group_status_listener = (
|
||||||
# type: Optional[DynamicGroupCastStatusListener]
|
None
|
||||||
|
) # type: Optional[DynamicGroupCastStatusListener]
|
||||||
self._add_remove_handler = None
|
self._add_remove_handler = None
|
||||||
self._del_remove_handler = None
|
self._del_remove_handler = None
|
||||||
|
|
||||||
|
@ -61,11 +61,11 @@ SCHEMA_WS_HOOK_DELETE = websocket_api.BASE_COMMAND_MESSAGE_SCHEMA.extend(
|
|||||||
_CLOUD_ERRORS = {
|
_CLOUD_ERRORS = {
|
||||||
InvalidTrustedNetworks: (
|
InvalidTrustedNetworks: (
|
||||||
500,
|
500,
|
||||||
"Remote UI not compatible with 127.0.0.1/::1" " as a trusted network.",
|
"Remote UI not compatible with 127.0.0.1/::1 as a trusted network.",
|
||||||
),
|
),
|
||||||
InvalidTrustedProxies: (
|
InvalidTrustedProxies: (
|
||||||
500,
|
500,
|
||||||
"Remote UI not compatible with 127.0.0.1/::1" " as trusted proxies.",
|
"Remote UI not compatible with 127.0.0.1/::1 as trusted proxies.",
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,7 +678,8 @@ class DarkSkySensor(Entity):
|
|||||||
"temperature_high",
|
"temperature_high",
|
||||||
"apparent_temperature_high",
|
"apparent_temperature_high",
|
||||||
"temperature_max",
|
"temperature_max",
|
||||||
"apparent_temperature_max" "precip_accumulation",
|
"apparent_temperature_max",
|
||||||
|
"precip_accumulation",
|
||||||
"pressure",
|
"pressure",
|
||||||
"ozone",
|
"ozone",
|
||||||
"uvIndex",
|
"uvIndex",
|
||||||
|
@ -200,8 +200,10 @@ class EvoBroker:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
self.tcs = (
|
self.tcs = (
|
||||||
client.locations[loc_idx]._gateways[0]._control_systems[0]
|
client.locations[loc_idx] # noqa: E501; pylint: disable=protected-access
|
||||||
) # noqa: E501; pylint: disable=protected-access
|
._gateways[0]
|
||||||
|
._control_systems[0]
|
||||||
|
)
|
||||||
|
|
||||||
_LOGGER.debug("Config = %s", self.config)
|
_LOGGER.debug("Config = %s", self.config)
|
||||||
if _LOGGER.isEnabledFor(logging.DEBUG):
|
if _LOGGER.isEnabledFor(logging.DEBUG):
|
||||||
|
@ -175,9 +175,8 @@ class EvoClimateDevice(EvoDevice, ClimateDevice):
|
|||||||
def _set_tcs_mode(self, op_mode: str) -> None:
|
def _set_tcs_mode(self, op_mode: str) -> None:
|
||||||
"""Set the Controller to any of its native EVO_* operating modes."""
|
"""Set the Controller to any of its native EVO_* operating modes."""
|
||||||
try:
|
try:
|
||||||
self._evo_tcs._set_status(
|
# noqa: E501; pylint: disable=protected-access
|
||||||
op_mode
|
self._evo_tcs._set_status(op_mode)
|
||||||
) # noqa: E501; pylint: disable=protected-access
|
|
||||||
except (
|
except (
|
||||||
requests.exceptions.RequestException,
|
requests.exceptions.RequestException,
|
||||||
evohomeclient2.AuthenticationError,
|
evohomeclient2.AuthenticationError,
|
||||||
|
@ -49,11 +49,15 @@ async def async_setup(hass, hass_config):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"zones_raw = %s", data._client.hub._zones_raw
|
# noqa; pylint: disable=protected-access
|
||||||
) # noqa; pylint: disable=protected-access
|
"zones_raw = %s",
|
||||||
|
data._client.hub._zones_raw,
|
||||||
|
)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"devices_raw = %s", data._client.hub._devices_raw
|
# noqa; pylint: disable=protected-access
|
||||||
) # noqa; pylint: disable=protected-access
|
"devices_raw = %s",
|
||||||
|
data._client.hub._devices_raw,
|
||||||
|
)
|
||||||
|
|
||||||
async_track_time_interval(hass, data.async_update, SCAN_INTERVAL)
|
async_track_time_interval(hass, data.async_update, SCAN_INTERVAL)
|
||||||
|
|
||||||
@ -90,10 +94,14 @@ class GeniusData:
|
|||||||
return
|
return
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"zones_raw = %s", self._client.hub._zones_raw
|
# noqa; pylint: disable=protected-access
|
||||||
) # noqa; pylint: disable=protected-access
|
"zones_raw = %s",
|
||||||
|
self._client.hub._zones_raw,
|
||||||
|
)
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"devices_raw = %s", self._client.hub._devices_raw
|
# noqa; pylint: disable=protected-access
|
||||||
) # noqa; pylint: disable=protected-access
|
"devices_raw = %s",
|
||||||
|
self._client.hub._devices_raw,
|
||||||
|
)
|
||||||
|
|
||||||
async_dispatcher_send(self._hass, DOMAIN)
|
async_dispatcher_send(self._hass, DOMAIN)
|
||||||
|
@ -67,9 +67,8 @@ class GeniusBinarySensor(BinarySensorDevice):
|
|||||||
attrs = {}
|
attrs = {}
|
||||||
attrs["assigned_zone"] = self._device.assignedZones[0]["name"]
|
attrs["assigned_zone"] = self._device.assignedZones[0]["name"]
|
||||||
|
|
||||||
last_comms = self._device._raw_json["childValues"]["lastComms"][
|
# noqa; pylint: disable=protected-access
|
||||||
"val"
|
last_comms = self._device._raw_json["childValues"]["lastComms"]["val"]
|
||||||
] # noqa; pylint: disable=protected-access
|
|
||||||
if last_comms != 0:
|
if last_comms != 0:
|
||||||
attrs["last_comms"] = utc_from_timestamp(last_comms).isoformat()
|
attrs["last_comms"] = utc_from_timestamp(last_comms).isoformat()
|
||||||
|
|
||||||
|
@ -62,9 +62,8 @@ class GeniusDevice(Entity):
|
|||||||
@property
|
@property
|
||||||
def icon(self):
|
def icon(self):
|
||||||
"""Return the icon of the sensor."""
|
"""Return the icon of the sensor."""
|
||||||
values = self._device._raw_json[
|
# noqa; pylint: disable=protected-access
|
||||||
"childValues"
|
values = self._device._raw_json["childValues"]
|
||||||
] # noqa; pylint: disable=protected-access
|
|
||||||
|
|
||||||
last_comms = utc_from_timestamp(values["lastComms"]["val"])
|
last_comms = utc_from_timestamp(values["lastComms"]["val"])
|
||||||
if "WakeUp_Interval" in values:
|
if "WakeUp_Interval" in values:
|
||||||
@ -114,9 +113,8 @@ class GeniusDevice(Entity):
|
|||||||
attrs = {}
|
attrs = {}
|
||||||
attrs["assigned_zone"] = self._device.assignedZones[0]["name"]
|
attrs["assigned_zone"] = self._device.assignedZones[0]["name"]
|
||||||
|
|
||||||
last_comms = self._device._raw_json["childValues"]["lastComms"][
|
# noqa; pylint: disable=protected-access
|
||||||
"val"
|
last_comms = self._device._raw_json["childValues"]["lastComms"]["val"]
|
||||||
] # noqa; pylint: disable=protected-access
|
|
||||||
attrs["last_comms"] = utc_from_timestamp(last_comms).isoformat()
|
attrs["last_comms"] = utc_from_timestamp(last_comms).isoformat()
|
||||||
|
|
||||||
return {**attrs}
|
return {**attrs}
|
||||||
|
@ -161,8 +161,10 @@ class HoneywellUSThermostat(ClimateDevice):
|
|||||||
self._password = password
|
self._password = password
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"latestData = %s ", device._data
|
# noqa; pylint: disable=protected-access
|
||||||
) # noqa; pylint: disable=protected-access
|
"latestData = %s ",
|
||||||
|
device._data,
|
||||||
|
)
|
||||||
|
|
||||||
# not all honeywell HVACs support all modes
|
# not all honeywell HVACs support all modes
|
||||||
mappings = [v for k, v in HVAC_MODE_TO_HW_MODE.items() if device.raw_ui_data[k]]
|
mappings = [v for k, v in HVAC_MODE_TO_HW_MODE.items() if device.raw_ui_data[k]]
|
||||||
@ -174,9 +176,8 @@ class HoneywellUSThermostat(ClimateDevice):
|
|||||||
| SUPPORT_TARGET_TEMPERATURE_RANGE
|
| SUPPORT_TARGET_TEMPERATURE_RANGE
|
||||||
)
|
)
|
||||||
|
|
||||||
if device._data[
|
# noqa; pylint: disable=protected-access
|
||||||
"canControlHumidification"
|
if device._data["canControlHumidification"]:
|
||||||
]: # noqa; pylint: disable=protected-access
|
|
||||||
self._supported_features |= SUPPORT_TARGET_HUMIDITY
|
self._supported_features |= SUPPORT_TARGET_HUMIDITY
|
||||||
|
|
||||||
if device.raw_ui_data["SwitchEmergencyHeatAllowed"]:
|
if device.raw_ui_data["SwitchEmergencyHeatAllowed"]:
|
||||||
@ -464,5 +465,7 @@ class HoneywellUSThermostat(ClimateDevice):
|
|||||||
_LOGGER.error("SomeComfort update failed, Retrying - Error: %s", exp)
|
_LOGGER.error("SomeComfort update failed, Retrying - Error: %s", exp)
|
||||||
|
|
||||||
_LOGGER.debug(
|
_LOGGER.debug(
|
||||||
"latestData = %s ", self._device._data
|
# noqa; pylint: disable=protected-access
|
||||||
) # noqa; pylint: disable=protected-access
|
"latestData = %s ",
|
||||||
|
self._device._data,
|
||||||
|
)
|
||||||
|
@ -51,8 +51,9 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
token = auth.get_token(email, password)
|
token = auth.get_token(email, password)
|
||||||
except requests.exceptions.HTTPError as http_error:
|
except requests.exceptions.HTTPError as http_error:
|
||||||
if (
|
if (
|
||||||
http_error.response.status_code == requests.codes.unauthorized
|
http_error.response.status_code
|
||||||
): # pylint: disable=no-member
|
== requests.codes.unauthorized # pylint: disable=no-member
|
||||||
|
):
|
||||||
_LOGGER.error("Invalid credentials")
|
_LOGGER.error("Invalid credentials")
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -115,8 +116,9 @@ class TankUtilitySensor(Entity):
|
|||||||
data = device.get_device_data(self._token, self.device)
|
data = device.get_device_data(self._token, self.device)
|
||||||
except requests.exceptions.HTTPError as http_error:
|
except requests.exceptions.HTTPError as http_error:
|
||||||
if (
|
if (
|
||||||
http_error.response.status_code == requests.codes.unauthorized
|
http_error.response.status_code
|
||||||
): # pylint: disable=no-member
|
== requests.codes.unauthorized # pylint: disable=no-member
|
||||||
|
):
|
||||||
_LOGGER.info("Getting new token")
|
_LOGGER.info("Getting new token")
|
||||||
self._token = auth.get_token(self._email, self._password, force=True)
|
self._token = auth.get_token(self._email, self._password, force=True)
|
||||||
data = device.get_device_data(self._token, self.device)
|
data = device.get_device_data(self._token, self.device)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user