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

Correct return typing for catch_log_exception #78399

Merged
merged 3 commits into from
Sep 17, 2022

Conversation

jbouwh
Copy link
Contributor

@jbouwh jbouwh commented Sep 13, 2022

Proposed change

Correct return type for logging util catch_log_exception

See #77972 (comment)

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)
  • Deprecation (breaking change to happen in the future)
  • 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:

@jbouwh jbouwh requested a review from a team as a code owner September 13, 2022 17:19
@probot-home-assistant probot-home-assistant bot added code-quality core small-pr PRs with less than 30 lines. labels Sep 13, 2022
@jbouwh jbouwh requested a review from cdce8p September 13, 2022 17:20
@jbouwh jbouwh closed this Sep 13, 2022
@jbouwh jbouwh reopened this Sep 13, 2022
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

The change itself looks good. I'd just like to wait until #77972 is merged to investigate if this actually resolves the mypy issue.

@cdce8p cdce8p self-assigned this Sep 13, 2022
homeassistant/util/logging.py Outdated Show resolved Hide resolved
@jbouwh
Copy link
Contributor Author

jbouwh commented Sep 14, 2022

The change itself looks good. I'd just like to wait until #77972 is merged to investigate if this actually resolves the mypy issue.

I did some testing and it indeed takes away the mypy error. An alternative would be that if this PR gets merged first, then the typing in #77972 does not need to be changed:

https://github.com/home-assistant/core/pull/77972/files#diff-6104fc3fa32da922a306affdf3ac8882f9e4d2f89d78970724e0f164d5b1fd6cL250

homeassistant/util/logging.py Outdated Show resolved Hide resolved
homeassistant/util/logging.py Outdated Show resolved Hide resolved
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

See #78399 (comment) for the reason behind the suggested changes

homeassistant/util/logging.py Outdated Show resolved Hide resolved
homeassistant/util/logging.py Outdated Show resolved Hide resolved
homeassistant/util/logging.py Outdated Show resolved Hide resolved
homeassistant/util/logging.py Outdated Show resolved Hide resolved
Copy link
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

Thanks, @jbouwh 👍🏻

@cdce8p cdce8p merged commit 35221e9 into home-assistant:dev Sep 17, 2022
jbouwh added a commit to jbouwh/core that referenced this pull request Sep 17, 2022
jbouwh added a commit that referenced this pull request Sep 17, 2022
* Use dataclass to reference hass.data globals

* Add discovery_registry_hooks to dataclass

* Move discovery registry hooks to dataclass

* Add device triggers to dataclass

* Cleanup DEVICE_TRIGGERS const

* Add last_discovery to data_class

* Simplify typing for class `Subscription`

* Follow up on comment

* Redo suggested typing change to sasisfy mypy

* Restore typing

* Add mypy version to CI check logging

* revert changes to ci.yaml

* Add docstr for protocol

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>

* Mypy update after merging #78399

* Remove mypy ignore

* Correct return type

Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2022
@frenck frenck added this to the 2022.9.6 milestone Sep 22, 2022
@jbouwh jbouwh deleted the typing-log-helper branch September 22, 2022 08:26
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.

6 participants