Skip to content
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

Rewrite magic handler #595

Merged
merged 13 commits into from May 23, 2021
Merged

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented May 22, 2021

closes #594

@MarcoGorelli MarcoGorelli changed the title Fixup new tings Rewrite magic handler May 22, 2021
@MarcoGorelli
Copy link
Collaborator Author

MarcoGorelli commented May 22, 2021

Did a bunch of integration tests, and this still passes. This results in less regular expressions, though it does mean giving up on processing Python code within magics, such as

%timeit foo = bar()

However, it does mean being able to handle

flake8_version = !flake8 --version

so IMO it's worth it


EDIT

doesn't handle the latter case in the end. However, it is a lot simpler, much faster, and easier to maintain, so IMO this is still worth it

@MarcoGorelli
Copy link
Collaborator Author

Need to update the known limitations, improve some naming, and improve efficiency of the ast parsing (store a nested dict where the first layer just has the line number)

@girip11
Copy link
Contributor

girip11 commented May 23, 2021

@MarcoGorelli You could merge this PR. I am unable to review it currently

@MarcoGorelli MarcoGorelli marked this pull request as ready for review May 23, 2021 13:22
@MarcoGorelli MarcoGorelli merged commit 466ee5e into nbQA-dev:master May 23, 2021
@MarcoGorelli MarcoGorelli deleted the fixup-new-tings branch May 23, 2021 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nbQA mistakenly reports formatting symbol as invalid syntax because it detects it as IPython magic
2 participants