-
Notifications
You must be signed in to change notification settings - Fork 11
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
Refactor BRFLD #217
Refactor BRFLD #217
Conversation
MayberryZoom
commented
Aug 31, 2024
- Renames layer arguments to sublayer
- Adds argument to select layer
- Renames some methods to reflect this
- Makes argument naming convention consistent
for more information, see https://pre-commit.ci
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #217 +/- ##
==========================================
+ Coverage 75.54% 76.33% +0.79%
==========================================
Files 78 78
Lines 3766 3782 +16
==========================================
+ Hits 2845 2887 +42
+ Misses 921 895 -26 ☔ View full report in Codecov by Sentry. |
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.
some immediate thoughts: there should be an enum for layer, since it's always exactly the same three options. also, maybe the layer name should be kwarg-only? as-is the order of the args is kinda confusing. could also just swap em and break all the signatures I suppose
I'm not sure about this. In my head it makes the most logical sense to have the actor layer argument first, but most of the time you're going to be working with the entities layer specifically, so you'll only be using sublayer. If sublayer is positional and actor layer is keyword, is there really a point in making it keyword only? Or did you mean make both sublayer and actor layer kwarg only? I honestly think it's fine as is. It's a bit funky but it should make sense when you're actually using the functions. And in practice it'll be easiest to work with, with the bonus of not breaking all the signatures. |
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.
Also update tests/formats/test_brfld.py
to fix the codecov stuff
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.
I'll second the tests request
I added a new method for adding an actor to actor groups that doesn't assume the prefix |
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.
Seems fine overall, but I'll leave for @duncathan to do a final say.
Things that would be neat, especially since we're polishing this up:
- docstrings for the changed methods
- tests for the other methods as well, such as
remove_actor_from_group
Ah except for the part where the tests are failing. |
Yeah, I just saw that there's a test failing. I'll fix it soon and see if I can get on some of those other improvements. |
You could add a value to the enum for @classmethod
def __new__(cls, value: str, prefix: str):
member = super.__new__(cls, value)
member.cc_prefix = prefix
return member (might wanna cc @henriquegemignani / @duncathan to check if that should be new or init, i'm not sure if it's "pythonic" or whatever lmao) |
Honestly, you should probably just be using the prefix when you call the method anyways. Assuming it is really only marginally more readable, while removing some of the library's power. If those 3-4 characters are really too much for someone utilizing this library, they should just subclass or write their own function to do it IMO. |
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci