aboutsummaryrefslogtreecommitdiffstats
path: root/fuzzycat/serials.py
diff options
context:
space:
mode:
Diffstat (limited to 'fuzzycat/serials.py')
-rw-r--r--fuzzycat/serials.py43
1 files changed, 0 insertions, 43 deletions
diff --git a/fuzzycat/serials.py b/fuzzycat/serials.py
deleted file mode 100644
index 2f1782d..0000000
--- a/fuzzycat/serials.py
+++ /dev/null
@@ -1,43 +0,0 @@
-# coding: utf-8
-"""
-Serial name matching. Includes names from issn database.
-"""
-
-import os
-import shelve
-
-__all__ = ["serialsdb"]
-
-
-class SerialsDatabase:
- """
- Lookup allows to lookup serial names, using a database of real serial names.
-
- >>> from serials import serialsdb
- >>> serialsdb.get("Philosophica")
- {'1857-9272', '2232-299X', '2232-3007', '2232-3015'}
-
- """
- def __init__(self, path=None):
- """
- Note that shelve appends "db" to the name automatically. TODO: make this
- auto-download into a cache directory.
- """
- if path is None:
- path = os.path.join(os.path.expanduser("~"), ".cache/fuzzycat/names")
- self.db = shelve.open(path, flag='r')
-
- def __getitem__(self, v):
- return self.db[v]
-
- def get(self, v, default=None, cleanup_pipeline=None):
- if not cleanup_pipeline:
- return self.db.get(v, default=default)
- return self.db.get(cleanup_pipeline(v), default=default)
-
- def close(self):
- self.db.close()
-
-
-# A singleton.
-serialsdb = SerialsDatabase()