mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-04-13 05:43:03 +00:00
diff shrink
This commit is contained in:
parent
aa4f113027
commit
46d3ffb2e2
@ -96,6 +96,20 @@ def get_io_encoding():
|
||||
"""
|
||||
return io_encoding
|
||||
|
||||
def argv_to_unicode(s):
|
||||
"""
|
||||
Perform the inverse of ``unicode_to_argv``.
|
||||
"""
|
||||
if isinstance(s, unicode):
|
||||
return s
|
||||
precondition(isinstance(s, bytes), s)
|
||||
|
||||
try:
|
||||
return unicode(s, io_encoding)
|
||||
except UnicodeDecodeError:
|
||||
raise usage.UsageError("Argument %s cannot be decoded as %s." %
|
||||
(quote_output(s), io_encoding))
|
||||
|
||||
def argv_to_abspath(s, **kwargs):
|
||||
"""
|
||||
Convenience function to decode an argv element to an absolute path, with ~ expanded.
|
||||
@ -119,20 +133,6 @@ def unicode_to_argv(s, mangle=False):
|
||||
return ensure_str(s)
|
||||
|
||||
|
||||
def argv_to_unicode(s):
|
||||
"""
|
||||
Perform the inverse of ``unicode_to_argv``.
|
||||
"""
|
||||
if isinstance(s, unicode):
|
||||
return s
|
||||
precondition(isinstance(s, bytes), s)
|
||||
|
||||
try:
|
||||
return unicode(s, io_encoding)
|
||||
except UnicodeDecodeError:
|
||||
raise usage.UsageError("Argument %s cannot be decoded as %s." %
|
||||
(quote_output(s), io_encoding))
|
||||
|
||||
def unicode_to_url(s):
|
||||
"""
|
||||
Encode an unicode object used in an URL to bytes.
|
||||
|
Loading…
x
Reference in New Issue
Block a user