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

Change how we search for attributes #91

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

evalott100
Copy link
Contributor

@evalott100 evalott100 commented Nov 25, 2024

Closes #89

@evalott100 evalott100 marked this pull request as draft November 25, 2024 14:16
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.75%. Comparing base (35b1870) to head (f45ac5c).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #91      +/-   ##
==========================================
+ Coverage   87.60%   87.75%   +0.14%     
==========================================
  Files          28       28              
  Lines        1170     1184      +14     
==========================================
+ Hits         1025     1039      +14     
  Misses        145      145              

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

@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch from 7e66f35 to a02b447 Compare November 26, 2024 13:43
@evalott100 evalott100 changed the title WIP Change how we search for attributes Nov 26, 2024
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch from a02b447 to 8a0c003 Compare November 26, 2024 14:31
@evalott100 evalott100 marked this pull request as ready for review November 26, 2024 14:31
@evalott100 evalott100 requested a review from GDYendell November 26, 2024 14:32
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch 2 times, most recently from 779073f to 0edc27c Compare November 26, 2024 15:08
@evalott100 evalott100 marked this pull request as draft November 26, 2024 15:51
@evalott100
Copy link
Contributor Author

Will make this a draft while I write docs and make branches on eiger and odin.

Copy link
Contributor

@GDYendell GDYendell left a comment

Choose a reason for hiding this comment

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

I think it might be nicer to add these attributes to an _attributes member dict in __init__ rather than have a getter and then manually adding them to the member attribute on access. All the messy logic of searching through dir(), checking for clashes and filtering of root_attribute could be done in one place (_bind_attrs) instead of in Mapping.

It also occurs to me that we aren't gaining anything by making root_attribute a property, because we still have to check for "root_attribute" anyway. So, maybe it could just be a class member on SubController with default None.

Thoughts?

@evalott100
Copy link
Contributor Author

I think it might be nicer to add these attributes to an _attributes member dict in init rather than have a getter

I agree this would definitely be nicer, still not containing any of the attributes defined globally in the class though.

It also occurs to me that we aren't gaining anything by making root_attribute a property, because we still have to check for "root_attribute" anyway. So, maybe it could just be a class member on SubController with default None.

Would also probably be nicer. We would still have to filter it out when searching through all the attributes on the type(controller).

@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch 2 times, most recently from da21c22 to 8110e2e Compare December 2, 2024 11:22
@evalott100 evalott100 requested a review from GDYendell December 2, 2024 11:23
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch from 8110e2e to 6489767 Compare December 2, 2024 11:24
@evalott100 evalott100 marked this pull request as ready for review December 2, 2024 11:24
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch 3 times, most recently from 6756c68 to 4d09743 Compare December 2, 2024 11:54
src/fastcs/controller.py Outdated Show resolved Hide resolved
src/fastcs/controller.py Outdated Show resolved Hide resolved
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch from 4d09743 to 817d7da Compare December 4, 2024 11:12
@evalott100 evalott100 requested a review from GDYendell December 4, 2024 11:13
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch from 817d7da to 5243d6a Compare December 4, 2024 11:15
`root_attribute` is parsed on `register_sub_controller`
@evalott100 evalott100 force-pushed the 89-change-how-we-search-for-attributes branch from 5243d6a to f45ac5c Compare December 4, 2024 11:17
@GDYendell GDYendell merged commit baebfaa into main Dec 4, 2024
17 checks passed
@GDYendell GDYendell deleted the 89-change-how-we-search-for-attributes branch December 4, 2024 13:55
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.

Proposal for changing how we search for attributes
2 participants