forked from ASFHyP3/hyp3-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmacros.py
More file actions
31 lines (20 loc) · 817 Bytes
/
macros.py
File metadata and controls
31 lines (20 loc) · 817 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
28
29
30
31
import requests
_CREDITS_PER_MONTH_VALUE = 8_000
_COST_PER_CREDIT_VALUE = 0.05
CREDITS_PER_MONTH = f'{_CREDITS_PER_MONTH_VALUE:,}'
def define_env(env):
env.macro(CREDITS_PER_MONTH, 'CREDITS_PER_MONTH')
def get_content(url):
response = requests.get(url)
response.raise_for_status()
return response.content.decode()
env.macro(get_content, 'get_content')
def table_indent(count=1):
return ' ' * count * 8
env.macro(table_indent, 'table_indent')
def max_jobs_per_month(credit_cost):
return f'{_CREDITS_PER_MONTH_VALUE // credit_cost:,}'
env.macro(max_jobs_per_month, 'max_jobs_per_month')
def hyp3_plus_cost(credit_cost):
return f'${_COST_PER_CREDIT_VALUE * credit_cost:,.2f}'
env.macro(hyp3_plus_cost, 'hyp3_plus_cost')