From 7ae852e5edf8cf22a9f20a10b3e069f8cfa5bce1 Mon Sep 17 00:00:00 2001 From: Joost Lekkerkerker Date: Thu, 14 Mar 2024 10:43:03 +0100 Subject: [PATCH] Enable ISC ruff rule (#113270) --- homeassistant/components/actiontec/const.py | 6 +++--- homeassistant/components/aruba/device_tracker.py | 4 ++-- homeassistant/components/kostal_plenticore/helper.py | 6 ++++-- homeassistant/components/picnic/config_flow.py | 2 +- homeassistant/components/xiaomi/device_tracker.py | 2 +- pyproject.toml | 2 +- tests/components/hddtemp/test_sensor.py | 6 +++--- tests/components/html5/test_notify.py | 8 +++++--- tests/components/imap/const.py | 6 +++--- tests/components/tts/test_init.py | 2 +- 10 files changed, 24 insertions(+), 20 deletions(-) diff --git a/homeassistant/components/actiontec/const.py b/homeassistant/components/actiontec/const.py index af28b0abb41..beff47f9811 100644 --- a/homeassistant/components/actiontec/const.py +++ b/homeassistant/components/actiontec/const.py @@ -9,7 +9,7 @@ from typing import Final LEASES_REGEX: Final[re.Pattern[str]] = re.compile( r"(?P([0-9]{1,3}[\.]){3}[0-9]{1,3})" - + r"\smac:\s(?P([0-9a-f]{2}[:-]){5}([0-9a-f]{2}))" - + r"\svalid\sfor:\s(?P(-?\d+))" - + r"\ssec" + r"\smac:\s(?P([0-9a-f]{2}[:-]){5}([0-9a-f]{2}))" + r"\svalid\sfor:\s(?P(-?\d+))" + r"\ssec" ) diff --git a/homeassistant/components/aruba/device_tracker.py b/homeassistant/components/aruba/device_tracker.py index 35053233428..dd94a5975f0 100644 --- a/homeassistant/components/aruba/device_tracker.py +++ b/homeassistant/components/aruba/device_tracker.py @@ -23,8 +23,8 @@ _LOGGER = logging.getLogger(__name__) _DEVICES_REGEX = re.compile( r"(?P([^\s]+)?)\s+" - + r"(?P([0-9]{1,3}[\.]){3}[0-9]{1,3})\s+" - + r"(?P([0-9a-f]{2}[:-]){5}([0-9a-f]{2}))\s+" + r"(?P([0-9]{1,3}[\.]){3}[0-9]{1,3})\s+" + r"(?P([0-9a-f]{2}[:-]){5}([0-9a-f]{2}))\s+" ) PLATFORM_SCHEMA = PARENT_PLATFORM_SCHEMA.extend( diff --git a/homeassistant/components/kostal_plenticore/helper.py b/homeassistant/components/kostal_plenticore/helper.py index d9117625d19..4a4e6539f03 100644 --- a/homeassistant/components/kostal_plenticore/helper.py +++ b/homeassistant/components/kostal_plenticore/helper.py @@ -101,8 +101,10 @@ class Plenticore: manufacturer="Kostal", model=f"{prod1} {prod2}", name=settings["scb:network"][hostname_id], - sw_version=f'IOC: {device_local["Properties:VersionIOC"]}' - + f' MC: {device_local["Properties:VersionMC"]}', + sw_version=( + f'IOC: {device_local["Properties:VersionIOC"]}' + f' MC: {device_local["Properties:VersionMC"]}' + ), ) return True diff --git a/homeassistant/components/picnic/config_flow.py b/homeassistant/components/picnic/config_flow.py index 1900f39306d..9712286b554 100644 --- a/homeassistant/components/picnic/config_flow.py +++ b/homeassistant/components/picnic/config_flow.py @@ -68,7 +68,7 @@ async def validate_input(hass: HomeAssistant, data): # Return the validation result address = ( f'{user_data["address"]["street"]} {user_data["address"]["house_number"]}' - + f'{user_data["address"]["house_number_ext"]}' + f'{user_data["address"]["house_number_ext"]}' ) return auth_token, { "title": address, diff --git a/homeassistant/components/xiaomi/device_tracker.py b/homeassistant/components/xiaomi/device_tracker.py index f50d67a01b4..76227d89e94 100644 --- a/homeassistant/components/xiaomi/device_tracker.py +++ b/homeassistant/components/xiaomi/device_tracker.py @@ -168,7 +168,7 @@ def _get_token(host, username, password): except KeyError: error_message = ( "Xiaomi token cannot be refreshed, response from " - + "url: [%s] \nwith parameter: [%s] \nwas: [%s]" + "url: [%s] \nwith parameter: [%s] \nwas: [%s]" ) _LOGGER.exception(error_message, url, data, result) return diff --git a/pyproject.toml b/pyproject.toml index bcfcfbc4a4b..e6ee50f1a3f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -594,6 +594,7 @@ select = [ "F", # pyflakes/autoflake "G", # flake8-logging-format "I", # isort + "ISC", # flake8-implicit-str-concat "ICN001", # import concentions; {name} should be imported as {asname} "N804", # First argument of a class method should be named cls "N805", # First argument of a method should be named self @@ -681,7 +682,6 @@ ignore = [ "COM812", "COM819", "ISC001", - "ISC002", # Disabled because ruff does not understand type of __all__ generated by a function "PLE0605", diff --git a/tests/components/hddtemp/test_sensor.py b/tests/components/hddtemp/test_sensor.py index 170f30eae37..eac6d4c4053 100644 --- a/tests/components/hddtemp/test_sensor.py +++ b/tests/components/hddtemp/test_sensor.py @@ -67,9 +67,9 @@ class TelnetMock: self.timeout = timeout self.sample_data = bytes( "|/dev/sda1|WDC WD30EZRX-12DC0B0|29|C|" - + "|/dev/sdb1|WDC WD15EADS-11P7B2|32|C|" - + "|/dev/sdc1|WDC WD20EARX-22MMMB0|29|C|" - + "|/dev/sdd1|WDC WD15EARS-00Z5B1|89|F|", + "|/dev/sdb1|WDC WD15EADS-11P7B2|32|C|" + "|/dev/sdc1|WDC WD20EARX-22MMMB0|29|C|" + "|/dev/sdd1|WDC WD15EARS-00Z5B1|89|F|", "ascii", ) diff --git a/tests/components/html5/test_notify.py b/tests/components/html5/test_notify.py index 1d87603fe67..6763708cc38 100644 --- a/tests/components/html5/test_notify.py +++ b/tests/components/html5/test_notify.py @@ -17,9 +17,11 @@ CONFIG_FILE = "file.conf" VAPID_CONF = { "platform": "html5", - "vapid_pub_key": "BJMA2gDZEkHaXRhf1fhY_" - + "QbKbhVIHlSJXI0bFyo0eJXnUPOjdgycCAbj-2bMKMKNKs" - + "_rM8JoSnyKGCXAY2dbONI", + "vapid_pub_key": ( + "BJMA2gDZEkHaXRhf1fhY_" + "QbKbhVIHlSJXI0bFyo0eJXnUPOjdgycCAbj-2bMKMKNKs" + "_rM8JoSnyKGCXAY2dbONI" + ), "vapid_prv_key": "ZwPgwKpESGuGLMZYU39vKgrekrWzCijo-LsBM3CZ9-c", "vapid_email": "someone@example.com", } diff --git a/tests/components/imap/const.py b/tests/components/imap/const.py index 8ec5e258059..677eea7a473 100644 --- a/tests/components/imap/const.py +++ b/tests/components/imap/const.py @@ -101,7 +101,7 @@ TEST_CONTENT_HTML_BASE64 = ( TEST_CONTENT_MULTIPART = ( b"\r\nThis is a multi-part message in MIME format.\r\n" - + b"\r\n--Mark=_100584970350292485166\r\n" + b"\r\n--Mark=_100584970350292485166\r\n" + TEST_CONTENT_TEXT_PLAIN + b"\r\n--Mark=_100584970350292485166\r\n" + TEST_CONTENT_HTML @@ -110,7 +110,7 @@ TEST_CONTENT_MULTIPART = ( TEST_CONTENT_MULTIPART_BASE64 = ( b"\r\nThis is a multi-part message in MIME format.\r\n" - + b"\r\n--Mark=_100584970350292485166\r\n" + b"\r\n--Mark=_100584970350292485166\r\n" + TEST_CONTENT_TEXT_BASE64 + b"\r\n--Mark=_100584970350292485166\r\n" + TEST_CONTENT_HTML_BASE64 @@ -119,7 +119,7 @@ TEST_CONTENT_MULTIPART_BASE64 = ( TEST_CONTENT_MULTIPART_BASE64_INVALID = ( b"\r\nThis is a multi-part message in MIME format.\r\n" - + b"\r\n--Mark=_100584970350292485166\r\n" + b"\r\n--Mark=_100584970350292485166\r\n" + TEST_CONTENT_TEXT_BASE64_INVALID + b"\r\n--Mark=_100584970350292485166\r\n" + TEST_CONTENT_HTML_BASE64 diff --git a/tests/components/tts/test_init.py b/tests/components/tts/test_init.py index cbf18fe8771..aae61e69a54 100644 --- a/tests/components/tts/test_init.py +++ b/tests/components/tts/test_init.py @@ -1308,7 +1308,7 @@ async def test_tags_with_wave() -> None: # below data represents an empty wav file tts_data = bytes.fromhex( "52 49 46 46 24 00 00 00 57 41 56 45 66 6d 74 20 10 00 00 00 01 00 02 00" - + "22 56 00 00 88 58 01 00 04 00 10 00 64 61 74 61 00 00 00 00" + "22 56 00 00 88 58 01 00 04 00 10 00 64 61 74 61 00 00 00 00" ) tagged_data = ORIG_WRITE_TAGS(