-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathextra_stats.py.example
22 lines (17 loc) · 1003 Bytes
/
extra_stats.py.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import OrderedDict
def compute_extra_categories(data):
def safe_div(x, y): # Permission instead of forgiveness. It just doesnt seem right to do a division and catch a DivideByZero instead of simply bailing out ahead of time.
if y == 0: return 0
return x / y
extra_definitions = OrderedDict([
# add your custom categories and descriptions here
('bob the builder', '(Resonators Deployed x Mods Deployed)'),
('translator per hack', '(Glyph Hack Points / Hacks)')
])
for line in data:
# add your custom categories formulas here
line['bob the builder'] = line['builder'] * line['engineer']
line['translator per hack'] = safe_div(line['translator'], line['hacker']) # be SURE to use safe_div for ALL divisions
return extra_definitions, data