-
Notifications
You must be signed in to change notification settings - Fork 1
/
filepath.py
73 lines (60 loc) · 2.14 KB
/
filepath.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
import os
from config import ROOT
from datetime import datetime
class Filepath(object):
@classmethod
def get_root(self):
"""
Returns the path of btsReal
"""
return ROOT
@classmethod
def get_accounts_dir(self):
return self.get_root() + '/accountFiles'
@classmethod
def get_accounts_file(self):
"""
Returns the path of the excel file containing account info
for emails and beatthestreak accounts on mlb.com
"""
return self.get_accounts_dir() + '/btsAccounts.xlsx'
@classmethod
def get_test_accounts_file(self):
"""
Returns the path of the excel file containing account info
for test accounts on mlb.com
"""
return self.get_accounts_dir() + "/nonProductionBtsAccounts.xlsx"
@classmethod
def get_log_file(self, activeDate, sN, vMN, test=False):
"""
Returns the path of the .txt file containing logs
"""
date = activeDate.strftime('%m-%d-%Y')
# today = datetime.today().date().strftime('%m-%d-%Y')
if test:
rootFolder = self.get_root() + '/tests/logs/sN{}vMN{}/',format(sN,vMN)
else:
rootFolder = self.get_root() + '/logs/sN{}vMN{}/'.format(sN, vMN)
if not os.path.isdir(rootFolder):
os.mkdir(rootFolder)
return rootFolder + date + '.txt'
@classmethod
def get_minion_account_file(self, sN=None, vMN=None):
"""
int int -> None
sN: int | strategy number
vMN: int | virtual machine number
Returns the path of the .xlsx file that holds account info
for accounts operating under strategy number sN and controlled
by virtual machine vMN
"""
## Type checking
assert type(sN) == int
assert type(sN) == int
## If the dir doesn't exist, create it
dirpath = self.get_accounts_dir() + '/minionAccountFiles'
if not os.path.isdir(dirpath):
os.mkdir(dirpath)
## Return the formmatted file name for this specific sN and vMN
return dirpath + '/sN={},vMN={}.xlsx'.format(sN, vMN)