def replace_escapes(self, m):
        """Replace escapes."""

        groups = m.groupdict()
        esc = m.group(0)
        if groups.get('special'):
            value = BACK_SLASH_TRANSLATION[esc]
        elif groups.get('char'):
            try:
                if esc.endswith('}'):
                    value = chr(int(esc[3:-1], 16))
                else:
                    value = chr(int(esc[2:], 16))
            except Exception:
                value = esc
        elif groups.get('oct'):
            # JavaScript only supports hex range.
            # So \400 would be \40 + '0'
            value = int(esc[1:], 8)
            overflow = ''
            if value > 255:
                value = esc[1:-1]
                overflow + esc[-1]
            value = chr(value) + overflow
        elif('other'):
            value = esc[1:]
        return value.replace('\x00', '\n')
def replace_escapes ( self , m ) : groups = m . groupdict ( ) esc = m . group ( 0 ) if groups . get ( 'special' ) : value = BACK_SLASH_TRANSLATION [ esc ] elif groups . get ( 'char' ) : try : if esc . endswith ( '}' ) : value = chr ( int ( esc [ 3 : - 1 ] , 16 ) ) else : value = chr ( int ( esc [ 2 : ] , 16 ) ) except Exception : value = esc elif groups . get ( 'oct' ) : value = int ( esc [ 1 : ] , 8 ) overflow = '' if value > 255 : value = esc [ 1 : - 1 ] overflow + esc [ - 1 ] value = chr ( value ) + overflow elif ( 'other' ) : value = esc [ 1 : ] return value . replace ( '\x00' , '\n' )
Replace escapes.