You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
extends the function to work with individual recordings and dicts of. The function signature and name are set to match the class and provided name. This could cause mismatches in the naming.
This PR uses a trick to add the new wrapped function directly to the caller module.
Related to #4319 : I suggest we do the same for define_funtction_from_class (already 2 mismatches found!!!) and use the pyi approach that Graham suggested to make IDEs happy.
Sorry it took me a while to get to this! I was on vacation :)
I looked up sys._get_frame to understand how this works, and noticed the following warning:
CPython implementation detail: This function should be used for internal and specialized purposes only. It is not guaranteed to exist in all implementations of Python.
It's probably safe to assume that the vast majority of users are running Python, but I don't know that for a fact, and it does make me leery.
I do see the rationale behind this trick, though.
I think there might be a better solution than .pyi approach that I outlined in #4319 that could solve both this issue (i.e. would give a single source of truth for both the exported function name and the function's __name__) and the static analysis issue. I will write it up in #4319.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
coreChanges to core modulerefactorRefactor of code, with no change to functionality
2 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Having something like:
extends the function to work with individual recordings and dicts of. The function signature and name are set to match the class and provided
name. This could cause mismatches in the naming.This PR uses a trick to add the new wrapped function directly to the caller module.
Related to #4319 : I suggest we do the same for
define_funtction_from_class(already 2 mismatches found!!!) and use thepyiapproach that Graham suggested to make IDEs happy.@chrishalcrow @grahamfindlay thoughts?