Repository: home-assistant/core
File: homeassistant/components/nrgkick/config_flow.py (Python)

Code before:
        )

    async def async_step_user_auth(
        self, user_input: dict[str, Any] | None = None
    ) -> ConfigFlowResult:
        """Handle the authentication step only when needed."""
        errors: dict[str, str] = {}

        if TYPE_CHECKING:
            assert self._pending_host is not None

        if user_input is not None:
            if info := await self._async_validate_credentials(
                self._pending_host,
                errors,
                username=user_input.get(CONF_USERNAME),
                password=user_input.get(CONF_PASSWORD),
            ):
                await self.async_set_unique_id(info["serial"], raise_on_progress=False)
                self._abort_if_unique_id_configured()
                return self.async_create_entry(
                    title=info["title"],
                    data={
                        CONF_HOST: self._pending_host,
                        CONF_USERNAME: user_input.get(CONF_USERNAME),
                        CONF_PASSWORD: user_input.get(CONF_PASSWORD),
                    },
                )

        return self.async_show_form(
            step_id="user_auth",
            data_schema=STEP_AUTH_DATA_SCHEMA,
            errors=errors,
            description_placeholders={
                "device_ip": self._pending_host,
            },
        )

    async def async_step_reauth(
        self, entry_data: Mapping[str, Any]
    ) -> ConfigFlowResult:
        """Handle initiation of reauthentication."""
        return await self.async_step_reauth_confirm()

    async def async_step_reauth_confirm(
        self, user_input: dict[str, Any] | None = None
    ) -> ConfigFlowResult:
        """Handle reauthentication."""
        errors: dict[str, str] = {}

        if user_input is not None:

Review comment (suggestion):
```suggestion
                        CONF_USERNAME: user_input[CONF_USERNAME],
                        CONF_PASSWORD: user_input[CONF_PASSWORD],
```
those are required fields, no need to get them

Code after:
        )

    async def async_step_user_auth(
        self, user_input: dict[str, Any] | None = None
    ) -> ConfigFlowResult:
        """Handle the authentication step only when needed."""
        errors: dict[str, str] = {}

        if TYPE_CHECKING:
            assert self._pending_host is not None

        if user_input is not None:
            if info := await self._async_validate_credentials(
                self._pending_host,
                errors,
                username=user_input[CONF_USERNAME],
                password=user_input[CONF_PASSWORD],
            ):
                await self.async_set_unique_id(info["serial"], raise_on_progress=False)
                self._abort_if_unique_id_configured()
                return self.async_create_entry(
                    title=info["title"],
                    data={
                        CONF_HOST: self._pending_host,
                        CONF_USERNAME: user_input[CONF_USERNAME],
                        CONF_PASSWORD: user_input[CONF_PASSWORD],
                    },
                )

        return self.async_show_form(
            step_id="user_auth",
            data_schema=STEP_AUTH_DATA_SCHEMA,
            errors=errors,
            description_placeholders={
                "device_ip": self._pending_host,
            },
        )

    async def async_step_reauth(
        self, entry_data: Mapping[str, Any]
    ) -> ConfigFlowResult:
        """Handle initiation of reauthentication."""
        return await self.async_step_reauth_confirm()

    async def async_step_reauth_confirm(
        self, user_input: dict[str, Any] | None = None
    ) -> ConfigFlowResult:
        """Handle reauthentication."""
        errors: dict[str, str] = {}

        if user_input is not None: