forked from Doragd/Algorithm-Practice-in-Industry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.py
69 lines (53 loc) · 1.47 KB
/
update.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
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
import re
import ast
import argparse
import crawler
import citer
import render
FILTERS = ['kddcup', 'w.html', 'lbr.html']
def set_args():
parser = argparse.ArgumentParser()
parser.add_argument("--issue", "-i", type=str, help="input issue", required=True)
args = parser.parse_args()
return args
def parse_issue(issue):
try:
issue = issue.replace("\\n", "").replace("\\r", "")
info = ast.literal_eval(issue)
print(info)
assert isinstance(info, list)
assert len(info) > 0 and info[0].get("filter") and info[0].get("confs") and info[0].get("year")
except:
raise Exception("[-] Wrong input!")
return info
def run(confs_str, start_year, filter_str='', FILTERS=FILTERS):
if filter_str:
FILTERS += filter_str.lower().split(' ')
try:
confs = confs_str.lower().split(' ')
except:
confs = []
start_year = int(start_year)
crawler.run_all(
confs=confs,
filter_keywords=FILTERS,
start_year=start_year,
filename='results.json',
threads=20
)
citer.run_all(
confs=[conf + str(start_year) for conf in confs],
mode='parallel'
)
def main():
args = set_args()
info = parse_issue(args.issue)
assert len(info) == 1 # confs and year
item = info[0]
run(
confs_str=item['confs'],
start_year=item['year'],
filter_str=item['filter'],
)
if __name__ == "__main__":
main()