-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
fix: small code review fix #14756
fix: small code review fix #14756
Conversation
Codecov Report
@@ Coverage Diff @@
## master #14756 +/- ##
=======================================
Coverage 77.52% 77.52%
=======================================
Files 960 960
Lines 48819 48819
Branches 6120 6120
=======================================
Hits 37847 37847
Misses 10769 10769
Partials 203 203
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -297,7 +297,7 @@ def get_filters(self, column: str, remove_filter: bool = False) -> List[Filter]: | |||
filters: List[Filter] = [] | |||
|
|||
for flt in form_data.get("adhoc_filters", []): | |||
val: Union[str, List[str]] = flt.get("comparator") | |||
val: Union[Any, List[Any]] = flt.get("comparator") |
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.
does this need to be Any
? Maybe there's a more precise type we can use here. What values are expected for the comparator?
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.
If we want to be fully explicit, I believe the full type would be Union[bool, str, int, float, List[bool], List[str], List[int], List[float]]
, but that feels slightly verbose. Could potentially be shortened by introducing an alias FilterValue = bool, str, int, float
and then doing Union[FilterValue, List[FilterValue]]
, but even that feels kinda stuffy. However, I'd personally vote for keeping it Any
for now.
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.
LGTM - I think we can follow up with more explicit types later when we get around to properly introducing TypedDict
.
@@ -297,7 +297,7 @@ def get_filters(self, column: str, remove_filter: bool = False) -> List[Filter]: | |||
filters: List[Filter] = [] | |||
|
|||
for flt in form_data.get("adhoc_filters", []): | |||
val: Union[str, List[str]] = flt.get("comparator") | |||
val: Union[Any, List[Any]] = flt.get("comparator") |
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.
If we want to be fully explicit, I believe the full type would be Union[bool, str, int, float, List[bool], List[str], List[int], List[float]]
, but that feels slightly verbose. Could potentially be shortened by introducing an alias FilterValue = bool, str, int, float
and then doing Union[FilterValue, List[FilterValue]]
, but even that feels kinda stuffy. However, I'd personally vote for keeping it Any
for now.
Co-authored-by: cccs-jc <cccs-jc@cyber.gc.ca>
Co-authored-by: cccs-jc <cccs-jc@cyber.gc.ca>
Co-authored-by: cccs-jc <cccs-jc@cyber.gc.ca>
just fixing typing