#NEWLINE# def _iglob( path_glob ) : #NEWLINE# #INDENT# rich_path_glob = RICH_GLOB . split ( path_glob , 1 ) #NEWLINE# if ( len ( rich_path_glob ) > 1 ) : #NEWLINE# #INDENT# assert ( len ( rich_path_glob ) == 3 ) , rich_path_glob #NEWLINE# ( prefix , set , suffix ) = rich_path_glob #NEWLINE# for item in set . split ( ',' ) : #NEWLINE# #INDENT# for path in _iglob ( '' . join ( ( prefix , item , suffix ) ) ) : #NEWLINE# #INDENT# ( yield path ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( '**' not in path_glob ) : #NEWLINE# #INDENT# for item in std_iglob ( path_glob ) : #NEWLINE# #INDENT# ( yield item ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# ( prefix , radical ) = path_glob . split ( '**' , 1 ) #NEWLINE# if ( prefix == '' ) : #NEWLINE# #INDENT# prefix = '.' #NEWLINE# #UNINDENT# if ( radical == '' ) : #NEWLINE# #INDENT# radical = '*' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# radical = radical . lstrip ( '/' ) #NEWLINE# radical = radical . lstrip ( '\\' ) #NEWLINE# #UNINDENT# for ( path , dir , files ) in os . walk ( prefix ) : #NEWLINE# #INDENT# path = os . path . normpath ( path ) #NEWLINE# for fn in _iglob ( os . path . join ( path , radical ) ) : #NEWLINE# #INDENT# ( yield fn )