-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Fix error edge line in python2.7 #4155
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4cb41d4
Edgeline:Fix error when checking if option is string in python2.7
rlaverde 8d9bfaf
Add test for py3compat usage.
rlaverde 37a4af6
Change usage of isinstance(*,str) to py3commpat.is_text_string().
rlaverde 7811fb8
Update with master
ccordoba12 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,24 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import re | ||
|
||
root_path = os.path.realpath(os.path.join(os.getcwd(), 'spyder')) | ||
|
||
pattern = re.compile("isinstance\(.*,.*str\)") | ||
|
||
|
||
def test_dont_use_isinstance_str(): | ||
found = False | ||
for dir_name, _, file_list in os.walk(root_path): | ||
for fname in file_list: | ||
if fname.endswith('.py') and fname != 'py3compat.py': | ||
file = os.path.join(dir_name, fname) | ||
|
||
for i, line in enumerate(open(file)): | ||
for match in re.finditer(pattern, line): | ||
print("{}\nline:{}, {}".format(file, i + 1, line)) | ||
found = True | ||
|
||
assert found == False, ("Don't use builtin isinstance() function," | ||
"use spyder.py3compat.is_text_string() instead") |
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
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
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
# Local imports | ||
from spyder import __version__ | ||
from spyder.config.base import _ | ||
from spyder.py3compat import PY3 | ||
from spyder.py3compat import PY3, is_text_string | ||
from spyder.utils.programs import check_version, is_stable_version | ||
|
||
|
||
|
@@ -76,7 +76,7 @@ def start(self): | |
data = page.read() | ||
|
||
# Needed step for python3 compatibility | ||
if not isinstance(data, str): | ||
if not is_text_string(data, str): | ||
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. This is also wrong, and it's what's making our tests to time out in master because checking if there's a new Spyder version is failing now. |
||
data = data.decode() | ||
|
||
data = json.loads(data) | ||
|
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.
@rlaverde, this call is wrong because
is_text_string
only receives one argument.