Add access_mode property to Attribute classes (#260)#307
Merged
Conversation
Resolves #260 by adding an access_mode property to Attribute and its subclasses, replacing the need for the _attribute_to_access() free function. The property returns "r" for AttrR, "w" for AttrW, and "rw" for AttrRW, providing a cleaner API for determining attribute access modes. - Add AttributeAccessMode type definition to attribute.py - Make Attribute class abstract with abstract access_mode property - Implement access_mode property in AttrR, AttrW, and AttrRW - Export AttributeAccessMode from attributes module - Replace _attribute_to_access() function usage in PVA PVI code - Remove _attribute_to_access() function and TODO comment - Add unit test for the new access_mode property All tests and type checking pass. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #307 +/- ##
==========================================
+ Coverage 90.69% 90.78% +0.09%
==========================================
Files 70 70
Lines 2535 2540 +5
==========================================
+ Hits 2299 2306 +7
+ Misses 236 234 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
shihab-dls
approved these changes
Jan 21, 2026
Contributor
shihab-dls
left a comment
There was a problem hiding this comment.
Wow, simple issue, but I'm getting red-pilled by Claude. Looks good, approving.
GDYendell
commented
Jan 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Resolves #260 by adding an
access_modeproperty to the Attribute class hierarchy, replacing the_attribute_to_access()free function.Changes
AttributeAccessModetype definition (Literal["r", "w", "rw"]) to the attributes moduleAttributeclass abstract with an abstractaccess_modepropertyaccess_modein all attribute subclasses:AttrR: returns"r"AttrW: returns"w"AttrRW: returns"rw"AttributeAccessModefrom the attributes module_attribute_to_access()function usage in PVA PVI code with the new property_attribute_to_access()function and its TODO commentTest plan
tox -e tests)tox -e type-checking)test_attribute_access_mode()verifies the property returns correct valuesBackward Compatibility
This change is fully backward compatible:
_attribute_to_access()function was internal only, never part of public API🤖 Generated with Claude Code