Project

General

Profile

« Previous | Next » 

Revision 14539

lib/tnrs.py: added gwt_decode()

View differences:

trunk/lib/tnrs.py
75 75
class InvalidResponse(Exception): pass
76 76

  
77 77
def gwt_encode(str_):
78
    # embedded strs within GWT sections additionally have " JSON-escaped
78 79
    return strings.esc_quotes(strings.json_encode(str_), '|', quote_esc='\!')
79 80

  
81
def gwt_decode(str_):
82
    # embedded strs within GWT sections additionally have " JSON-escaped
83
    return strings.json_decode(strings.unesc_quotes(str_, '|', quote_esc='\!'))
84

  
80 85
def make_spliced_decode_map(decode_map):
81 86
    return [(r'(?: |(?<=\t)|^)'+re.escape(from_.strip())+r'(?: |(?=\t)|$)',
82 87
        strings.regexp_repl_esc(to)) for from_, to in decode_map]

Also available in: Unified diff