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

Fix partial in enum for Python 3.13 #1993

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

cdce8p
Copy link
Contributor

@cdce8p cdce8p commented Dec 14, 2024

Fix Deprecation warning emitted by Python 3.13.1.

functools.partial will be a method descriptor in future Python versions;
wrap it in enum.member() if you want to preserve the old behavior

Ref: python/cpython#125316

Copy link

codecov bot commented Dec 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.26%. Comparing base (edb06c5) to head (a657a8d).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1993   +/-   ##
=======================================
  Coverage   82.26%   82.26%           
=======================================
  Files         197      197           
  Lines       19139    19144    +5     
  Branches     1050     1052    +2     
=======================================
+ Hits        15744    15749    +5     
  Misses       3218     3218           
  Partials      177      177           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@rytilahti rytilahti left a comment

Choose a reason for hiding this comment

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

Thanks @cdce8p, looks rather straight-forward! As this is only affecting the cli tool, I'm ready to merge it even though I haven't been able to test it against a real device.

Before doing that, should the check be against >=3.13 instead of 3.11, though?

@rytilahti rytilahti added the bug label Jan 4, 2025
@cdce8p
Copy link
Contributor Author

cdce8p commented Jan 4, 2025

As this is only affecting the cli tool, I'm ready to merge it even though I haven't been able to test it against a real device.

Not sure about that. It has been a while but AFAIR I first saw the DeprecationWarning in the Home Assistant test suite.

Before doing that, should the check be against >=3.13 instead of 3.11, though?

Enum.member is available since 3.11 and from what I've read on the cpython issue, it's the "correct" way to do it anyway.

@rytilahti
Copy link
Owner

Fair enough, IIRC, this was just a hack to make the cli nicer to use, so if it doesn't work will need to revisit it (e.g., by converting away from the enum to simply use a dict for mapping).

@rytilahti rytilahti merged commit 0aa4df3 into rytilahti:master Jan 4, 2025
25 of 26 checks passed
@cdce8p cdce8p deleted the fix-partial-3.13 branch January 4, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test_set_property_by[value_type4-1] fails on Python 3.13
2 participants