This repository has been archived by the owner on Nov 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 188
WIP: Use Jedi as the underlying parser #240
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
33560ac
Working on using Jedi as a parser engine.
Nurdok 4aca0a3
WIP
Nurdok 7389343
More parser work.
Nurdok 360c7a4
Tests work, except "noqa" parsing.
Nurdok 0012e50
Adding back the "# noqa" feature.
Nurdok 878bc55
All tests pass! Now to make the code pretty...
Nurdok 0b03b94
Install runtime requirements in tox.
Nurdok d9a00e0
Install runtime requirements in tox.
Nurdok 9b43b05
Trying to fix StringIO error.
Nurdok c0b2fd0
Another attempt to fix StringIO error.
Nurdok 67b5cc8
Another attempt to fix the encoding issue in Python 2.7.
Nurdok 320f614
Added invalid syntax test; still doesn't pass.
Nurdok 1785df7
Invalid syntax tests pass.
Nurdok d86c488
Merge branch 'master' into feature/jedi-parser (there are still jedi …
Nurdok d94e4ba
Pinned jedi version - 0.10.0 has breaking changes (though I used non …
Nurdok 0f3c90f
Removed __init__.py and pin Jedi because of API changes (should remov…
Nurdok 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
jedi==0.9.0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ pytest==3.0.2 | |
pytest-pep8==1.0.6 | ||
mock==2.0.0 | ||
pathlib | ||
-r runtime.txt |
This file contains 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
Empty file.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import ast | ||
import string | ||
import sys | ||
import functools | ||
import tokenize as tk | ||
from itertools import takewhile | ||
from re import compile as re | ||
|
@@ -330,7 +331,7 @@ def check_unicode_docstring(self, definition, docstring): | |
For Unicode docstrings, use u"""Unicode triple-quoted strings""". | ||
|
||
''' | ||
if definition.module.future_imports['unicode_literals']: | ||
if 'unicode_literals' in definition.module.future_imports: | ||
return | ||
|
||
# Just check that docstring is unicode, check_triple_double_quotes | ||
|
@@ -680,6 +681,10 @@ def check(filenames, select=None, ignore=None, ignore_decorators=None): | |
try: | ||
with tokenize_open(filename) as file: | ||
source = file.read() | ||
try: | ||
source = source.decode('utf-8') | ||
except: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To catch any exception use the # Bad
try:
mapping[key]
except Exception:
...
# Better
try:
mapping[key]
except KeyError:
... |
||
pass | ||
for error in ConventionChecker().check_source(source, filename, | ||
ignore_decorators): | ||
code = getattr(error, 'code', None) | ||
|
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.
I think this except should be more narrowly scoped. There are a surprising number of exceptions that can happen here and they depend on platform, how the python interpreter is compiled, etc.