tahoe-lafs/src/allmydata/magicpath.py
2015-07-21 00:20:55 +01:00

10 lines
228 B
Python

import re
def path2magic(path):
return re.sub(ur'[/@]', lambda m: {u'/': u'@_', u'@': u'@@'}[m.group(0)], path)
def magic2path(path):
return re.sub(ur'@[_@]', lambda m: {u'@_': u'/', u'@@': u'@'}[m.group(0)], path)