##// END OF EJS Templates
Merge pull request #12009 from kousikmitra/master...
Matthias Bussonnier -
r25332:61a4f1f7 merge
parent child Browse files
Show More
@@ -13,8 +13,6 b' import platform'
13
13
14 from .encoding import DEFAULT_ENCODING
14 from .encoding import DEFAULT_ENCODING
15
15
16 def no_code(x, encoding=None):
17 return x
18
16
19 def decode(s, encoding=None):
17 def decode(s, encoding=None):
20 encoding = encoding or DEFAULT_ENCODING
18 encoding = encoding or DEFAULT_ENCODING
@@ -44,7 +42,7 b' def buffer_to_bytes(buf):'
44 def _modify_str_or_docstring(str_change_func):
42 def _modify_str_or_docstring(str_change_func):
45 @functools.wraps(str_change_func)
43 @functools.wraps(str_change_func)
46 def wrapper(func_or_str):
44 def wrapper(func_or_str):
47 if isinstance(func_or_str, string_types):
45 if isinstance(func_or_str, (str,)):
48 func = None
46 func = None
49 doc = func_or_str
47 doc = func_or_str
50 else:
48 else:
@@ -66,17 +64,12 b' def safe_unicode(e):'
66 safe to call unicode() on.
64 safe to call unicode() on.
67 """
65 """
68 try:
66 try:
69 return unicode_type(e)
67 return str(e)
70 except UnicodeError:
68 except UnicodeError:
71 pass
69 pass
72
70
73 try:
71 try:
74 return str_to_unicode(str(e))
72 return repr(e)
75 except UnicodeError:
76 pass
77
78 try:
79 return str_to_unicode(repr(e))
80 except UnicodeError:
73 except UnicodeError:
81 pass
74 pass
82
75
@@ -156,16 +149,6 b" def input(prompt=''):"
156 builtin_mod_name = "builtins"
149 builtin_mod_name = "builtins"
157 import builtins as builtin_mod
150 import builtins as builtin_mod
158
151
159 str_to_unicode = no_code
160 unicode_to_str = no_code
161 str_to_bytes = encode
162 bytes_to_str = decode
163 cast_bytes_py2 = no_code
164 cast_unicode_py2 = no_code
165 buffer_to_bytes_py2 = no_code
166
167 string_types = (str,)
168 unicode_type = str
169
152
170 which = shutil.which
153 which = shutil.which
171
154
General Comments 0
You need to be logged in to leave comments. Login now