Fix #1903535 [[PATCH] Allow keyword arguments in debug_print](https://bugs.launchpad.net/calibre/+bug/1903535)

This commit is contained in:
Kovid Goyal 2020-11-09 19:47:41 +05:30
parent 787001dea0
commit 19a0aa139d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -23,15 +23,13 @@ from calibre.devices.usbms.books import BookList, Book
from calibre.ebooks.metadata.book.json_codec import JsonCodec
from polyglot.builtins import itervalues, unicode_type, string_or_bytes, zip
BASE_TIME = None
def debug_print(*args):
global BASE_TIME
if BASE_TIME is None:
BASE_TIME = time.time()
def debug_print(*args, **kw):
base_time = getattr(debug_print, 'base_time', None)
if base_time is None:
debug_print.base_time = base_time = time.monotonic()
if DEBUG:
prints('DEBUG: %6.1f'%(time.time()-BASE_TIME), *args)
prints('DEBUG: %6.1f'%(time.monotonic()-base_time), *args, **kw)
def safe_walk(top, topdown=True, onerror=None, followlinks=False, maxdepth=128):