#NEWLINE# def _parse_svg_pts( self , datastr ) : #NEWLINE# #INDENT# data = list ( _tokenize_path ( self ) ) #NEWLINE# if ( data . pop ( 0 ) . lower ( ) != 'm' ) : #NEWLINE# #INDENT# raise ValueError ( 'Unknown path format' ) #NEWLINE# #UNINDENT# offset = np . array ( map ( float , [ data . pop ( 0 ) , data . pop ( 0 ) ] ) ) #NEWLINE# mode = 'l' #NEWLINE# pts = [ [ offset [ 0 ] , offset [ 1 ] ] ] #NEWLINE# def canfloat( n ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# float ( n ) #NEWLINE# return True #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# #UNINDENT# lastlen = len ( data ) #NEWLINE# while ( len ( data ) > 0 ) : #NEWLINE# #INDENT# if ( not canfloat ( data [ 0 ] ) ) : #NEWLINE# #INDENT# mode = data . pop ( 0 ) #NEWLINE# continue #NEWLINE# #UNINDENT# if ( mode == 'l' ) : #NEWLINE# #INDENT# offset += list ( map ( float , [ data . pop ( 0 ) , data . pop ( 0 ) ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mode == 'L' ) : #NEWLINE# #INDENT# offset = np . array ( list ( map ( float , [ data . pop ( 0 ) , data . pop ( 0 ) ] ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mode == 'c' ) : #NEWLINE# #INDENT# data = data [ 4 : ] #NEWLINE# offset += list ( map ( float , [ data . pop ( 0 ) , data . pop ( 0 ) ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( mode == 'C' ) : #NEWLINE# #INDENT# data = data [ 4 : ] #NEWLINE# offset = np . array ( list ( map ( float , [ data . pop ( 0 ) , data . pop ( 0 ) ] ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( len ( data ) == lastlen ) : #NEWLINE# #INDENT# raise ValueError ( 'Error parsing path.' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# lastlen = len ( data ) #NEWLINE# #UNINDENT# pts . append ( [ offset [ 0 ] , offset [ 1 ] ] ) #NEWLINE# #UNINDENT# pts = np . array ( pts ) #NEWLINE# pts /= self . parent . svgshape #NEWLINE# pts [ : , 1 ] = ( 1 - pts [ : , 1 ] ) #NEWLINE# return pts