-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathutil.py
More file actions
211 lines (184 loc) · 4.8 KB
/
Copy pathutil.py
File metadata and controls
211 lines (184 loc) · 4.8 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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import pandas
from process_report.invoices import (
invoice,
pi_specific_invoice,
prepay_credits_snapshot,
NERC_total_invoice,
)
from process_report.processors import (
coldfront_fetch_processor,
validate_pi_alias_processor,
lenovo_processor,
validate_billable_pi_processor,
new_pi_credit_processor,
bu_subsidy_processor,
prepayment_processor,
validate_cluster_name_processor,
)
def new_base_invoice(
name="",
invoice_month="0000-00",
data=None,
):
if data is None:
data = pandas.DataFrame()
return invoice.Invoice(invoice_month, data, name)
def new_pi_specific_invoice(
name="",
invoice_month="0000-00",
data=None,
):
if data is None:
data = pandas.DataFrame()
return pi_specific_invoice.PIInvoice(
invoice_month,
data,
name,
)
def new_nerc_total_invoice(
name="",
invoice_month="0000-00",
data=None,
):
if data is None:
data = pandas.DataFrame()
return NERC_total_invoice.NERCTotalInvoice(
invoice_month,
data,
name,
)
def new_coldfront_fetch_processor(
name="",
invoice_month="0000-00",
data=None,
nonbillable_projects=None,
coldfront_data_filepaths=(),
):
if data is None:
data = pandas.DataFrame()
if nonbillable_projects is None:
nonbillable_projects = pandas.DataFrame(
columns=["Project Name", "Cluster", "Is Timed", "Is Billable Override"]
)
return coldfront_fetch_processor.ColdfrontFetchProcessor(
invoice_month,
data,
name,
nonbillable_projects,
coldfront_data_filepaths,
)
def new_validate_pi_alias_processor(
name="", invoice_month="0000-00", data=None, alias_map=None
):
if data is None:
data = pandas.DataFrame()
if alias_map is None:
alias_map = {}
return validate_pi_alias_processor.ValidatePIAliasProcessor(
invoice_month, data, name, alias_map
)
def new_lenovo_processor(
name="", invoice_month="0000-00", data=None, su_charge_info=None
):
if data is None:
data = pandas.DataFrame()
if su_charge_info is None:
su_charge_info = {}
return lenovo_processor.LenovoProcessor(invoice_month, data, name, su_charge_info)
def new_validate_billable_pi_processor(
name="",
invoice_month="0000-00",
data=None,
nonbillable_pis=None,
nonbillable_projects=None,
):
if data is None:
data = pandas.DataFrame()
if nonbillable_pis is None:
nonbillable_pis = []
if nonbillable_projects is None:
nonbillable_projects = pandas.DataFrame(
columns=["Project Name", "Cluster", "Is Timed", "Is Billable Override"]
)
return validate_billable_pi_processor.ValidateBillablePIsProcessor(
invoice_month,
data,
name,
nonbillable_pis,
nonbillable_projects,
)
def new_new_pi_credit_processor(
name="",
invoice_month="0000-00",
data=None,
old_pi_filepath="",
credit_amount=1000,
limit_new_pi_credit_to_partners=False,
upload_to_s3=False,
):
if data is None:
data = pandas.DataFrame()
return new_pi_credit_processor.NewPICreditProcessor(
invoice_month,
data,
name,
old_pi_filepath,
credit_amount,
limit_new_pi_credit_to_partners,
upload_to_s3,
)
def new_bu_subsidy_processor(
name="",
invoice_month="0000-00",
data=None,
subsidy_amount=0,
):
if data is None:
data = pandas.DataFrame()
return bu_subsidy_processor.BUSubsidyProcessor(
invoice_month, data, name, subsidy_amount
)
def new_prepayment_processor(
name="",
invoice_month="0000-00",
data=None,
prepay_credits=None,
prepay_debits_filepath="",
prepay_projects=None,
prepay_contacts=None,
upload_to_s3=False,
):
if prepay_credits is None:
prepay_credits = pandas.DataFrame()
if prepay_projects is None:
prepay_projects = pandas.DataFrame()
if prepay_contacts is None:
prepay_contacts = pandas.DataFrame()
return prepayment_processor.PrepaymentProcessor(
invoice_month,
data,
name,
prepay_credits,
prepay_projects,
prepay_contacts,
prepay_debits_filepath,
upload_to_s3,
)
def new_prepay_credits_snapshot(
name="",
invoice_month="0000-00",
data=None,
prepay_credits=None,
prepay_contacts=None,
):
return prepay_credits_snapshot.PrepayCreditsSnapshot(
invoice_month, data, name, prepay_credits, prepay_contacts
)
def new_validate_cluster_name_processor(
name="",
invoice_month="0000-00",
data=None,
):
return validate_cluster_name_processor.ValidateClusterNameProcessor(
invoice_month, data, name
)