Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion homeassistant/auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ class AuthFlowContext(FlowContext, total=False):
redirect_uri: str


AuthFlowResult = FlowResult[AuthFlowContext, tuple[str, str]]
class AuthFlowResult(FlowResult[AuthFlowContext, tuple[str, str]], total=False):
"""Typed result dict for auth flow."""

result: Credentials # Only present if type is CREATE_ENTRY


@attr.s(slots=True)
Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/auth/login_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ async def _async_flow_result_to_response(
result.pop("data")
result.pop("context")

result_obj: Credentials = result.pop("result")
result_obj = result.pop("result")

# Result can be None if credential was never linked to a user before.
user = await hass.auth.async_get_user_by_credentials(result_obj)
Expand All @@ -281,7 +281,8 @@ async def _async_flow_result_to_response(
)

process_success_login(request)
result["result"] = self._store_result(client_id, result_obj)
# We overwrite the Credentials object with the string code to retrieve it.
result["result"] = self._store_result(client_id, result_obj) # type: ignore[typeddict-item]

return self.json(result)

Expand Down
5 changes: 3 additions & 2 deletions homeassistant/components/config/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ def _prepare_config_flow_result_json(
return prepare_result_json(result)

data = result.copy()
entry: config_entries.ConfigEntry = data["result"]
data["result"] = entry.as_json_fragment
entry: config_entries.ConfigEntry = data["result"] # type: ignore[typeddict-item]
# We overwrite the ConfigEntry object with its json representation.
data["result"] = entry.as_json_fragment # type: ignore[typeddict-unknown-key]
data.pop("data")
data.pop("context")
return data
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/growatt_server/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"documentation": "https://www.home-assistant.io/integrations/growatt_server",
"iot_class": "cloud_polling",
"loggers": ["growattServer"],
"requirements": ["growattServer==1.6.0"]
"requirements": ["growattServer==1.7.1"]
}
2 changes: 0 additions & 2 deletions homeassistant/components/repairs/issue_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ async def async_finish_flow(
"""
if result.get("type") != data_entry_flow.FlowResultType.ABORT:
ir.async_delete_issue(self.hass, flow.handler, flow.init_data["issue_id"])
if "result" not in result:
result["result"] = None
return result


Expand Down
2 changes: 1 addition & 1 deletion homeassistant/components/xiaomi_ble/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
"dependencies": ["bluetooth_adapters"],
"documentation": "https://www.home-assistant.io/integrations/xiaomi_ble",
"iot_class": "local_push",
"requirements": ["xiaomi-ble==1.1.0"]
"requirements": ["xiaomi-ble==1.2.0"]
}
4 changes: 2 additions & 2 deletions homeassistant/config_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,10 @@ class ConfigFlowContext(FlowContext, total=False):
class ConfigFlowResult(FlowResult[ConfigFlowContext, str], total=False):
"""Typed result dict for config flow."""

# Extra keys, only present if type is CREATE_ENTRY
minor_version: int
options: Mapping[str, Any]
result: ConfigEntry
subentries: Iterable[ConfigSubentryData]
version: int

Expand Down Expand Up @@ -3345,7 +3347,6 @@ async def async_finish_flow(
),
)

result["result"] = True
return result


Expand Down Expand Up @@ -3508,7 +3509,6 @@ async def async_finish_flow(
):
self.hass.config_entries.async_schedule_reload(entry.entry_id)

result["result"] = True
return result

async def _async_setup_preview(
Expand Down
1 change: 0 additions & 1 deletion homeassistant/data_entry_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ class FlowResult(TypedDict, Generic[_FlowContextT, _HandlerT], total=False):
progress_task: asyncio.Task[Any] | None
reason: str
required: bool
result: Any
step_id: str
title: str
translation_domain: str
Expand Down
2 changes: 1 addition & 1 deletion homeassistant/helpers/data_entry_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _prepare_result_json(
"""Convert result to JSON."""
if result["type"] == data_entry_flow.FlowResultType.CREATE_ENTRY:
data = result.copy()
data.pop("result")
assert "result" not in result
data.pop("data")
data.pop("context")
return data
Expand Down
4 changes: 2 additions & 2 deletions requirements_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions requirements_test_all.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion tests/components/cloud/test_repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ async def test_legacy_subscription_repair_flow_timeout(
"handler": "cloud",
"reason": "operation_took_too_long",
"description_placeholders": None,
"result": None,
}

assert issue_registry.async_get_issue(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# ---
# name: test_options[create_entry]
FlowResultSnapshot({
'result': True,
'type': <FlowResultType.CREATE_ENTRY: 'create_entry'>,
})
# ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
# ---
# name: test_options[create_entry]
FlowResultSnapshot({
'result': True,
'type': <FlowResultType.CREATE_ENTRY: 'create_entry'>,
})
# ---
Expand Down
1 change: 0 additions & 1 deletion tests/components/hassio/test_repairs.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,6 @@ async def test_mount_failed_repair_flow_error(
"flow_id": flow_id,
"handler": "hassio",
"reason": "apply_suggestion_fail",
"result": None,
"description_placeholders": None,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ async def mock_async_step_pick_firmware_zigbee(self, data):
)

assert create_result["type"] is FlowResultType.CREATE_ENTRY
assert create_result["result"] is True

assert config_entry.data == {
"firmware": "ezsp",
Expand Down
1 change: 0 additions & 1 deletion tests/components/homeassistant_yellow/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,6 @@ async def mock_install_firmware_step(
)

assert create_result["type"] is FlowResultType.CREATE_ENTRY
assert create_result["result"] is True

assert config_entry.data == {
"firmware": fw_type.value,
Expand Down
1 change: 0 additions & 1 deletion tests/components/jewish_calendar/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ async def test_options_reconfigure(
CONF_CANDLE_LIGHT_MINUTES: DEFAULT_CANDLE_LIGHT + 1,
},
)
assert result["result"]

# The value of the "upcoming_shabbat_candle_lighting" sensor should be the new value
assert config_entry.options[CONF_CANDLE_LIGHT_MINUTES] == DEFAULT_CANDLE_LIGHT + 1
Expand Down
1 change: 0 additions & 1 deletion tests/components/repairs/test_websocket_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ async def test_fix_issue_aborted(
"handler": "fake_integration",
"reason": "not_given",
"description_placeholders": None,
"result": None,
}

await ws_client.send_json({"id": 4, "type": "repairs/list_issues"})
Expand Down
Loading