Simplify unnecessary re match.groups()[0] calls (#147909)

This commit is contained in:
Ville Skyttä 2025-07-02 12:12:26 +00:00 committed by GitHub
parent f10fcde6d8
commit ff76017ba6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View File

@ -75,7 +75,7 @@ class SonosFavorites(SonosHouseholdCoordinator):
if not (match := re.search(r"FV:2,(\d+)", container_ids)):
return
container_id = int(match.groups()[0])
container_id = int(match.group(1))
event_id = int(event_id.split(",")[-1])
async with self.cache_update_lock:

View File

@ -3241,7 +3241,7 @@ def _get_module_platform(module_name: str) -> str | None:
# Or `homeassistant.components.<component>.<platform>`
return None
platform = module_match.groups()[0]
platform = module_match.group(1)
return platform.lstrip(".") if platform else "__init__"

View File

@ -18,7 +18,7 @@ def _get_module_platform(module_name: str) -> str | None:
# Or `homeassistant.components.<component>.<platform>`
return None
platform = module_match.groups()[0]
platform = module_match.group(1)
return platform.lstrip(".") if platform else "__init__"

View File

@ -98,7 +98,7 @@ def find_references(
continue
if match := re.match(RE_REFERENCE, value):
found.append({"source": f"{prefix}::{key}", "ref": match.groups()[0]})
found.append({"source": f"{prefix}::{key}", "ref": match.group(1)})
def removed_title_validator(
@ -570,7 +570,7 @@ def validate_translation_file(
"translations",
"Lokalise supports only one level of references: "
f'"{reference["source"]}" should point to directly '
f'to "{match.groups()[0]}"',
f'to "{match.group(1)}"',
)