forked from raghuboosetty/workday
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
27 lines (23 loc) · 759 Bytes
/
config.py
File metadata and controls
27 lines (23 loc) · 759 Bytes
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
import yaml
import ipdb
class Config:
def __init__(self, file):
self.file = file
def read_companies(self):
companies_file = open(self.file, 'r')
company_subdomains = []
for company_subdomain in companies_file:
company_subdomains.append(company_subdomain.strip())
companies_file.close()
return company_subdomains
def write_company(self, company_subdomain):
company_subdomains = self.read_companies()
if company_subdomain in company_subdomains:
return
companies_file = open(self.file, 'a+')
companies_file.writelines("\n"+company_subdomain)
companies_file.close()
def load_profile(self):
with open(self.file) as profile_file:
profile = yaml.safe_load(profile_file)
return profile