Last active
July 11, 2016 05:57
-
-
Save LarsBergqvist/76c91bc2f3c41ca976d8b636fe71e16f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime, timedelta | |
from repository_base import Repository | |
class FakeRepository(Repository): | |
def get_data(self,topic_name, numdays): | |
today=datetime.today() | |
# Create some test data | |
# Three values from yesterday and three values from today | |
dataPoint = ( | |
(20.1,today-timedelta(1.8)), | |
(19.1,today-timedelta(1.4)), | |
(22.1,today-timedelta(1.2)), | |
(23.3,today-timedelta(0.9)), | |
(19.1,today-timedelta(0.5)), | |
(30.1,today-timedelta(0.1)) | |
) | |
values = [] | |
labels = [] | |
for value,time in dataPoint: | |
if (time > (today - timedelta(numdays))): | |
values.append(value) | |
labels.append(super(FakeRepository,self).date_formatted(time)) | |
return labels, values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment