-
Notifications
You must be signed in to change notification settings - Fork 0
/
constants.py
149 lines (122 loc) · 4.2 KB
/
constants.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
import pathlib
import os
#### Project Root ####
PROJECT_ROOT = f"{pathlib.Path(__file__).parent.resolve()}"
##### Select Menu Constants #####
AUTO = "Automatically generate entry from url (beta)"
ADD = "Add new job application"
EDIT = "Edit existing job application"
VIEW = "View all job applications"
QUIT = "Quit"
BKP = "Start Backup Daemon"
PRT = "Print to file"
CHOICE_MAP = {
"Automatically generate entry from url (beta)": "auto",
"Add new job application": "add",
"Edit existing job application": "edit",
"View all job applications": "view",
"Quit": "quit",
"Start Backup Daemon": "bkp",
"Print to file": "print",
}
##### File Constants #####
SOURCE_CSV = f"{PROJECT_ROOT}/job_applications.csv"
COLUMN_NAMES = ["Company", "Position", "Date Applied", "Status", "Portal Link", "Notes"]
##### Input Constants #####
INPUT_COMPANY_NAME = "Input company name"
INPUT_POSITION = "Input position"
INPUT_DATE_APPLIED = "Input date applied (DD/MM/YYYY)"
INPUT_PORTAL_LINK = "Input portal link"
INPUT_NOTES = "Input notes"
INPUT_JOB_POSTING_URL = "Enter upto 5 comma separated urls."
INPUT_QUIT = "Type Q to quit."
INPUT_MASS_ADD = "Type M for > 5 urls."
##### Status Constants #####
STATUS_INIT = "Applied"
STATUS_ASSESSMENT = "Assessment"
STATUS_INTERVIEW = "Interview"
STATUS_OFFER = "Offer"
STATUS_REJECTED = "Rejected"
##### Date Constants #####
DATE_NOW = "Today"
DATE_CUSTOM = "Custom"
##### Flag Constants #####
BKP_FLAG = "wbkp"
##### Default Choices #####
DEFAULT_COLUMN_CHOOSE = "Default"
##### COLORS #####
OKGREEN = "\033[1;32m"
INFOBLUE = "\033[1;34m"
WARNING = "\033[1;33m"
FAIL = "\033[1;31m"
ENDC = "\033[0m"
##### Command Constants #####
# GUM_PATH = f"{PROJECT_ROOT}/bin/gum"
GUM_PATH = "gum"
GUM_CHOOSE = [f"{GUM_PATH}", "choose"]
GUM_INPUT_W_PLACEHOLDER = [f"{GUM_PATH}", "input", "--placeholder"]
GUM_FILTER = [f"{GUM_PATH}", "filter", "--fuzzy", "--no-limit", "--sort"]
# BAT = "./bin/bat/bat"
BAT = "bat"
YN = ["YES", "NO"]
NY = ["NO", "YES"]
##### Display Constants #####
MAX_COL_WIDTH = 40
#### Platform Constants ####
PLATFORM_MAP = {
"linkedin": "linkedin",
"joinhandshake": "handshake",
"greenhouse": "greenhouse",
}
#### Auth Constants ####
VAULT_PATH = f"{PROJECT_ROOT}/.vault"
#### Redis Constants ####
REDIS_HOST = "localhost"
REDIS_PORT = 6379
REDIS_CONTAINER_NAME = "redis-trapp"
REDIS_DATA_DIR = f"{REDIS_CONTAINER_NAME}-data"
REDIS_DOCKER_IMAGE_TAG = "redis:7.2.2-bookworm"
REDIS_USERNAME = "default"
REDIS_TEST_PWD = "test"
REDIS_CHARSET = "utf-8"
REDIS_ERRORS = "strict"
REDIS_LOG_FILE = f"{PROJECT_ROOT}/logs/redis.log"
REDIS_STATUS_TMP = f"{PROJECT_ROOT}/logs/redis_status.tmp"
#### Chrome Driver Constants ####
CHROME_DRIVER_VERSIONS_JSON = "https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json"
CHROME_DRIVER_VERSIONS_CACHE = f"{PROJECT_ROOT}/.cache/chrome_driver_versions.json"
CHROME_DRIVER_SYSTEM_ARCH_MAP = {
"Darwin arm64": "mac-arm64",
"Darwin x86_64": "mac-x64",
"Linux x86_64": "linux64",
}
CHROME_DRIVER_EXECUTABLE = f"{PROJECT_ROOT}/bin/chrome-driver/chromedriver-{CHROME_DRIVER_SYSTEM_ARCH_MAP[f'{os.uname().sysname} {os.uname().machine}']}/chromedriver"
CHROME_DRIVER_DEFAULT_OPTS = ["--headless"]
CHROME_DRIVER_NO_HEADLESS_OPTS = ["--no-headless"]
CHROME_DRIVER_INCOGNITO_OPTS = ["--incognito"]
CHROME_DRIVER_SERVER_OPTS = [
"--headless",
"--no-sandbox",
"start-maximized",
"disable-infobars",
"--disable-extensions",
]
CHROME_DRIVER_COOKIE_DIR = f"{PROJECT_ROOT}/.cache/chrome_driver_<platform>"
#### Selenium Constants ####
SELENIUM_TIMEOUT = 5
#### Vault Constants ####
VAULT_PATH = f"{PROJECT_ROOT}/.vault"
#### Multiprocessing Constants ####
MAX_WORKERS = 10
#### Logging Constants ####
LOG_FILENAME = f"{PROJECT_ROOT}/logs/trapp.log"
LOG_THREADED_FILENAME = f"{PROJECT_ROOT}/logs/trapp-threaded.log"
LOG_TMP_FILENAME = f"{PROJECT_ROOT}/logs/run_error.log"
LOG_FILEMODE = "a"
LOG_FORMAT = "%(asctime)s %(name)s %(levelname)s %(message)s"
LOG_DATEFMT = "%Y-%m-%d %H:%M:%S"
#### xvfb Constants ####
XVFB_CACHE_FLAG = f"{PROJECT_ROOT}/.cache/xvfb"
#### Formula configuration ####
FORMULA_CONFIG_PATH = f"{PROJECT_ROOT}/infra/build/config/formula.json"
FORMULA_PATH = f"{PROJECT_ROOT}/infra/build/formula/out"