-
Notifications
You must be signed in to change notification settings - Fork 7
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
Switch to python3 host #48
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,31 +15,31 @@ | |
|
||
|
||
try: | ||
import __builtin__ | ||
str_instances = (str, __builtin__.basestring) | ||
import builtins | ||
str_instances = (str, builtins.str) | ||
except Exception: | ||
str_instances = (str, ) | ||
|
||
try: | ||
import urllib | ||
import urllib.request, urllib.parse, urllib.error | ||
from urllib.request import Request, urlopen | ||
HTTPError = urllib.error.HTTPError | ||
URLError = urllib.error.URLError | ||
except (AttributeError, ImportError, ValueError): | ||
import urllib2 | ||
from urllib2 import Request, urlopen | ||
HTTPError = urllib2.HTTPError | ||
URLError = urllib2.URLError | ||
import urllib.request, urllib.error, urllib.parse | ||
from urllib.request import Request, urlopen | ||
HTTPError = urllib.error.HTTPError | ||
URLError = urllib.error.URLError | ||
Comment on lines
23
to
+32
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. Looks like this can be reduced to some qualified imports. |
||
|
||
try: | ||
from .. import editor | ||
from . import cert, msg, shared as G, utils | ||
except ImportError: | ||
import cert | ||
from . import cert | ||
import editor | ||
import msg | ||
import shared as G | ||
import utils | ||
from . import msg | ||
from . import shared as G | ||
from . import utils | ||
|
||
|
||
def get_basic_auth(host): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,19 +5,19 @@ | |
import traceback | ||
|
||
try: | ||
unicode() | ||
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. String will now always be there. This block and the code below predicating on the existence of str should be able to be removed / flattened-out. |
||
except NameError: | ||
unicode = None | ||
str = None | ||
|
||
|
||
def str_e(e): | ||
with warnings.catch_warnings(): | ||
warnings.simplefilter("ignore") | ||
message = getattr(e, "message", None) | ||
if not (message and unicode): | ||
if not (message and str): | ||
return str(e) | ||
try: | ||
return unicode(message, "utf8").encode("utf8") | ||
return str(message, "utf8").encode("utf8") | ||
except: | ||
return message.encode("utf8") | ||
|
||
|
@@ -55,7 +55,7 @@ def test2(excp): | |
assert isinstance(stre, str) | ||
print(stre) | ||
|
||
tests = [Exception("asdf"), Exception(u"aß∂ƒ"), Exception(u"asdf"), Exception(b"asdf1234")] | ||
tests = [Exception("asdf"), Exception("aß∂ƒ"), Exception("asdf"), Exception(b"asdf1234")] | ||
for t in tests: | ||
test(t) | ||
if getattr(sys, "exc_clear", None): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
try: | ||
from . import dmp_monkey | ||
except ImportError: | ||
import dmp_monkey | ||
from . import dmp_monkey | ||
|
||
dmp_monkey.monkey_patch() | ||
|
||
try: | ||
from . import diff_match_patch | ||
except ImportError: | ||
import diff_match_patch | ||
from . import diff_match_patch | ||
|
||
DMP = diff_match_patch.diff_match_patch() |
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.
Looks like this can be dropped. I am guessing it is only there because of
s/unicode/str/g
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.
yep, I think it's an artifact of 2to3