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):
        """       
        count [mp.Value] - shared memory to hold the current state, (list or single value)
        
        max_count [mp.Value] - shared memory holding the final state, (None, list or single value),
        may be changed by external process without having to explicitly tell this class.
        If None, no TTG and relative progress can be calculated -> TTG = None 
        
        prepend [string] - string to put in front of the progress output, (None, single string
        or of list of strings)
        
        interval [int] - seconds to wait between progress print
        
        speed_calc_cycles [int] - use the current (time, count) as
        well as the (old_time, old_count) read by the show_stat function 
        speed_calc_cycles calls before to calculate the speed as follows:
        s = count - old_count / (time - old_time)
        
        verbose, sigint, sigterm -> see loop class  
        """
        self.name = name
        self._identifier = get_identifier(self.name, pid='not started')
        
        try:
            for c in count:
                assert isinstance(c, mp.sharedctypes.Synchronized), "each element of 'count' must be if the type multiprocessing.sharedctypes.Synchronized"
            self.is_multi = True
        except TypeError:
            assert isinstance(count, mp.sharedctypes.Synchronized), "'count' must be if the type multiprocessing.sharedctypes.Synchronized"
            self.is_multi = False
            count = [count]
        
        self.len = len(count)
            
        if max_count is not None:
            if self.is_multi:
                try:
                    for m in max_count:
                        assert isinstance(m, mp.sharedctypes.Synchronized), "each element of 'max_count' must be if the type multiprocessing.sharedctypes.Synchronized"
                except __HOLE__:
                    raise TypeError("'max_count' must be iterable")
            else:
                assert isinstance(max_count, mp.sharedctypes.Synchronized), "'max_count' must be of the type multiprocessing.sharedctypes.Synchronized"
                max_count = [max_count]
        else:
            max_count = [None] * self.len
        
        self.start_time = []
        self.speed_calc_cycles = speed_calc_cycles
        
        self.width = width
        
        self.q = []
        self.prepend = []
        self.lock = []
        self.last_count = []
        self.last_old_count = []
        self.last_old_time = []
        for i in range(self.len):
            self.q.append(myQueue())  # queue to save the last speed_calc_cycles
                                      # (time, count) information to calculate speed
            self.last_count.append(UnsignedIntValue())
            self.last_old_count.append(UnsignedIntValue())
            self.last_old_time.append(FloatValue())
            self.lock.append(mp.Lock())
            self.start_time.append(FloatValue(val=time.time()))
            if prepend is None:
                # no prepend given
                self.prepend.append('')
            else:
                try:
                    # assume list of prepend, (needs to be a sequence)
                    # except if prepend is an instance of string
                    # the assert will cause the except to be executed
                    assert not isinstance(prepend, str)
                    self.prepend.append(prepend[i])
                except:
                    # list fails -> assume single prepend for all 
                    self.prepend.append(prepend)
                                                       
        self.max_count = max_count  # list of multiprocessing value type
        self.count = count          # list of multiprocessing value type
        
        self.interval = interval
        self.verbose = verbose

        self.show_on_exit = False
        self.add_args = {}
        
        self.info_line = info_line
        
        # setup loop class with func
        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)
dataset/ETHPy150Open cimatosa/jobmanager/jobmanager/progress.py/Progress.__init__