-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat!: do not auto convert enums to values for fetching attrs #138
Conversation
The attrgetters no longer auto convert enums to their values These objects are str enums so convert should not be needed
WalkthroughThe recent update focuses on streamlining the codebase by removing the Changes
Poem
Tip AI model upgrade
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- src/uiprotect/init.py (2 hunks)
- src/uiprotect/utils.py (2 hunks)
- tests/test_utils.py (4 hunks)
Files skipped from review due to trivial changes (1)
- src/uiprotect/init.py
Additional comments not posted (6)
tests/test_utils.py (1)
221-221
: LGTM!The change to directly compare the result with
_MockEnum.C
aligns with the PR objective to stop automatic conversion of enums to values.src/uiprotect/utils.py (5)
637-637
: LGTM!The change to remove unnecessary checks for Enum types aligns with the PR objective to stop automatic conversion of enums to values.
646-646
: LGTM!The change to remove unnecessary checks for Enum types aligns with the PR objective to stop automatic conversion of enums to values.
651-651
: LGTM!The change to directly return the boolean value of the attribute aligns with the PR objective to stop automatic conversion of enums to values.
657-657
: LGTM!The change to use
attrgetter
for top-level attributes andget_nested_attr
for nested attributes aligns with the PR objective to stop automatic conversion of enums to values.
651-651
: LGTM!The change to use
get_top_level_attr_as_bool
for top-level attributes andget_nested_attr_as_bool
for nested attributes aligns with the PR objective to stop automatic conversion of enums to values.
Description of change
The attrgetters no longer auto convert enums to their values
The objects we care about are str enums so convert should not be needed
I may have missed one but if so we can make a new function for it so we don't have to do the enum check for a case where 99%+ of the time is not needed (sometimes 10000+/min)
Summary by CodeRabbit
Refactor
get_top_level_attr
function from the public interface to streamline functionality.get_nested_attr
andget_nested_attr_as_bool
functions for improved performance.Tests
get_top_level_attr
references and adjusting assertions forget_nested_attr
and boolean checks.