()
return elapsed, progress
Prints progress on inserting elements.
Prints progress on inserting elements.
Prints progress on inserting elements .
def timer_func():
    """
    Prints progress on inserting elements.
    """

    last = time.time()

    def elapsed(msg):
        nonlocal last
        now = time.time()
        sec = round(now - last, 1)
        last = now
        logger.debug(f"{msg} in {sec} seconds")

    def progress(index, step=500, total=0, msg=""):
        nonlocal last
        if index % step == 0:
            percent = int((index / total) * 100) if total >= index else index
            logger.debug(f"... {percent}% ({index} out of {total}). {step} {msg}")

    return elapsed, progress
def timer_func ( ) : last = time . time ( ) def elapsed ( msg ) : nonlocal last now = time . time ( ) sec = round ( now - last , 1 ) last = now logger . debug ( f"{msg} in {sec} seconds" ) def progress ( index , step = 500 , total = 0 , msg = "" ) : nonlocal last if index % step == 0 : percent = int ( ( index / total ) * 100 ) if total >= index else index logger . debug ( f"... {percent}% ({index} out of {total}). {step} {msg}" ) return elapsed , progress