#NEWLINE# def __init__( self , count , max_count = None , prepend = None , width = 'auto' , speed_calc_cycles = 10 , interval = 1 , verbose = 0 , sigint = 'stop' , sigterm = 'stop' , name = 'progress' , info_line = None ) : #NEWLINE# #INDENT# '       \n        count [mp.Value] - shared memory to hold the current state, (list or single value)\n        \n        max_count [mp.Value] - shared memory holding the final state, (None, list or single value),\n        may be changed by external process without having to explicitly tell this class.\n        If None, no TTG and relative progress can be calculated -> TTG = None \n        \n        prepend [string] - string to put in front of the progress output, (None, single string\n        or of list of strings)\n        \n        interval [int] - seconds to wait between progress print\n        \n        speed_calc_cycles [int] - use the current (time, count) as\n        well as the (old_time, old_count) read by the show_stat function \n        speed_calc_cycles calls before to calculate the speed as follows:\n        s = count - old_count / (time - old_time)\n        \n        verbose, sigint, sigterm -> see loop class  \n        ' #NEWLINE# self . name = name #NEWLINE# self . _identifier = get_identifier ( self . name , pid = 'not started' ) #NEWLINE# try : #NEWLINE# #INDENT# for c in count : #NEWLINE# #INDENT# assert isinstance ( c , mp . sharedctypes . Synchronized ) , "each element of 'count' must be if the type multiprocessing.sharedctypes.Synchronized" #NEWLINE# #UNINDENT# self . is_multi = True #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# assert isinstance ( count , mp . sharedctypes . Synchronized ) , "'count' must be if the type multiprocessing.sharedctypes.Synchronized" #NEWLINE# self . is_multi = False #NEWLINE# count = [ count ] #NEWLINE# #UNINDENT# self . len = len ( count ) #NEWLINE# if ( max_count is not None ) : #NEWLINE# #INDENT# if self . is_multi : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# for m in max_count : #NEWLINE# #INDENT# assert isinstance ( m , mp . sharedctypes . Synchronized ) , "each element of 'max_count' must be if the type multiprocessing.sharedctypes.Synchronized" #NEWLINE# #UNINDENT# #UNINDENT# except TypeError : #NEWLINE# #INDENT# raise TypeError ( "'max_count' must be iterable" ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# assert isinstance ( max_count , mp . sharedctypes . Synchronized ) , "'max_count' must be of the type multiprocessing.sharedctypes.Synchronized" #NEWLINE# max_count = [ max_count ] #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# max_count = ( [ None ] * self . len ) #NEWLINE# #UNINDENT# self . start_time = [ ] #NEWLINE# self . speed_calc_cycles = speed_calc_cycles #NEWLINE# self . width = width #NEWLINE# self . q = [ ] #NEWLINE# self . prepend = [ ] #NEWLINE# self . lock = [ ] #NEWLINE# self . last_count = [ ] #NEWLINE# self . last_old_count = [ ] #NEWLINE# self . last_old_time = [ ] #NEWLINE# for i in range ( self . len ) : #NEWLINE# #INDENT# self . q . append ( myQueue ( ) ) #NEWLINE# self . last_count . append ( UnsignedIntValue ( ) ) #NEWLINE# self . last_old_count . append ( UnsignedIntValue ( ) ) #NEWLINE# self . last_old_time . append ( FloatValue ( ) ) #NEWLINE# self . lock . append ( mp . Lock ( ) ) #NEWLINE# self . start_time . append ( FloatValue ( val = time . time ( ) ) ) #NEWLINE# if ( prepend is None ) : #NEWLINE# #INDENT# self . prepend . append ( '' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# assert ( not isinstance ( prepend , str ) ) #NEWLINE# self . prepend . append ( prepend [ i ] ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# self . prepend . append ( prepend ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . max_count = max_count #NEWLINE# self . count = count #NEWLINE# self . interval = interval #NEWLINE# self . verbose = verbose #NEWLINE# self . show_on_exit = False #NEWLINE# self . add_args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . info_line = info_line #NEWLINE# super ( Progress , self ) . __init__ ( func = Progress . show_stat_wrapper_multi , args = ( self . count , self . last_count , self . start_time , self . max_count , self . speed_calc_cycles , self . width , self . q , self . last_old_count , self . last_old_time , self . prepend , self . __class__ . show_stat , self . len , self . add_args , self . lock , self . info_line ) , interval = interval , verbose = verbose , sigint = sigint , sigterm = sigterm , name = name , auto_kill_on_last_resort = True )