countdown: clean up & simplify a bit
authorMike Frysinger <vapier@gentoo.org>
Wed, 27 Nov 2013 03:23:45 +0000 (22:23 -0500)
committerMike Frysinger <vapier@gentoo.org>
Wed, 27 Nov 2013 03:23:45 +0000 (22:23 -0500)
pym/_emerge/countdown.py

index 5abdc8a96514fe27a8abf0154768f59af8ec1bd1..62e3c8dead139b0816e4280916b33e61f44700ba 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from __future__ import print_function
@@ -8,15 +8,15 @@ import time
 
 from portage.output import colorize
 
-def countdown(secs=5, doing="Starting"):
+
+def countdown(secs=5, doing='Starting'):
        if secs:
-               print(">>> Waiting",secs,"seconds before starting...")
-               print(">>> (Control-C to abort)...\n"+doing+" in: ", end=' ')
-               ticks=list(range(secs))
-               ticks.reverse()
-               for sec in ticks:
-                       sys.stdout.write(colorize("UNMERGE_WARN", str(sec+1)+" "))
+               print(
+                       '>>> Waiting %s seconds before starting...\n'
+                       '>>> (Control-C to abort)...\n'
+                       '%s in:' % (secs, doing), end='')
+               for sec in range(secs, 0, -1):
+                       sys.stdout.write(colorize('UNMERGE_WARN', ' %i' % sec))
                        sys.stdout.flush()
                        time.sleep(1)
                print()
-