X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/a974fc22eeef0c417eb9f41bda556baa89a5ea68..8b873a9b3b8865a4d451263e48b49122b9c32759:/sdk/python/arvados/_normalize_stream.py diff --git a/sdk/python/arvados/_normalize_stream.py b/sdk/python/arvados/_normalize_stream.py index 9b29e88046..485c757e7f 100644 --- a/sdk/python/arvados/_normalize_stream.py +++ b/sdk/python/arvados/_normalize_stream.py @@ -8,12 +8,8 @@ from . import config import re def escape(path): - # Escape literal backslash path = re.sub('\\\\', lambda m: '\\134', path) - # Escape other special chars. Py3's oct() output differs from Py2, this takes - # care of those differences. - path = re.sub( - '([:\000-\040])', lambda m: "\\%03o" % ord(m.group(1)), path) + path = re.sub('[:\000-\040]', lambda m: "\\%03o" % ord(m.group(0)), path) return path def normalize_stream(stream_name, stream): @@ -59,13 +55,13 @@ def normalize_stream(stream_name, stream): if streamoffset == current_span[1]: current_span[1] += segment.segment_size else: - stream_tokens.append("{0}:{1}:{2}".format(current_span[0], current_span[1] - current_span[0], fout)) + stream_tokens.append(u"{0}:{1}:{2}".format(current_span[0], current_span[1] - current_span[0], fout)) current_span = [streamoffset, streamoffset + segment.segment_size] if current_span is not None: - stream_tokens.append("{0}:{1}:{2}".format(current_span[0], current_span[1] - current_span[0], fout)) + stream_tokens.append(u"{0}:{1}:{2}".format(current_span[0], current_span[1] - current_span[0], fout)) if not stream[streamfile]: - stream_tokens.append("0:0:{0}".format(fout)) + stream_tokens.append(u"0:0:{0}".format(fout)) return stream_tokens