(self, func, iterable, mapper, chunksize=None, callback=None,
            error_callback=None)
return result
Helper function to implement map, starmap and their async counterparts.
Helper function to implement map, starmap and their async counterparts.
Helper function to implement map starmap and their async counterparts .
def _map_async(self, func, iterable, mapper, chunksize=None, callback=None,
            error_callback=None):
        '''
        Helper function to implement map, starmap and their async counterparts.
        '''
        self._check_running()
        if not hasattr(iterable, '__len__'):
            iterable = list(iterable)

        if chunksize is None:
            chunksize, extra = divmod(len(iterable), len(self._pool) * 4)
            if extra:
                chunksize += 1
        if len(iterable) == 0:
            chunksize = 0

        task_batches = Pool._get_tasks(func, iterable, chunksize)
        result = MapResult(self, chunksize, len(iterable), callback,
                           error_callback=error_callback)
        self._taskqueue.put(
            (
                self._guarded_task_generation(result._job,
                                              mapper,
                                              task_batches),
                None
            )
        )
        return result
def _map_async ( self , func , iterable , mapper , chunksize = None , callback = None , error_callback = None ) : self . _check_running ( ) if not hasattr ( iterable , '__len__' ) : iterable = list ( iterable ) if chunksize is None : chunksize , extra = divmod ( len ( iterable ) , len ( self . _pool ) * 4 ) if extra : chunksize += 1 if len ( iterable ) == 0 : chunksize = 0 task_batches = Pool . _get_tasks ( func , iterable , chunksize ) result = MapResult ( self , chunksize , len ( iterable ) , callback , error_callback = error_callback ) self . _taskqueue . put ( ( self . _guarded_task_generation ( result . _job , mapper , task_batches ) , None ) ) return result