Show More
@@ -13,8 +13,6 b' import platform' | |||
|
13 | 13 | |
|
14 | 14 | from .encoding import DEFAULT_ENCODING |
|
15 | 15 | |
|
16 | def no_code(x, encoding=None): | |
|
17 | return x | |
|
18 | 16 | |
|
19 | 17 | def decode(s, encoding=None): |
|
20 | 18 | encoding = encoding or DEFAULT_ENCODING |
@@ -44,7 +42,7 b' def buffer_to_bytes(buf):' | |||
|
44 | 42 | def _modify_str_or_docstring(str_change_func): |
|
45 | 43 | @functools.wraps(str_change_func) |
|
46 | 44 | def wrapper(func_or_str): |
|
47 |
if isinstance(func_or_str, |
|
|
45 | if isinstance(func_or_str, (str,)): | |
|
48 | 46 | func = None |
|
49 | 47 | doc = func_or_str |
|
50 | 48 | else: |
@@ -66,17 +64,12 b' def safe_unicode(e):' | |||
|
66 | 64 | safe to call unicode() on. |
|
67 | 65 | """ |
|
68 | 66 | try: |
|
69 |
return |
|
|
67 | return str(e) | |
|
70 | 68 | except UnicodeError: |
|
71 | 69 | pass |
|
72 | 70 | |
|
73 | 71 | try: |
|
74 |
return |
|
|
75 | except UnicodeError: | |
|
76 | pass | |
|
77 | ||
|
78 | try: | |
|
79 | return str_to_unicode(repr(e)) | |
|
72 | return repr(e) | |
|
80 | 73 | except UnicodeError: |
|
81 | 74 | pass |
|
82 | 75 | |
@@ -156,16 +149,6 b" def input(prompt=''):" | |||
|
156 | 149 | builtin_mod_name = "builtins" |
|
157 | 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 | 153 | which = shutil.which |
|
171 | 154 |
General Comments 0
You need to be logged in to leave comments.
Login now