Skip to content

Commit ff76017

Browse files
authored
Simplify unnecessary re match.groups()[0] calls (home-assistant#147909)
1 parent f10fcde commit ff76017

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

homeassistant/components/sonos/favorites.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ async def async_process_event(
7575
if not (match := re.search(r"FV:2,(\d+)", container_ids)):
7676
return
7777

78-
container_id = int(match.groups()[0])
78+
container_id = int(match.group(1))
7979
event_id = int(event_id.split(",")[-1])
8080

8181
async with self.cache_update_lock:

pylint/plugins/hass_enforce_type_hints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3241,7 +3241,7 @@ def _get_module_platform(module_name: str) -> str | None:
32413241
# Or `homeassistant.components.<component>.<platform>`
32423242
return None
32433243

3244-
platform = module_match.groups()[0]
3244+
platform = module_match.group(1)
32453245
return platform.lstrip(".") if platform else "__init__"
32463246

32473247

pylint/plugins/hass_inheritance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def _get_module_platform(module_name: str) -> str | None:
1818
# Or `homeassistant.components.<component>.<platform>`
1919
return None
2020

21-
platform = module_match.groups()[0]
21+
platform = module_match.group(1)
2222
return platform.lstrip(".") if platform else "__init__"
2323

2424

script/hassfest/translations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def find_references(
9898
continue
9999

100100
if match := re.match(RE_REFERENCE, value):
101-
found.append({"source": f"{prefix}::{key}", "ref": match.groups()[0]})
101+
found.append({"source": f"{prefix}::{key}", "ref": match.group(1)})
102102

103103

104104
def removed_title_validator(
@@ -570,7 +570,7 @@ def validate_translation_file(
570570
"translations",
571571
"Lokalise supports only one level of references: "
572572
f'"{reference["source"]}" should point to directly '
573-
f'to "{match.groups()[0]}"',
573+
f'to "{match.group(1)}"',
574574
)
575575

576576

0 commit comments

Comments
 (0)