Skip to content

Commit 143ccf6

Browse files
committed
#2: Improve readability
1 parent fb813e9 commit 143ccf6

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def parse_row(row: OrderedDict):
153153
"""
154154
Converts vix-daily.csv into sequence of data point
155155
"""
156-
data = rx.from_iterable(DictReader(open('vix-daily.csv', 'r'))) \
156+
data = rx \
157+
.from_iterable(DictReader(open('vix-daily.csv', 'r'))) \
157158
.pipe(ops.map(lambda row: parse_row(row)))
158159

159160
client = InfluxDBClient(url="http://localhost:9999/api/v2", token="my-token-123", org="my-org", debug=True)
@@ -257,7 +258,8 @@ def line_protocol(temperature):
257258
"""
258259
Read temperature every minute; distinct_until_changed - produce only if temperature change
259260
"""
260-
data = rx.interval(period=timedelta(seconds=60))\
261+
data = rx\
262+
.interval(period=timedelta(seconds=60))\
261263
.pipe(ops.map(lambda t: sensor_temperature()),
262264
ops.map(lambda temperature: line_protocol(temperature)),
263265
ops.distinct_until_changed())

influxdb2_test/import_data_set.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ def parse_row(row: OrderedDict):
4646
"""
4747
Converts vix-daily.csv into sequence of data point
4848
"""
49-
data = rx.from_iterable(DictReader(open('vix-daily.csv', 'r'))) \
49+
data = rx \
50+
.from_iterable(DictReader(open('vix-daily.csv', 'r'))) \
5051
.pipe(ops.map(lambda row: parse_row(row)))
5152

5253
client = InfluxDBClient(url="http://localhost:9999/api/v2", token="my-token-123", org="my-org", debug=True)

influxdb2_test/iot_sensor.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ def line_protocol(temperature):
5656
"""
5757
Read temperature every minute; distinct_until_changed - produce only if temperature change
5858
"""
59-
data = rx.interval(period=timedelta(seconds=60))\
59+
data = rx\
60+
.interval(period=timedelta(seconds=60))\
6061
.pipe(ops.map(lambda t: sensor_temperature()),
6162
ops.map(lambda temperature: line_protocol(temperature)),
6263
ops.distinct_until_changed())

0 commit comments

Comments
 (0)