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

Use Jupyter mode while parsing Notebook source code #6090

Closed
Tracked by #5188
dhruvmanila opened this issue Jul 26, 2023 · 0 comments · Fixed by #5552
Closed
Tracked by #5188

Use Jupyter mode while parsing Notebook source code #6090

dhruvmanila opened this issue Jul 26, 2023 · 0 comments · Fixed by #5552
Assignees
Labels
core Related to core functionality

Comments

@dhruvmanila
Copy link
Member

No description provided.

@dhruvmanila dhruvmanila self-assigned this Jul 26, 2023
@dhruvmanila dhruvmanila changed the title Use the new Jupyter mode while parsing Notebook source code Use Jupyter mode while parsing Notebook source code Jul 26, 2023
@dhruvmanila dhruvmanila added the core Related to core functionality label Jul 26, 2023
dhruvmanila added a commit that referenced this issue Aug 5, 2023
## Summary

Enable using the new `Mode::Jupyter` for the tokenizer/parser to parse
Jupyter line magic tokens.

The individual call to the lexer i.e., `lex_starts_at` done by various
rules should consider the context of the source code (is this content
from a Jupyter Notebook?). Thus, a new field `source_type` (of type
`PySourceType`) is added to `Checker` which is being passed around as an
argument to the relevant functions. This is then used to determine the
`Mode` for the lexer.

## Test Plan

Add new test cases to make sure that the magic statement is considered
while generating the diagnostic and autofix:
* For `I001`, if there's a magic statement in between two import blocks,
they should be sorted independently

fixes: #6090
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Related to core functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant