Commit 8113ce50 authored by julian.gethmann's avatar julian.gethmann

Return namedtuples instead of a tuples

* It's better to return a named tuple than a tuple since one can get
further information from the object itself if one wants to, but it is
compatible with a tuple
parent e6fb867c
......@@ -13,6 +13,7 @@ from __future__ import with_statement
import datetime
import json
from collections import namedtuple
from os import path
from sys import version_info
......@@ -255,7 +256,9 @@ class CassandraHelper(object):
datetime.datetime.fromtimestamp(entry["time"] / 1e9)
for entry in json_data if entry["severity"]["level"] == "OK"
return timestamps, values
dataset = namedtuple("dataset", ["timestamps", "values"])
return dataset(timestamps, values)
class Cassandra(object):
......@@ -441,9 +444,7 @@ class Cassandra(object):
with open(self.json_file, "r") as fobj:
json_data = json.load(fobj)
timestamps, values = CassandraHelper().cassandra_json_to_timeseries(
return timestamps, values
return CassandraHelper().cassandra_json_to_timeseries(json_data)
if __name__ == "__main__":
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment