mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
6a6b2a6f58
commit
5ce7afa6e2
@ -17,6 +17,7 @@ pdfreflow, pdfreflow_error = plugins['pdfreflow']
|
||||
def get_metadata(stream, cover=True):
|
||||
if pdfreflow is None:
|
||||
raise RuntimeError(pdfreflow_error)
|
||||
stream.seek(0)
|
||||
raw = stream.read()
|
||||
#isbn = _isbn_pat.search(raw)
|
||||
#if isbn is not None:
|
||||
|
@ -5,6 +5,8 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import gc
|
||||
|
||||
## {{{ http://code.activestate.com/recipes/286222/ (r1)
|
||||
import os
|
||||
|
||||
@ -52,4 +54,19 @@ def stacksize(since=0.0):
|
||||
## end of http://code.activestate.com/recipes/286222/ }}}
|
||||
|
||||
|
||||
def gc_histogram():
|
||||
"""Returns per-class counts of existing objects."""
|
||||
result = {}
|
||||
for o in gc.get_objects():
|
||||
t = type(o)
|
||||
count = result.get(t, 0)
|
||||
result[t] = count + 1
|
||||
return result
|
||||
|
||||
def diff_hists(h1, h2):
|
||||
"""Prints differences between two results of gc_histogram()."""
|
||||
for k in h1:
|
||||
if h1[k] != h2[k]:
|
||||
print "%s: %d -> %d (%s%d)" % (
|
||||
k, h1[k], h2[k], h2[k] > h1[k] and "+" or "", h2[k] - h1[k])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user