jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/598227 )
Change subject: [IMPR] use float for statistics ......................................................................
[IMPR] use float for statistics
- Show float values for statistical informations. Read operations are often faster than 1/s and the printed value is just 0 which looks faulty. Use a float value instead. - Use str.format instead of modulo operator.
Change-Id: I49ab16d518b45cb6b6c71e314fda19758b0af2b4 --- M pywikibot/bot.py 1 file changed, 9 insertions(+), 7 deletions(-)
Approvals: Matěj Suchánek: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/bot.py b/pywikibot/bot.py index 4d1cfcc..ee0ee2b 100644 --- a/pywikibot/bot.py +++ b/pywikibot/bot.py @@ -1311,16 +1311,18 @@ delta = (pywikibot.Timestamp.now() - self._start_ts) seconds = int(delta.total_seconds()) if delta.days: - pywikibot.output('Execution time: %d days, %d seconds' - % (delta.days, delta.seconds)) + pywikibot.output( + 'Execution time: {d.days} days, {d.seconds} seconds' + .format(d=delta)) else: - pywikibot.output('Execution time: %d seconds' % delta.seconds) + pywikibot.output('Execution time: {} seconds' + .format(delta.seconds)) if self._treat_counter: - pywikibot.output('Read operation time: %d seconds' - % (seconds / self._treat_counter)) + pywikibot.output('Read operation time: {:.1f} seconds' + .format(seconds / self._treat_counter)) if self._save_counter: - pywikibot.output('Write operation time: %d seconds' - % (seconds / self._save_counter)) + pywikibot.output('Write operation time: {:.1f} seconds' + .format(seconds / self._save_counter))
# exc_info contains exception from self.run() while terminating exc_info = sys.exc_info()
pywikibot-commits@lists.wikimedia.org