-
Notifications
You must be signed in to change notification settings - Fork 109
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
Example use of refactor / RefactoringNormalizer #174
Comments
Duplicate of #165. For now please read the code and maybe contribute the documentation. I probably won't do it. |
IMO it's pretty obvious what happens if you read the code: A |
The decorated functions use the tree symbol 'decorated', so you also have to handle it (just like how you handle 'funcdef'). For the rest of the symbols, you can check the grammar or use |
Thanks @isidentical - that worked well enough for me. @davidhalter, that makes sense. Thanks for pointing me to the duplicate. Just wanted to make sure I wasn't reinventing the wheel. (It looks like, as |
@vtjeng I don't think so, but maybe I don't quite understand. |
Do you have an example of the
refactor
function or theRefactoringNormalizer
in use? I've tried searching in GitHub for examples (RefactoringNormalizer
,parso refactor
) but all that seems to come up is copies of your source code that others have included in their repos.(I've read #67, but figured I should start a new thread with a more accurate title).
My specific use case is that I'd like to delete a particular named function from my code. Here's what I've come up with
Calling
FunctionHidingNormalizer(function_names).walk(parso.parse(src))
mostly works, but it doesn't seem to appropriately handle functions with decorators.The text was updated successfully, but these errors were encountered: