#NEWLINE# def main( source ) : #NEWLINE# #INDENT# pending = sorted ( cf . cc2name ) #NEWLINE# to_download = len ( pending ) #NEWLINE# downloaded = 0 #NEWLINE# t0 = time . time ( ) #NEWLINE# for iso_cc in pending : #NEWLINE# #INDENT# print ( 'get:' , iso_cc ) #NEWLINE# try : #NEWLINE# #INDENT# times [ iso_cc ] = [ ( time . time ( ) - t0 ) ] #NEWLINE# ( octets , file_name ) = fetch ( iso_cc , source ) #NEWLINE# times [ iso_cc ] . append ( ( time . time ( ) - t0 ) ) #NEWLINE# downloaded += 1 #NEWLINE# print ( '\t--> {}: {:5d} bytes' . format ( file_name , octets ) ) #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# print ( '\t***' , iso_cc , 'generated an exception:' , exc ) #NEWLINE# #UNINDENT# #UNINDENT# ratio = ( downloaded / to_download ) #NEWLINE# print ( '{} of {} downloaded ({:.1%})' . format ( downloaded , to_download , ratio ) ) #NEWLINE# for iso_cc in sorted ( times ) : #NEWLINE# #INDENT# ( start , end ) = times [ iso_cc ] #NEWLINE# print ( '{}\t{:.6g}\t{:.6g}' . format ( iso_cc , start , end ) )