@@ -0,0 +1,2507 @@
+#!/usr/bin/env python3%0A%0Aimport common%0Aimport getopt%0Aimport sys%0Aimport time%0A%0A%0Adef usage(prog):%0A    print(%22Usage: %25s NUMBER%5BSUFFIX%5D...%22 %25 prog)%0A    print(%22  or:  %25s OPTION%22 %25 prog)%0A    print(%22Pause for NUMBER seconds. %22,%0A          %22SUFFIX may be 's' for seconds (the default),%22)%0A    print(%22'm' for minutes, 'h' for hours or 'd' for days. %22,%0A          %22Unlike most implementations%22)%0A    print(%22that require NUMBER be an integer,%22,%0A          %22here NUMBER may be an arbitrary floating%22)%0A    print(%22point number. %22,%0A          %22Given two or more arguments, pause for the amount of time%22)%0A    print(%22specified by the sum of their values.%22)%0A    print()%0A    print(%22      --help     display this help and exit%22)%0A    print(%22      --version  output version information and exit%22)%0A    print()%0A    print(%22For complete documentation, run:%22,%0A          %22info coreutils 'sleep invocation'%22)%0A%0A%0Adef sleep(sec):%0A    time.sleep(sec)%0A%0A%0Adef argtonum(prog, arg):%0A    try:%0A        t = float(arg)%0A    except ValueError:%0A        print(%22%25s: invalid time interval '%25s'%22 %25 (prog, arg),%0A              file=sys.stderr)%0A        print(%22Try '%25s --help' for more information.%22 %25 prog,%0A              file=sys.stderr)%0A        exit(-1)%0A    return t%0A%0A%0Aif __name__ == %22__main__%22:%0A    prog = sys.argv%5B0%5D%0A%0A    try:%0A        opts, args = getopt.getopt(sys.argv%5B1:%5D, %22%22,%0A                                   %5B%22help%22,%0A                                    %22version%22%5D)%0A    except getopt.GetoptError:%0A        common.opterr(prog)%0A%0A    if args == %5B%5D and opts == %5B%5D:%0A        print(%22%25s: missing operand%22 %25 prog, file=sys.stderr)%0A        print(%22Try '%25s --help' for more information.%22 %25 prog, file=sys.stderr)%0A        exit(-1)%0A%0A    if opts != %5B%5D:%0A        if len(sys.argv) %3E 2:%0A            print(%22%25s: invalid option -- '-'%22 %25 prog, file=sys.stderr)%0A            print(%22Try '%25s --help' for more information.%22 %25 prog, file=sys.stderr)%0A            exit(-1)%0A        op = opts%5B0%5D%5B0%5D%0A        if op == %22--help%22:%0A            usage(prog)%0A        elif op == %22version%22:%0A            common.version(prog)%0A%0A    for arg in args:%0A        scala = 1%0A        if arg%5B-1%5D == 's':%0A            t = argtonum(prog, arg%5B:-1%5D)%0A        elif arg%5B-1%5D == 'm':%0A            scala = 60%0A            t = argtonum(prog, arg%5B:-1%5D)%0A        elif arg%5B-1%5D == 'h':%0A            scala = 3600%0A            t = argtonum(prog, arg%5B:-1%5D)%0A        elif arg%5B-1%5D == 'd':%0A            scala = 86400%0A            t = argtonum(prog, arg%5B:-1%5D)%0A        else:%0A            t = argtonum(prog, arg)%0A        t *= scala%0A        sleep(t)%0A

Add sleep.py