Skip to content

Commit

Permalink
fix: fix typo in in_progress_instances (#2541)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
danielbrunt57 and pre-commit-ci[bot] authored Sep 21, 2024
1 parent 263a92b commit 5b26cd3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
import voluptuous as vol

from .alexa_entity import AlexaEntityData, get_entity_data, parse_alexa_entities
from .config_flow import in_progess_instances
from .config_flow import in_progress_instances
from .const import (
ALEXA_COMPONENTS,
CONF_ACCOUNTS,
Expand Down Expand Up @@ -1451,7 +1451,7 @@ async def test_login_status(hass, config_entry, login) -> bool:
if login.status and login.status.get("login_successful"):
return True
account = config_entry.data
_LOGGER.debug("Logging in: %s %s", obfuscate(account), in_progess_instances(hass))
_LOGGER.debug("Logging in: %s %s", obfuscate(account), in_progress_instances(hass))
_LOGGER.debug("Login stats: %s", login.stats)
message: str = (
f"Reauthenticate {login.email} on the [Integrations](/config/integrations) page. "
Expand All @@ -1470,7 +1470,7 @@ async def test_login_status(hass, config_entry, login) -> bool:
f"{account[CONF_EMAIL]} - {account[CONF_URL]}"
)
if flow:
if flow.get("flow_id") in in_progess_instances(hass):
if flow.get("flow_id") in in_progress_instances(hass):
_LOGGER.debug("Existing config flow detected")
return False
_LOGGER.debug("Stopping orphaned config flow %s", flow.get("flow_id"))
Expand Down
10 changes: 7 additions & 3 deletions custom_components/alexa_media/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,13 @@ def configured_instances(hass):


@callback
def in_progess_instances(hass):
"""Return a set of in progress Alexa Media flows."""
return {entry["flow_id"] for entry in hass.config_entries.flow.async_progress()}
def in_progress_instances(hass):
"""Return a set of in-progress Alexa Media flows."""
return {
entry["flow_id"]
for entry in hass.config_entries.flow.async_progress()
if entry["handler"] == DOMAIN # Ensure only Alexa Media flows are included
}


@config_entries.HANDLERS.register(DOMAIN)
Expand Down

0 comments on commit 5b26cd3

Please sign in to comment.