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
DM-35818: Fix and refactor various actions #26
Conversation
9ff7d57
to
e31308f
Compare
b445684
to
27b6f3b
Compare
27b6f3b
to
a9cabae
Compare
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.
Just a few small comments and suggestions.
from .selectors import RangeSelector | ||
|
||
|
||
class CalcBinnedStatsAction(KeyedDataAction): |
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.
Your mixed use of snake and camel case variables in this class is confusing. Please pick an animal and stick with it :). In the case of this package, it looks like camel case is the default.
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.
Well, I guess I don't know how to politely tell everyone else that they're wrong because the dev guide says snake_case should be the default in primarily new code, which this package definitely is (and analysis_drp was too). None of it should have been written in camelCase in the first place.
) | ||
|
||
@cached_property | ||
def name_count(self): |
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 prefer countName
(and the same with maskName
, medianName
, etc), but if you feel strongly its ok to leave as nameCount
etc.
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 decided to stick with snake_case (someone can yell at me later about it). But this one I always find tricky. Our classes will always be CamelCase, and it seems reasonable to say camelCase = CamelCase() # variable
. But when you have N different things of the same logical type, I find it more convenient to have them prefixed and sorted by that type. Unfortunately, I think both name_count
and count_name
are potentially ambiguous depending on the convention (is it the name of the count or the count of a name?), so... 🤷🏼
@@ -163,6 +164,34 @@ def setDefaults(self): | |||
] | |||
|
|||
|
|||
class RangeSelector(VectorAction): |
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 wonder if maximum
and minimum
should allow for None
values. For example, if maximum
is None
then this would act as a threshold selector, only setting a lower bound; and if minimum
is None
then this would act as a ceiling selector.
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 had a reason for not putting in defaults, but I couldn't remember it, so I added them.
1b0cbd8
to
af59bb8
Compare
af59bb8
to
729886d
Compare
No description provided.