Skip to content

Conversation

@GDYendell
Copy link
Contributor

Summary

Resolves #260 by adding an access_mode property to the Attribute class hierarchy, replacing the _attribute_to_access() free function.

Changes

  • Add AttributeAccessMode type definition (Literal["r", "w", "rw"]) to the attributes module
  • Make the Attribute class abstract with an abstract access_mode property
  • Implement access_mode in all attribute subclasses:
    • AttrR: returns "r"
    • AttrW: returns "w"
    • AttrRW: returns "rw"
  • Export AttributeAccessMode from the attributes module
  • Replace the _attribute_to_access() function usage in PVA PVI code with the new property
  • Remove the _attribute_to_access() function and its TODO comment
  • Add unit test to verify the property works correctly on all attribute types

Test plan

  • ✅ All existing tests pass (tox -e tests)
  • ✅ Type checking passes (tox -e type-checking)
  • ✅ New test added: test_attribute_access_mode() verifies the property returns correct values
  • ✅ PVA PVI code successfully uses the property instead of the function

Backward Compatibility

This change is fully backward compatible:

  • Only adds new functionality (property)
  • Does not remove or change any public API
  • The _attribute_to_access() function was internal only, never part of public API

🤖 Generated with Claude Code

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
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.78%. Comparing base (e8d59fb) to head (664a900).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@GDYendell GDYendell requested a review from shihab-dls January 20, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add AccessMode to Attribute

2 participants