forked from marvinvo/Repository_Miner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
44 lines (37 loc) · 1.39 KB
/
settings.py
File metadata and controls
44 lines (37 loc) · 1.39 KB
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
ARG_FETCH = "fetch"
ARG_DOWNLOAD = "download"
ARG_COMPILE = "compile"
ARG_RESULTFOLDER = "resultsfolder"
ARG_PROCESS_LIMIT = "maxprocesses"
ARG_TOKEN_FILE = "tokenfile"
ARG_SORT = "sort"
ARG_ORDER = "order"
ARG_FORK = "fork"
ARG_FILTER = "filter"
ARG_LAST_SORT = "lastsort"
ARG_EXEC_AFTER_FETCH = "" # probably unneccassary feature
ARG_EXEC_AFTER_DOWNLOAD = "execAfterDownload"
ARG_SHELL_SCRIPT = "execonsuccess" # this is acutally ARG_EXEC_AFTER_COMPILE
ARG_CLEAN_AFTER_FAILURE = "keepclean"
ARG_STATS_TO_FILE = "writestats"
FILENAME_REPO_JSON = "github.json"
FILENAME_WORKER_LOG = "worker.log"
FILENAME_DOWNLOAD_LOG = "download.log"
FILENAME_COMPILE_LOG = "compile.log"
FILENAME_SHELL_LOG = "shell.log"
FILENAME_EXTENSION_FOR_ERRORS = "errors_" # e.g. errors_shell.log for shell errors
TIMEOUT_DOWNLOAD = 600
TIMEOUT_COMPILE = 1200
TIMEOUT_SHELL = 1200
class Settings(dict):
def parse_args(self, args):
for key in args:
self[key] = args[key]
if ARG_TOKEN_FILE in self:
# read in token file
with open(self[ARG_TOKEN_FILE], 'r') as f:
self[ARG_TOKEN_FILE] = [[row[0], row[1], None] for row in [line.replace('\n','').split(',') for line in f.readlines()]]
if ARG_PROCESS_LIMIT in self:
# the tool requires at least one process to run
pl = self[ARG_PROCESS_LIMIT]
self[ARG_PROCESS_LIMIT] = max(1, pl)