Convert readcsvfile to generator.
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 4 Sep 2018 17:48:37 +0000 (19:48 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Tue, 4 Sep 2018 17:48:37 +0000 (19:48 +0200)
seewasser.py

index 600bf3d..f2ab4a7 100755 (executable)
@@ -65,10 +65,8 @@ def writesensordatacsv(config, sensor_id, sensor_name, timestamp, value_type, va
 def readcsvfile(csvfile):
     with open(csvfile, "r", newline="") as file:
         reader = csv.DictReader(file, dialect = "excel", fieldnames=("timestamp", "sensor_id", "sensor_name", "value"))
-        records = []
         for row in reader:
-            records.append(row)
-    return records
+            yield row
 
 
 def writesensordatadb(config, sensor_id, sensor_name, timestamp, value_type, value_raw, value):