Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type hint improvements #32905

Merged
merged 2 commits into from
Mar 18, 2020
Merged

Type hint improvements #32905

merged 2 commits into from
Mar 18, 2020

Conversation

scop
Copy link
Member

@scop scop commented Mar 17, 2020

Proposed change

Completes helpers.entity_component, adds discovery info type.

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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

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

@probot-home-assistant
Copy link

Hey there @eifinger, mind taking a look at this pull request as its been labeled with a integration (here_travel_time) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link

Hey there @TomerFi, mind taking a look at this pull request as its been labeled with a integration (switcher_kis) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link

Hey there @raman325, mind taking a look at this pull request as its been labeled with a integration (vizio) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link

Hey there @ctalkington, mind taking a look at this pull request as its been labeled with a integration (directv) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link

Hey there @robbiet480, mind taking a look at this pull request as its been labeled with a integration (gtfs) you are listed as a codeowner for? Thanks!

@probot-home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as its been labeled with a integration (zone) you are listed as a codeowner for? Thanks!

Copy link
Contributor

@ctalkington ctalkington left a comment

Choose a reason for hiding this comment

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

directv looks good

Copy link
Contributor

@raman325 raman325 left a comment

Choose a reason for hiding this comment

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

didn't know this was available as a type, thanks!

@TomerFi
Copy link
Contributor

TomerFi commented Mar 17, 2020

Sorry...
I accidentally approved the pr while I was reviewing the switcher_kis modification.
I don't see any way to undo it.

@eifinger
Copy link
Contributor

here_travel_time is okay

@@ -318,7 +319,7 @@ def __init__(self) -> None:
return await self.async_step_user(user_input=import_config)

async def async_step_zeroconf(
self, discovery_info: Dict[str, Any] = None
self, discovery_info: Optional[DiscoveryInfoType] = None
Copy link
Member

Choose a reason for hiding this comment

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

The discovery info sent by the zeroconf integration is different than the ones sent by integrations to their own platforms. Should we still use this? Can't wait for TypedDict to be part of all our supported versions.

Copy link
Member

Choose a reason for hiding this comment

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

TypedDict is backported via typing-extensions package.

https://pypi.org/project/typing-extensions/

It's one more dependency though.

Copy link
Member Author

Choose a reason for hiding this comment

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

We could take the current lack of TypedDict as an opportunity to try and recognize+convert cases where a NamedTuple would do.

domain: self._async_init_entity_platform(domain, None)
}
self._platforms: Dict[
Union[str, Tuple[str, Optional[timedelta], Optional[str]]], EntityPlatform
Copy link
Member

Choose a reason for hiding this comment

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

timedelta can be part of the key?

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see now.

@scop scop merged commit 05abf37 into home-assistant:dev Mar 18, 2020
@scop scop deleted the typing branch March 18, 2020 17:27
@lock lock bot locked and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants