typed_print/typed_print.py
def apply_regexp(cls, x, re_compiled):
        '''
            Splits string using regexp and applies the rules from type_map to each part
        '''
        indices = []
        for m in re_compiled.finditer(str(x)):
            indices.append(m.start())
            indices.append(m.end())

        if len(indices) == 0:
            return x

        shift = 0
        if indices[0] != 0:
            indices.insert(0, 0)
            shift = 1

        parts = [x[i:j] for i,j in zip(indices, indices[1:]+[None])]

        for i in range(shift, len(parts), 2):
            parts[i] = cls.type_map[int](parts[i])

        
        return ''.join(parts)

            Splits string using regexp and applies the rules from type_map to each part
        
Splits string using regexp and applies the rules from type_map to each part
Splits string using regexp and applies the rules from type_map to each part
def apply_regexp(cls, x, re_compiled):
        indices = []
        for m in re_compiled.finditer(str(x)):
            indices.append(m.start())
            indices.append(m.end())
        if len(indices) == 0:
            return x
        shift = 0
        if indices[0] != 0:
            indices.insert(0, 0)
            shift = 1
        parts = [x[i:j] for i,j in zip(indices, indices[1:]+[None])]
        for i in range(shift, len(parts), 2):
            parts[i] = cls.type_map[int](parts[i])
        return ''.join(parts)
def apply_regexp ( cls , x , re_compiled ) : indices = [ ] for m in re_compiled . finditer ( str ( x ) ) : indices . append ( m . start ( ) ) indices . append ( m . end ( ) ) if len ( indices ) == 0 : return x shift = 0 if indices [ 0 ] != 0 : indices . insert ( 0 , 0 ) shift = 1 parts = [ x [ i : j ] for i , j in zip ( indices , indices [ 1 : ] + [ None ] ) ] for i in range ( shift , len ( parts ) , 2 ) : parts [ i ] = cls . type_map [ int ] ( parts [ i ] ) return '' . join ( parts )
Splits string using regexp and applies the rules from type_map to each part
Splits string using regexp and applies the rules from type_map to each part
'''
            Splits string using regexp and applies the rules from type_map to each part
        '''
cls
x
re_compiled