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
chore: Mypy fix **kwargs type #15823
chore: Mypy fix **kwargs type #15823
Conversation
@@ -683,7 +683,7 @@ def data_from_cache(self, cache_key: str) -> Response: | |||
f".cache_screenshot", | |||
log_to_statsd=False, | |||
) | |||
def cache_screenshot(self, pk: int, **kwargs: Dict[str, bool]) -> WerkzeugResponse: | |||
def cache_screenshot(self, pk: int, **kwargs: Any) -> WerkzeugResponse: |
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.
The bool
is incorrect given the logic below,
rison_dict = kwargs["rison"]
window_size = rison_dict.get("window_size")
i.e., clearly the type of the kwargs
value (rison_dict
) is of type Dict[str, ...]
rather than bool
.
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.
can we maybe move rison_dict to named arg and get rid of kwargs?
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.
999d930
to
0f9d05b
Compare
Codecov Report
@@ Coverage Diff @@
## master #15823 +/- ##
==========================================
- Coverage 76.91% 76.89% -0.02%
==========================================
Files 984 984
Lines 51662 51622 -40
Branches 6991 6991
==========================================
- Hits 39736 39697 -39
+ Misses 11702 11701 -1
Partials 224 224
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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
Co-authored-by: John Bodley <john.bodley@airbnb.com>
Co-authored-by: John Bodley <john.bodley@airbnb.com>
Co-authored-by: John Bodley <john.bodley@airbnb.com>
Co-authored-by: John Bodley <john.bodley@airbnb.com>
SUMMARY
A follow up to #15757 (comment), per the Mypy documentation,
though
kwargs
is aDict[str, ...]
the typing of**kwargs
is actually the dictionary value type.TESTING INSTRUCTIONS
CI. Found all violations by running
git grep "**kwargs: Dict"
.ADDITIONAL INFORMATION