Skip to content

Cleanup DiscoveryFlowHandler#59576

Closed
epenet wants to merge 1 commit intohome-assistant:devfrom
epenet:cleanup-discovery
Closed

Cleanup DiscoveryFlowHandler#59576
epenet wants to merge 1 commit intohome-assistant:devfrom
epenet:cleanup-discovery

Conversation

@epenet
Copy link
Copy Markdown
Contributor

@epenet epenet commented Nov 12, 2021

Proposed change

Cleanup DiscoveryFlowHandler method redefinitions (async_step_zeroconf, async_step_ssdp, async_step_mqtt, async_step_homekit, async_step_dhcp) which seem redundant with the inherited definitions in ConfigFlow.

These redefinitions are causing mypy inheritance issues when working on #59503.
See the failed run https://github.com/home-assistant/core/runs/4167772127?check_suite_focus=true#step:7:12

Also see home-assistant/architecture#663

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant probot-home-assistant bot added code-quality core small-pr PRs with less than 30 lines. labels Nov 12, 2021
@epenet epenet marked this pull request as ready for review November 12, 2021 10:12
@epenet epenet requested a review from a team as a code owner November 12, 2021 10:12
@epenet
Copy link
Copy Markdown
Contributor Author

epenet commented Nov 12, 2021

The base class methods are here:

async def async_step_homekit(
self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by Homekit discovery."""
return await self.async_step_discovery(discovery_info)

async def async_step_mqtt(
self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by MQTT discovery."""
return await self.async_step_discovery(discovery_info)

async def async_step_ssdp(
self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by SSDP discovery."""
return await self.async_step_discovery(discovery_info)

async def async_step_zeroconf(
self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by Zeroconf discovery."""
return await self.async_step_discovery(discovery_info)

async def async_step_dhcp(
self, discovery_info: DiscoveryInfoType
) -> data_entry_flow.FlowResult:
"""Handle a flow initialized by DHCP discovery."""
return await self.async_step_discovery(discovery_info)

@Kane610
Copy link
Copy Markdown
Member

Kane610 commented Nov 12, 2021

Is this a breaking change for custom components?


return await self.async_step_confirm()

async_step_zeroconf = async_step_discovery
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These need to be here because async_step_discovery logic needs to be assigned to all these discovery steps. It's not assigning the same thing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@balloob I have marked this as draft for now.
It was linked to PR 59503 - maybe you can take a look at this comment?
#59503 (comment)

@epenet epenet marked this pull request as draft November 12, 2021 21:54
@epenet
Copy link
Copy Markdown
Contributor Author

epenet commented Nov 15, 2021

I am closing this following the discussions on #59503 (comment)

@epenet epenet closed this Nov 15, 2021
@epenet epenet deleted the cleanup-discovery branch November 15, 2021 19:03
@github-actions github-actions bot locked and limited conversation to collaborators Nov 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants