-
Notifications
You must be signed in to change notification settings - Fork 15
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: fix signature inspection on debounced/throttled, update typing and wrapped #228
Conversation
CodSpeed Performance ReportMerging #228 will not alter performanceComparing Summary
|
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #228 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 22 22
Lines 1809 1829 +20
=========================================
+ Hits 1809 1829 +20
☔ 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.
Looks good to me!
@@ -27,9 +30,18 @@ def __init__( | |||
self._args: tuple[Any, ...] = () | |||
self._kwargs: dict[str, Any] = {} | |||
|
|||
# this mimics what functools.wraps does, but avoids __dict__ usage and other | |||
# things that won't work with mypyc... HOWEVER, most of these dynamic |
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.
By won't work, I guess you mean that mypyc will just ignore these? But won't error?
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.
correct. __doc__
will be None
on mypyc... (i.e. it won't update the doc on the instance itself)
in mypyc's words: "
inspect.signature
chokes on compiled functions"... which is a bummer for throttled/debounced if we're going to use them as callbacks (which is their main goal).This PR fixes napari/napari#6149 (comment) by telling inspect.signature how to get to the wrapped function. I think it should be good enough, but if more problems arise, we can just skip mypyc compilation on these modules.
cc @andy-sweet
edit: i just decided not to compile that module for now.