mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
Simplify unnecessary re match.groups()[0] calls (#147909)
This commit is contained in:
parent
f10fcde6d8
commit
ff76017ba6
@ -75,7 +75,7 @@ class SonosFavorites(SonosHouseholdCoordinator):
|
|||||||
if not (match := re.search(r"FV:2,(\d+)", container_ids)):
|
if not (match := re.search(r"FV:2,(\d+)", container_ids)):
|
||||||
return
|
return
|
||||||
|
|
||||||
container_id = int(match.groups()[0])
|
container_id = int(match.group(1))
|
||||||
event_id = int(event_id.split(",")[-1])
|
event_id = int(event_id.split(",")[-1])
|
||||||
|
|
||||||
async with self.cache_update_lock:
|
async with self.cache_update_lock:
|
||||||
|
@ -3241,7 +3241,7 @@ def _get_module_platform(module_name: str) -> str | None:
|
|||||||
# Or `homeassistant.components.<component>.<platform>`
|
# Or `homeassistant.components.<component>.<platform>`
|
||||||
return None
|
return None
|
||||||
|
|
||||||
platform = module_match.groups()[0]
|
platform = module_match.group(1)
|
||||||
return platform.lstrip(".") if platform else "__init__"
|
return platform.lstrip(".") if platform else "__init__"
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ def _get_module_platform(module_name: str) -> str | None:
|
|||||||
# Or `homeassistant.components.<component>.<platform>`
|
# Or `homeassistant.components.<component>.<platform>`
|
||||||
return None
|
return None
|
||||||
|
|
||||||
platform = module_match.groups()[0]
|
platform = module_match.group(1)
|
||||||
return platform.lstrip(".") if platform else "__init__"
|
return platform.lstrip(".") if platform else "__init__"
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ def find_references(
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if match := re.match(RE_REFERENCE, value):
|
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(
|
def removed_title_validator(
|
||||||
@ -570,7 +570,7 @@ def validate_translation_file(
|
|||||||
"translations",
|
"translations",
|
||||||
"Lokalise supports only one level of references: "
|
"Lokalise supports only one level of references: "
|
||||||
f'"{reference["source"]}" should point to directly '
|
f'"{reference["source"]}" should point to directly '
|
||||||
f'to "{match.groups()[0]}"',
|
f'to "{match.group(1)}"',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user