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

Add pylint rule for cached_property #127482

Merged
merged 5 commits into from
Oct 3, 2024
Merged

Add pylint rule for cached_property #127482

merged 5 commits into from
Oct 3, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Oct 3, 2024

Proposed change

#127339 (review)

Add pylint rule for cached_property to use the faster propcache version

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
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format 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.

To help with the load of incoming pull requests:

@home-assistant home-assistant bot added cla-signed Hacktoberfest small-pr PRs with less than 30 lines. labels Oct 3, 2024
pylint/plugins/hass_imports.py Outdated Show resolved Hide resolved
@bdraco bdraco requested a review from epenet October 3, 2024 18:20
@bdraco
Copy link
Member Author

bdraco commented Oct 3, 2024

rule will likely need an exclude for the legacy one in backports

@epenet
Copy link
Contributor

epenet commented Oct 3, 2024

rule will likely need an exclude for the legacy one in backports

And a couple more:

************* Module homeassistant.config_entries
Warning: homeassistant/config_entries.py:21:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)
Warning: homeassistant/config_entries.py:21:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)
************* Module homeassistant.helpers.template
Warning: homeassistant/helpers/template.py:13:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)
Warning: homeassistant/helpers/template.py:13:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)

@bdraco
Copy link
Member Author

bdraco commented Oct 3, 2024

rule will likely need an exclude for the legacy one in backports

And a couple more:

************* Module homeassistant.config_entries
Warning: homeassistant/config_entries.py:21:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)
Warning: homeassistant/config_entries.py:21:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)
************* Module homeassistant.helpers.template
Warning: homeassistant/helpers/template.py:13:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)
Warning: homeassistant/helpers/template.py:13:0: W7422: cached_property is deprecated, replaced by propcache.cached_property (hass-deprecated-import)

Will address after #127441 since template changes will conflict

bdraco added a commit that referenced this pull request Oct 3, 2024
@bdraco
Copy link
Member Author

bdraco commented Oct 3, 2024

config entries won't conflict so I did that one now #127495

@bdraco
Copy link
Member Author

bdraco commented Oct 3, 2024

Probably need ignores for the backport code since we don't want to change that as we will remove it soon

@bdraco
Copy link
Member Author

bdraco commented Oct 3, 2024

test_new_device_discovered

AssertionError: assert 24 == 0
 +  where 24 = <AsyncMock name='Host().logout' spec='function' id='139853400510048'>.call_count
 +    where <AsyncMock name='Host().logout' spec='function' id='139853400510048'> = <NonCallableMagicMock name='Host()' spec='Host' id='139853287704144'>.logout

test failure is unrelated

@bdraco bdraco marked this pull request as ready for review October 3, 2024 22:53
@bdraco bdraco requested a review from a team as a code owner October 3, 2024 22:53
@bdraco
Copy link
Member Author

bdraco commented Oct 3, 2024

thanks

@bdraco bdraco merged commit 6eb4999 into dev Oct 3, 2024
39 of 40 checks passed
@bdraco bdraco deleted the pylint_cached branch October 3, 2024 22:53
@github-actions github-actions bot locked and limited conversation to collaborators Oct 4, 2024
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.

3 participants