Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Quick convenience dict and initialization on named chart entities

  • Loading branch information...
commit b1e9d0360cb29efcf0369d90934bef50c5b65995 1 parent 82233c9
Adam Lindsay authored

Showing 1 changed file with 27 additions and 1 deletion. Show diff stats Hide diff stats

  1. +27 1 src/chart.py
28 src/chart.py
... ... @@ -1,5 +1,26 @@
1 1 from entity import *
2 2
  3 +CHARTS = {
  4 +'fans adds last day': 'bb789492225c4c4da2e15f617acc9982',
  5 +'fans adds last week': 'a5e7dbdfcd984dc28c350c26a2e703c0',
  6 +'fans daily high flyers': 'c6db7136d639444d9ab54a3c66e0b813',
  7 +'fans total': '6aacf495049d4de99c809b0ad8120c39',
  8 +'video views last day': '1574c43703344292a753fecf0f793c2e',
  9 +'video views last week': 'b0de4888427d46ac8f599f2f6d51e293',
  10 +'video views total': '3040cc0f02ed4dd1a2da9ea95c9a8272',
  11 +'new comments last day': 'd21e3cd170924bcd8874ec15d84b64f1',
  12 +'new comments last week': '75f972a32f3547e197668d545f4cda1d',
  13 +'comments total': '7908e358427f4efe9f5aac6df69bfcbd',
  14 +'plays last day': 'd527eeba4bdc42178b49d977b375936f',
  15 +'plays last week': '627b42c981d4413b83191efd8183a982',
  16 +'plays daily high flyers': 'b857276b34cf488f9a934765c3281af7',
  17 +'plays total': '7a614a370a2848b29c156e27dde582c8',
  18 +'page views last day': '8a826f01468d43d7b64d829d5f889e04',
  19 +'page views last week': '3fc5101590484f15ae48903ec6ce3ed5',
  20 +'page views daily high flyers': '8f55159307d6429fac6c5e9b04fc6449',
  21 +'page views total': '765855505c7f4e3bb1fc887740f2dd1a',
  22 +'downloads daily high flyers': '2960402fc260409c8bcd75b00d8dc4c8'
  23 +}
3 24
4 25 class Chart(Entity):
5 26 """
@@ -9,7 +30,12 @@ class Chart(Entity):
9 30 """
10 31 def __init__(self, chartUUID):
11 32 self.entity_type = 'chart'
12   - self.entity_id = chartUUID
  33 + if chartUUID in CHARTS:
  34 + self.entity_id = CHARTS[chartUUID]
  35 + elif len(chartUUID) == 32:
  36 + self.entity_id = chartUUID
  37 + else:
  38 + raise ValueError("Unknown chart type")
13 39 self.response_from()
14 40 assert self.response['class'] == "chart" #verify that uuid is a chart
15 41 chart_type = [e_type

0 comments on commit b1e9d03

Please sign in to comment.
Something went wrong with that request. Please try again.