mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #1903535 [[PATCH] Allow keyword arguments in debug_print](https://bugs.launchpad.net/calibre/+bug/1903535)
This commit is contained in:
parent
787001dea0
commit
19a0aa139d
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user