mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Address new issues flagged by flake8 3.8.0a2 (#34964)
This commit is contained in:
parent
bf5cc22bef
commit
435a88636a
@ -65,6 +65,7 @@ class DiscordNotificationService(BaseNotificationService):
|
|||||||
images.append(image)
|
images.append(image)
|
||||||
else:
|
else:
|
||||||
_LOGGER.warning("Image not found: %s", image)
|
_LOGGER.warning("Image not found: %s", image)
|
||||||
|
|
||||||
# pylint: disable=unused-variable
|
# pylint: disable=unused-variable
|
||||||
@discord_bot.event
|
@discord_bot.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
|
@ -326,7 +326,7 @@ def _mean_int(*args):
|
|||||||
|
|
||||||
def _mean_tuple(*args):
|
def _mean_tuple(*args):
|
||||||
"""Return the mean values along the columns of the supplied values."""
|
"""Return the mean values along the columns of the supplied values."""
|
||||||
return tuple(sum(l) / len(l) for l in zip(*args))
|
return tuple(sum(x) / len(x) for x in zip(*args))
|
||||||
|
|
||||||
|
|
||||||
def _reduce_attribute(
|
def _reduce_attribute(
|
||||||
|
@ -59,7 +59,9 @@ def setup(hass, config):
|
|||||||
"Streamlabs Water Monitor auto-detected location_id=%s", location_id
|
"Streamlabs Water Monitor auto-detected location_id=%s", location_id
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
location = next((l for l in locations if location_id == l["locationId"]), None)
|
location = next(
|
||||||
|
(loc for loc in locations if location_id == loc["locationId"]), None
|
||||||
|
)
|
||||||
if location is None:
|
if location is None:
|
||||||
_LOGGER.error("Supplied location_id is invalid")
|
_LOGGER.error("Supplied location_id is invalid")
|
||||||
return False
|
return False
|
||||||
|
@ -85,7 +85,7 @@ class Wunderlist:
|
|||||||
def _list_by_name(self, name):
|
def _list_by_name(self, name):
|
||||||
"""Return a list ID by name."""
|
"""Return a list ID by name."""
|
||||||
lists = self._client.get_lists()
|
lists = self._client.get_lists()
|
||||||
tmp = [l for l in lists if l["title"] == name]
|
tmp = [lst for lst in lists if lst["title"] == name]
|
||||||
if tmp:
|
if tmp:
|
||||||
return tmp[0]["id"]
|
return tmp[0]["id"]
|
||||||
return None
|
return None
|
||||||
|
@ -101,7 +101,7 @@ def mean_int(*args):
|
|||||||
|
|
||||||
def mean_tuple(*args):
|
def mean_tuple(*args):
|
||||||
"""Return the mean values along the columns of the supplied values."""
|
"""Return the mean values along the columns of the supplied values."""
|
||||||
return tuple(sum(l) / len(l) for l in zip(*args))
|
return tuple(sum(x) / len(x) for x in zip(*args))
|
||||||
|
|
||||||
|
|
||||||
def reduce_attribute(
|
def reduce_attribute(
|
||||||
|
@ -69,7 +69,7 @@ def print_relevant_docs(template: str, info: Info) -> None:
|
|||||||
print()
|
print()
|
||||||
|
|
||||||
print(
|
print(
|
||||||
f"The next step is to look at the files and deal with all areas marked as TODO."
|
"The next step is to look at the files and deal with all areas marked as TODO."
|
||||||
)
|
)
|
||||||
|
|
||||||
if "extra" in data:
|
if "extra" in data:
|
||||||
|
@ -189,8 +189,8 @@ async def test_setup_race_condition(hass):
|
|||||||
|
|
||||||
# Set up some mock feed entries for this test.
|
# Set up some mock feed entries for this test.
|
||||||
mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 15.5, (-31.0, 150.0))
|
mock_entry_1 = _generate_mock_feed_entry("1234", "Title 1", 15.5, (-31.0, 150.0))
|
||||||
delete_signal = f"geo_json_events_delete_1234"
|
delete_signal = "geo_json_events_delete_1234"
|
||||||
update_signal = f"geo_json_events_update_1234"
|
update_signal = "geo_json_events_update_1234"
|
||||||
|
|
||||||
# Patching 'utcnow' to gain more control over the timed update.
|
# Patching 'utcnow' to gain more control over the timed update.
|
||||||
utcnow = dt_util.utcnow()
|
utcnow = dt_util.utcnow()
|
||||||
|
@ -138,7 +138,7 @@ async def test_success(hass, login_requests_mock):
|
|||||||
login_requests_mock.request(
|
login_requests_mock.request(
|
||||||
ANY,
|
ANY,
|
||||||
f"{FIXTURE_USER_INPUT[CONF_URL]}api/user/login",
|
f"{FIXTURE_USER_INPUT[CONF_URL]}api/user/login",
|
||||||
text=f"<response>OK</response>",
|
text="<response>OK</response>",
|
||||||
)
|
)
|
||||||
result = await hass.config_entries.flow.async_init(
|
result = await hass.config_entries.flow.async_init(
|
||||||
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT
|
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT
|
||||||
|
@ -68,12 +68,12 @@ USER_INPUT_IPV6 = {
|
|||||||
|
|
||||||
USER_INPUT_PORT_TOO_SMALL = {
|
USER_INPUT_PORT_TOO_SMALL = {
|
||||||
CONF_NAME: DEFAULT_NAME,
|
CONF_NAME: DEFAULT_NAME,
|
||||||
CONF_HOST: f"mc.dummyserver.com:1023",
|
CONF_HOST: "mc.dummyserver.com:1023",
|
||||||
}
|
}
|
||||||
|
|
||||||
USER_INPUT_PORT_TOO_LARGE = {
|
USER_INPUT_PORT_TOO_LARGE = {
|
||||||
CONF_NAME: DEFAULT_NAME,
|
CONF_NAME: DEFAULT_NAME,
|
||||||
CONF_HOST: f"mc.dummyserver.com:65536",
|
CONF_HOST: "mc.dummyserver.com:65536",
|
||||||
}
|
}
|
||||||
|
|
||||||
SRV_RECORDS = asyncio.Future()
|
SRV_RECORDS = asyncio.Future()
|
||||||
|
@ -61,7 +61,7 @@ async def test_scan_not_all_present(hass, aioclient_mock):
|
|||||||
"""Test match fails if some specified attributes are not present."""
|
"""Test match fails if some specified attributes are not present."""
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
"http://1.1.1.1",
|
"http://1.1.1.1",
|
||||||
text=f"""
|
text="""
|
||||||
<root>
|
<root>
|
||||||
<device>
|
<device>
|
||||||
<deviceType>Paulus</deviceType>
|
<deviceType>Paulus</deviceType>
|
||||||
@ -96,7 +96,7 @@ async def test_scan_not_all_match(hass, aioclient_mock):
|
|||||||
"""Test match fails if some specified attribute values differ."""
|
"""Test match fails if some specified attribute values differ."""
|
||||||
aioclient_mock.get(
|
aioclient_mock.get(
|
||||||
"http://1.1.1.1",
|
"http://1.1.1.1",
|
||||||
text=f"""
|
text="""
|
||||||
<root>
|
<root>
|
||||||
<device>
|
<device>
|
||||||
<deviceType>Paulus</deviceType>
|
<deviceType>Paulus</deviceType>
|
||||||
|
@ -139,7 +139,7 @@ async def test_remove_older_logs(hass, hass_client):
|
|||||||
|
|
||||||
def log_msg(nr=2):
|
def log_msg(nr=2):
|
||||||
"""Log an error at same line."""
|
"""Log an error at same line."""
|
||||||
_LOGGER.error(f"error message %s", nr)
|
_LOGGER.error("error message %s", nr)
|
||||||
|
|
||||||
|
|
||||||
async def test_dedup_logs(hass, hass_client):
|
async def test_dedup_logs(hass, hass_client):
|
||||||
|
@ -32,12 +32,12 @@ def init(empty=False):
|
|||||||
if empty
|
if empty
|
||||||
else {
|
else {
|
||||||
"arm_code": MockAlarm(
|
"arm_code": MockAlarm(
|
||||||
name=f"Alarm arm code",
|
name="Alarm arm code",
|
||||||
code_arm_required=True,
|
code_arm_required=True,
|
||||||
unique_id="unique_arm_code",
|
unique_id="unique_arm_code",
|
||||||
),
|
),
|
||||||
"no_arm_code": MockAlarm(
|
"no_arm_code": MockAlarm(
|
||||||
name=f"Alarm no arm code",
|
name="Alarm no arm code",
|
||||||
code_arm_required=False,
|
code_arm_required=False,
|
||||||
unique_id="unique_no_arm_code",
|
unique_id="unique_no_arm_code",
|
||||||
),
|
),
|
||||||
|
@ -29,29 +29,29 @@ def init(empty=False):
|
|||||||
if empty
|
if empty
|
||||||
else [
|
else [
|
||||||
MockCover(
|
MockCover(
|
||||||
name=f"Simple cover",
|
name="Simple cover",
|
||||||
is_on=True,
|
is_on=True,
|
||||||
unique_id=f"unique_cover",
|
unique_id="unique_cover",
|
||||||
supports_tilt=False,
|
supports_tilt=False,
|
||||||
),
|
),
|
||||||
MockCover(
|
MockCover(
|
||||||
name=f"Set position cover",
|
name="Set position cover",
|
||||||
is_on=True,
|
is_on=True,
|
||||||
unique_id=f"unique_set_pos_cover",
|
unique_id="unique_set_pos_cover",
|
||||||
current_cover_position=50,
|
current_cover_position=50,
|
||||||
supports_tilt=False,
|
supports_tilt=False,
|
||||||
),
|
),
|
||||||
MockCover(
|
MockCover(
|
||||||
name=f"Set tilt position cover",
|
name="Set tilt position cover",
|
||||||
is_on=True,
|
is_on=True,
|
||||||
unique_id=f"unique_set_pos_tilt_cover",
|
unique_id="unique_set_pos_tilt_cover",
|
||||||
current_cover_tilt_position=50,
|
current_cover_tilt_position=50,
|
||||||
supports_tilt=True,
|
supports_tilt=True,
|
||||||
),
|
),
|
||||||
MockCover(
|
MockCover(
|
||||||
name=f"Tilt cover",
|
name="Tilt cover",
|
||||||
is_on=True,
|
is_on=True,
|
||||||
unique_id=f"unique_tilt_cover",
|
unique_id="unique_tilt_cover",
|
||||||
supports_tilt=True,
|
supports_tilt=True,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -19,13 +19,13 @@ def init(empty=False):
|
|||||||
if empty
|
if empty
|
||||||
else {
|
else {
|
||||||
"support_open": MockLock(
|
"support_open": MockLock(
|
||||||
name=f"Support open Lock",
|
name="Support open Lock",
|
||||||
is_locked=True,
|
is_locked=True,
|
||||||
supported_features=SUPPORT_OPEN,
|
supported_features=SUPPORT_OPEN,
|
||||||
unique_id="unique_support_open",
|
unique_id="unique_support_open",
|
||||||
),
|
),
|
||||||
"no_support_open": MockLock(
|
"no_support_open": MockLock(
|
||||||
name=f"No support open Lock",
|
name="No support open Lock",
|
||||||
is_locked=True,
|
is_locked=True,
|
||||||
supported_features=0,
|
supported_features=0,
|
||||||
unique_id="unique_no_support_open",
|
unique_id="unique_no_support_open",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user