# FIXME: hack for Python-2.4; switch to itemgetter() once Python-2.6 is default # use_refrec = itemgetter(slice(None)) # use_ref = itemgetter(0, 1) # use_rec = itemgetter(2) use_refrec = lambda x: x use_ref = lambda x: x[0:2] use_rec = lambda x: x[2] # At first glance this may look silly. # However, if we load the dictionaries # uncoditionally there will be only # one instance of them in the memory after # fork cit_dict = get_citation_dict("citationdict") recit_dict = get_citation_dict("reversedict") caches = [] def create_new_cache(): ret = {} caches.append(ret) return ret def clear_all_caches(): for c in caches: c.clear()
def _extract_cites_by(bibrec): cit_dict = get_citation_dict("reversedict") return cit_dict.get(bibrec, ())
def _extract_cites(bibrec): cit_dict = get_citation_dict("citationdict") return cit_dict.get(bibrec, ())