/usr/lib/python2.7/dist-packages/isbnlib/registry.py is in python-isbnlib 3.5.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | # -*- coding: utf-8 -*-
"""Registry for metadata services, formatters and cache."""
from . import _goob as goob
from . import _isbndb as isbndb
from . import _merge as merge
from . import _openl as openl
from . import _wcat as wcat
from ._imcache import IMCache
from .dev._fmt import fmtbib
# SERVICES
services = {'default': merge.query,
'wcat': wcat.query,
'goob': goob.query,
'merge': merge.query,
'openl': openl.query,
'isbndb': isbndb.query
}
def setdefaultservice(name): # pragma: no cover
"""Set the default service."""
global services
services['default'] = services[name]
def add_service(name, query): # pragma: no cover
"""Add a new service to services."""
global services
services[name] = query
# FORMATTERS
bibformatters = {'default': lambda x: fmtbib('labels', x),
'labels': lambda x: fmtbib('labels', x),
'bibtex': lambda x: fmtbib('bibtex', x),
'endnote': lambda x: fmtbib('endnote', x),
'refworks': lambda x: fmtbib('refworks', x),
'msword': lambda x: fmtbib('msword', x),
'json': lambda x: fmtbib('json', x),
'opf': lambda x: fmtbib('opf', x)} # pragma: no cover
def setdefaultbibformatter(name): # pragma: no cover
"""Set the default formatter."""
global bibformatters
bibformatters['default'] = bibformatters[name]
def add_bibformatter(name, formatter): # pragma: no cover
"""Add a new formatter to formatters."""
global bibformatters
bibformatters[name] = formatter
# CACHE
# if you want a persistant cache you could use
# .dev.helpers ShelveCache(pathtofile)
metadata_cache = IMCache() # should be an instance
def set_cache(cache): # pragma: no cover
"""Set cache for metadata."""
global metadata_cache
metadata_cache = cache
covers_cache = None # should be an instance
def set_covers_cache(cache): # pragma: no cover
"""Set cache for covers."""
global covers_cache
covers_cache = cache
custom_cache = None # should be an instance
def set_custom_cache(cache): # pragma: no cover
"""Set a 'spare' cache."""
global custom_cache
custom_cache = cache
|