-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Allow nativeparse to parse source code directly #21260
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
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
2e793ae
Enable native parsing to use source directly
bzoracler 50b0860
Remove `file_exists` parameter from `mypy.parse.parse()` calls
bzoracler ac275e4
Test for invalid bytes
bzoracler 149e459
Fix omitted argument
bzoracler 47e45f7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] 96e8e07
Merge branch 'master' into nativeparse-source
bzoracler beba478
Merge branch 'master' into nativeparse-source
ilevkivskyi 99c7610
Remove fscache existence checks and parallel workarounds
bzoracler 5c45fe2
Remove handling of sequential states
bzoracler 8e53191
Don't pass dummy source
bzoracler b029c44
Refactor to allow a safer `source=None`
bzoracler d1691cc
Raise OSError in parallel mode for missing files
bzoracler 2a523b5
Temporarily fix test
bzoracler 6d72fff
Remove redundant condition
bzoracler 1a28227
Don't create duplicate parallel states
bzoracler cb1bcae
Fix missing parse call
bzoracler df34d0b
Revert "Temporarily fix test"
bzoracler 49c65b8
Revert "Refactor to allow a safer `source=None`"
bzoracler f47a898
Handle `source=None` in `parse()` function
bzoracler 8cfffa0
Check for file existence before parallel parsing
bzoracler b9cc0b5
Handle `source=None` when `--package-root` is set
bzoracler 20b035e
Simplify handling of `--package-root`
bzoracler 52422db
Inline parallel parsing
bzoracler d155dc6
Restore `real_only` check and simplify existence check
bzoracler 630afc8
Restore inline configuration application comment
bzoracler efa9a63
Restore comment changes to `State.parse_file()`
bzoracler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
You modified this comment while copying, why?
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.
Original reason was because
parallelize only those parts of the code that can be parallelized efficiently., to me, reads out of context whenparse_parallelno longer handles a variable calledsequential_states. But I've restored the original comment as-is.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.
It is not really about sequential states, it is about the general logic: in
parse_file()we do (roughly): pre-parse, parse, post-parse. Inparse_all()we do: pre-parse sequentially, parse in parallel, post-parse sequentially. This is done like this to avoid overhead of context switches in code that holds the GIL (pre-parse and post-parse).