#NEWLINE# def iter_rings( data , pathcodes ) : #NEWLINE# #INDENT# ring = [ ] #NEWLINE# for ( point , code ) in zip ( data , pathcodes ) : #NEWLINE# #INDENT# if ( code == 'M' ) : #NEWLINE# #INDENT# if len ( ring ) : #NEWLINE# #INDENT# ( yield ring ) #NEWLINE# #UNINDENT# ring = [ point ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pathcodes == 'L' ) : #NEWLINE# #INDENT# ring . append ( point ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Unrecognized code: {}' . format ( code ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# if len ( ring ) : #NEWLINE# #INDENT# ( yield ring )