-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib_types.py
36 lines (26 loc) · 862 Bytes
/
lib_types.py
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
#!/usr/local/bin/python3
"""Defines different types of libraries and how they map to classes."""
import cul_pub
import zotero_pub
# command line argument settings
CITEULIKE_JSON = "citeulike-json"
ZOTERO_CSV = "zotero-csv"
# mapping from commmand line arg to module that handles it.
LIB_TYPE_MAPPING = {
CITEULIKE_JSON: cul_pub,
ZOTERO_CSV: zotero_pub,
}
LIB_TYPES = list(LIB_TYPE_MAPPING.keys())
def get_lib_module(lib_command_line_arg):
"""Given a command line argument specifying the publication library type,
return the module that handles it.
"""
return LIB_TYPE_MAPPING[lib_command_line_arg]
def get_lib_types_as_text_list():
text_list = ""
for lib_type in LIB_TYPES[0:-1]:
text_list += lib_type + ", "
if text_list:
text_list += " and "
text_list += LIB_TYPES[-1]
return text_list