Address new issues flagged by flake8 3.8.0a2 (#34964)

This commit is contained in:
Ville Skyttä 2020-04-30 22:37:58 +03:00 committed by GitHub
parent bf5cc22bef
commit 435a88636a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 28 additions and 25 deletions

View File

@ -65,6 +65,7 @@ class DiscordNotificationService(BaseNotificationService):
images.append(image)
else:
_LOGGER.warning("Image not found: %s", image)
# pylint: disable=unused-variable
@discord_bot.event
async def on_ready():

View File

@ -326,7 +326,7 @@ def _mean_int(*args):
def _mean_tuple(*args):
"""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(

View File

@ -59,7 +59,9 @@ def setup(hass, config):
"Streamlabs Water Monitor auto-detected location_id=%s", location_id
)
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:
_LOGGER.error("Supplied location_id is invalid")
return False

View File

@ -85,7 +85,7 @@ class Wunderlist:
def _list_by_name(self, name):
"""Return a list ID by name."""
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:
return tmp[0]["id"]
return None

View File

@ -101,7 +101,7 @@ def mean_int(*args):
def mean_tuple(*args):
"""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(

View File

@ -69,7 +69,7 @@ def print_relevant_docs(template: str, info: Info) -> None:
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:

View File

@ -189,8 +189,8 @@ async def test_setup_race_condition(hass):
# 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))
delete_signal = f"geo_json_events_delete_1234"
update_signal = f"geo_json_events_update_1234"
delete_signal = "geo_json_events_delete_1234"
update_signal = "geo_json_events_update_1234"
# Patching 'utcnow' to gain more control over the timed update.
utcnow = dt_util.utcnow()

View File

@ -138,7 +138,7 @@ async def test_success(hass, login_requests_mock):
login_requests_mock.request(
ANY,
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(
DOMAIN, context={"source": config_entries.SOURCE_USER}, data=FIXTURE_USER_INPUT

View File

@ -68,12 +68,12 @@ USER_INPUT_IPV6 = {
USER_INPUT_PORT_TOO_SMALL = {
CONF_NAME: DEFAULT_NAME,
CONF_HOST: f"mc.dummyserver.com:1023",
CONF_HOST: "mc.dummyserver.com:1023",
}
USER_INPUT_PORT_TOO_LARGE = {
CONF_NAME: DEFAULT_NAME,
CONF_HOST: f"mc.dummyserver.com:65536",
CONF_HOST: "mc.dummyserver.com:65536",
}
SRV_RECORDS = asyncio.Future()

View File

@ -61,7 +61,7 @@ async def test_scan_not_all_present(hass, aioclient_mock):
"""Test match fails if some specified attributes are not present."""
aioclient_mock.get(
"http://1.1.1.1",
text=f"""
text="""
<root>
<device>
<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."""
aioclient_mock.get(
"http://1.1.1.1",
text=f"""
text="""
<root>
<device>
<deviceType>Paulus</deviceType>

View File

@ -139,7 +139,7 @@ async def test_remove_older_logs(hass, hass_client):
def log_msg(nr=2):
"""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):

View File

@ -32,12 +32,12 @@ def init(empty=False):
if empty
else {
"arm_code": MockAlarm(
name=f"Alarm arm code",
name="Alarm arm code",
code_arm_required=True,
unique_id="unique_arm_code",
),
"no_arm_code": MockAlarm(
name=f"Alarm no arm code",
name="Alarm no arm code",
code_arm_required=False,
unique_id="unique_no_arm_code",
),

View File

@ -29,29 +29,29 @@ def init(empty=False):
if empty
else [
MockCover(
name=f"Simple cover",
name="Simple cover",
is_on=True,
unique_id=f"unique_cover",
unique_id="unique_cover",
supports_tilt=False,
),
MockCover(
name=f"Set position cover",
name="Set position cover",
is_on=True,
unique_id=f"unique_set_pos_cover",
unique_id="unique_set_pos_cover",
current_cover_position=50,
supports_tilt=False,
),
MockCover(
name=f"Set tilt position cover",
name="Set tilt position cover",
is_on=True,
unique_id=f"unique_set_pos_tilt_cover",
unique_id="unique_set_pos_tilt_cover",
current_cover_tilt_position=50,
supports_tilt=True,
),
MockCover(
name=f"Tilt cover",
name="Tilt cover",
is_on=True,
unique_id=f"unique_tilt_cover",
unique_id="unique_tilt_cover",
supports_tilt=True,
),
]

View File

@ -19,13 +19,13 @@ def init(empty=False):
if empty
else {
"support_open": MockLock(
name=f"Support open Lock",
name="Support open Lock",
is_locked=True,
supported_features=SUPPORT_OPEN,
unique_id="unique_support_open",
),
"no_support_open": MockLock(
name=f"No support open Lock",
name="No support open Lock",
is_locked=True,
supported_features=0,
unique_id="unique_no_support_open",