-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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: proper TypeError handling in memoize decorator #16074
Conversation
Codecov Report
@@ Coverage Diff @@
## master #16074 +/- ##
==========================================
- Coverage 76.86% 76.64% -0.23%
==========================================
Files 995 995
Lines 52876 52882 +6
Branches 6720 6720
==========================================
- Hits 40645 40531 -114
- Misses 12005 12125 +120
Partials 226 226
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
thanks, updated PR with lint fixes. I haven't run the lints locally yet though since I hasn't figured out how to do that yet. |
We're using the pre-commit python package to run checks. you can set this up to run automatically or you can run it manually against all staged files with |
@sabiroid FYI documentation on pre-commit / setting that up: https://github.com/apache/superset/blob/master/CONTRIBUTING.md#git-hooks |
I am actually not sure why this integration test is failing now. |
Update: I've set integration tests up. It actually fails 15 out of 48 tests on both this PR and its base revision, so this PR is not actually breaking any new tests. |
rerunning CI |
I've seen that all failed integration tests did so because of timeouts. So I updated the PR to re-throw the |
💪 💪 💪 - congrats on your first PR @sabiroid ! |
Co-authored-by: Victor Sadkov <victor.sadkov@cloudkitchens.com>
Co-authored-by: Victor Sadkov <victor.sadkov@cloudkitchens.com>
SUMMARY
There are several issues with the
memoize
decorator:TypeError
s from within the memoized functionif key in self.cache
before thetry/catch
block raisingTypeError
already.This PR fixes aforementioned issues:
value
variable regardless of the caching success statustry/catch
blocks.As an alternative, we can also remove the
try/catch
altogether to throw explicitly. I won't be against that, especially since original behavior was already shadowed by uncaught dictionary reference.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
n/a
TESTING INSTRUCTIONS
I ran Superset locally and checked the memoization is still working. It is!
ADDITIONAL INFORMATION