14539: Simplifies a bit further the regexp replacement on escape() function.
[arvados.git] / sdk / python / arvados / _normalize_stream.py
index 2619ba5086afed1ee918b089b496ac296f5c159e..b579d41ed2839b73fa72c6486101abe97e46a0cc 100644 (file)
@@ -8,9 +8,8 @@ from . import config
 import re
 
 def escape(path):
-    # Escape literal backslash
     path = re.sub('\\\\', lambda m: '\\134', path)
-    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):