-
-
Notifications
You must be signed in to change notification settings - Fork 289
Fix pep8 compatibility code (fixes #501) #507
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
Conversation
* When using the `replaced_by_pep8` decorator with a different method signature for simplicity, as the real signature is generated by the decorator, some static checkers might find false positive errors when calling pyparsing code (see issue pyparsing#501). * Refactor the calls for the compatibility code to not use the `replaced_by_pep8` decorator but calling directly the `_make_synonym_function` function to generate the synonym methods/functions. * This way the signature of the method/function is automatically copied and the static checkers will not report false positives.
Thanks - I'm reluctant to drop the Just wanted to make you aware of some of the other issues around this topic. |
@ptmcg when possible let me know what are your thoughts on this |
Thanks for verifying that the doc gen behavior is preserved. I'm not sure why I wrapped This is a lot simpler of a change if we just rename Lastly, now that the wrapper is gone, the DeprecationWarnings (which are still comments, but hopefully won't be for much longer) currently use stacklevel=3 assuming this would be called in the wrapper function - now that that is being removed, please change to stacklevel=2, so that I don't forget to when I eventually enable these. |
@@ -275,10 +275,3 @@ def _inner(*args, **kwargs): | |||
_inner.__kwdefaults__ = None | |||
_inner.__qualname__ = fn.__qualname__ | |||
return cast(C, _inner) | |||
|
|||
|
|||
def replaced_by_pep8(fn: C) -> Callable[[Callable], C]: |
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.
Instead of deleting this and changing all the references to directly reference _make_synonym_function
, please just rename _make_synonym_function
to replaced_by_pep8
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.
Also, please change the commented line 263 to "stacklevel=2", so that I don't forget later when I uncomment this code.
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.
Thanks for the review, I should have addressed your comments in the last commit.
* Rename the `_make_synonym_function` function to `replaced_by_pep8` for clarity. * Reduce the stacklevel of the commented out deprecation warnings accordingly.
@ptmcg Is there anything else missing that I should add/change in this pull request? |
I think this all looks good. Thanks for your patience and diligence. |
replaced_by_pep8
decorator with a different method signature for simplicity, as the real signature is generated by the decorator, some static checkers might find false positive errors when calling pyparsing code (see issue Pylint errors on Pyparsing v3.1.0 with old-style method/argument names #501).replaced_by_pep8
decorator but calling directly the_make_synonym_function
function to generate the synonym methods/functions.