forked from clintecker/python-googleanalytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.py
More file actions
40 lines (30 loc) · 914 Bytes
/
Copy pathdata.py
File metadata and controls
40 lines (30 loc) · 914 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
32
33
34
35
36
37
38
39
40
class DataSet(list):
"""docstring for DataSet"""
def __init__(self):
list.__init__(self)
@property
def list(self):
return [[r.dimension, r.metric] for r in self]
@property
def tuple(self):
return tuple(map(tuple,self.list))
@property
def dict(self):
ds = {}
for dp in self:
ds[dp.dimension] = dp.metric
return ds
class DataPoint:
"""docstring for DataPoint"""
def __init__(self, account=None, connection=None, title=None, dimensions=None, metrics=None):
self.account = account
self.connection = connection
self.title = title
self.dimensions = dimensions
self.metrics = metrics
if len(self.dimensions) == 1:
self.dimension = self.dimensions[0]
if len(self.metrics) == 1:
self.metric = self.metrics[0]
def __repr__(self):
return '<DataPoint: %s / %s>' % (self.account.table_id, self.title)