Commit 3641553d authored by Hanno Schlichting's avatar Hanno Schlichting

PEP8

parent b62b846e
......@@ -11,7 +11,8 @@
#
##############################################################################
import time, sys
import sys
import time
from logging import getLogger
from DateTime.DateTime import DateTime
......@@ -20,6 +21,7 @@ from zope.interface import implements
LOG = getLogger('ProgressHandler')
class IProgressHandler(Interface):
""" A handler to log progress informations for long running
operations.
......@@ -75,10 +77,12 @@ class StdoutHandler:
if current > 0:
if current % self._steps == 0:
seconds_so_far = time.time() - self._start
seconds_to_go = seconds_so_far / current * (self._max - current)
seconds_to_go = (seconds_so_far / current *
(self._max - current))
end = DateTime(time.time() + seconds_to_go)
self.output('%d/%d (%.2f%%) Estimated termination: %s' % \
(current, self._max, (100.0 * current / self._max),
DateTime(time.time() + seconds_to_go).strftime('%Y/%m/%d %H:%M:%Sh')))
end.strftime('%Y/%m/%d %H:%M:%Sh')))
def output(self, text):
print >>self.fp, '%s: %s' % (self._ident, text)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment