

def re_uescape(pattern):
    'A unicode-friendly version of re.escape.'
    mutable = list(pattern)
    for (idx, char) in enumerate(pattern):
        if (char not in _alphanum):
            if (char == '\x00'):
                mutable[idx] = '\\000'
            else:
                mutable[idx] = ('\\' + char)
    return ''.join(mutable)

dataset/ETHPy150Open jek/flatland/flatland/util/base.py re_uescape/original