def main(**kwargs):
    """
    \b
    Starts a countdown to or from TIME. Example values for TIME:
    10, '1h 5m 30s', '12:00', '2020-01-01', '2020-01-01 14:00 UTC'.
    \b
    If TIME is not given, termdown will operate in stopwatch mode
    and count forward.
    \b
    Hotkeys:
    \tL\tLap (stopwatch mode only)
    \tR\tReset
    \tSPACE\tPause (will delay absolute TIME)
    \tQ\tQuit
    """
    if kwargs['time_format'] is None:
        kwargs['time_format'] = \
                DEFAULT_TIME_FORMAT[:-3] if kwargs['no_seconds'] else DEFAULT_TIME_FORMAT

    if kwargs['timespec']:
        curses.wrapper(countdown, **kwargs)
    else:
        seconds_elapsed, laps = curses.wrapper(stopwatch, **kwargs)

        for lap_index, lap_time in enumerate(laps):
            stderr.write("{:.3f}\t{}\tlap {}\n".format(
                lap_time,
                format_seconds(int(lap_time)),
                lap_index + 1,
            ))

        if laps:
            stderr.write("{:.3f}\t{}\tlap {}\n".format(
                seconds_elapsed,
                format_seconds(int(seconds_elapsed)),
                len(laps) + 1,
            ))
            laps.append(seconds_elapsed)
            total_seconds = sum(laps)
            average_seconds = total_seconds / len(laps)
            stderr.write("{:.3f}\t{}\tlap avg\n".format(
                average_seconds,
                format_seconds(int(average_seconds)),
            ))
            stderr.write("{:.3f}\t{}\ttotal\n".format(
                total_seconds,
                format_seconds(int(total_seconds)),
            ))
        else:
            stderr.write("{:.3f}\t{}\ttotal\n".format(
                seconds_elapsed,
                format_seconds(int(seconds_elapsed)),
            ))
        stderr.flush()
def main ( ** kwargs ) : if kwargs [ 'time_format' ] is None : kwargs [ 'time_format' ] = DEFAULT_TIME_FORMAT [ : - 3 ] if kwargs [ 'no_seconds' ] else DEFAULT_TIME_FORMAT if kwargs [ 'timespec' ] : curses . wrapper ( countdown , ** kwargs ) else : seconds_elapsed , laps = curses . wrapper ( stopwatch , ** kwargs ) for lap_index , lap_time in enumerate ( laps ) : stderr . write ( "{:.3f}\t{}\tlap {}\n" . format ( lap_time , format_seconds ( int ( lap_time ) ) , lap_index + 1 , ) ) if laps : stderr . write ( "{:.3f}\t{}\tlap {}\n" . format ( seconds_elapsed , format_seconds ( int ( seconds_elapsed ) ) , len ( laps ) + 1 , ) ) laps . append ( seconds_elapsed ) total_seconds = sum ( laps ) average_seconds = total_seconds / len ( laps ) stderr . write ( "{:.3f}\t{}\tlap avg\n" . format ( average_seconds , format_seconds ( int ( average_seconds ) ) , ) ) stderr . write ( "{:.3f}\t{}\ttotal\n" . format ( total_seconds , format_seconds ( int ( total_seconds ) ) , ) ) else : stderr . write ( "{:.3f}\t{}\ttotal\n" . format ( seconds_elapsed , format_seconds ( int ( seconds_elapsed ) ) , ) ) stderr . flush ( )
\b
    Starts a countdown to or from TIME. Example values for TIME:
    10, '1h 5m 30s', '12:00', '2020-01-01', '2020-01-01 14:00 UTC'.
    \b
    If TIME is not given, termdown will operate in stopwatch mode
    and count forward.
    \b
    Hotkeys:
    \tL\tLap (stopwatch mode only)
    \tR\tReset
    \tSPACE\tPause (will delay absolute TIME)
    \tQ\tQuit