forked from VimPlug/jedi
Remove the u() unicode function
This commit is contained in:
@@ -134,18 +134,7 @@ class ImplicitNSInfo(object):
|
||||
self.paths = paths
|
||||
|
||||
|
||||
def u(string, errors='strict'):
|
||||
"""Cast to unicode DAMMIT!
|
||||
Written because Python2 repr always implicitly casts to a string, so we
|
||||
have to cast back to a unicode (and we now that we always deal with valid
|
||||
unicode, because we check that in the beginning).
|
||||
"""
|
||||
if isinstance(string, bytes):
|
||||
return str(string, encoding='UTF-8', errors=errors)
|
||||
return string
|
||||
|
||||
|
||||
def cast_path(obj):
|
||||
def cast_path(string):
|
||||
"""
|
||||
Take a bytes or str path and cast it to unicode.
|
||||
|
||||
@@ -156,7 +145,9 @@ def cast_path(obj):
|
||||
Since this just really complicates everything and Python 2.7 will be EOL
|
||||
soon anyway, just go with always strings.
|
||||
"""
|
||||
return u(obj, errors='replace')
|
||||
if isinstance(string, bytes):
|
||||
return str(string, encoding='UTF-8', errors='replace')
|
||||
return string
|
||||
|
||||
|
||||
def pickle_load(file):
|
||||
|
||||
Reference in New Issue
Block a user