Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 709131a

Browse files
author
aviau
committed
Flake8 fixes
1 parent be476a4 commit 709131a

File tree

3 files changed

+31
-32
lines changed

3 files changed

+31
-32
lines changed

influxdb/dataframe_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ def write_points(self, data, *args, **kwargs):
4646
if batch_size:
4747
kwargs.pop('batch_size') # don't hand over to InfluxDBClient
4848
for key, data_frame in data.items():
49-
number_batches = int(math.ceil(len(data_frame)
50-
/ float(batch_size)))
49+
number_batches = int(math.ceil(
50+
len(data_frame) / float(batch_size)))
5151
for batch in range(number_batches):
5252
start_index = batch * batch_size
5353
end_index = (batch + 1) * batch_size

tests/influxdb/client_test.py

+27-28
Original file line numberDiff line numberDiff line change
@@ -103,33 +103,32 @@ def test_switch_user(self):
103103
assert cli._password == 'another_password'
104104

105105
def test_write(self):
106-
with requests_mock.Mocker() as m:
107-
m.register_uri(
108-
requests_mock.POST,
109-
"http://localhost:8086/write"
110-
)
111-
112-
cli = InfluxDBClient(database='db')
113-
cli.write(
114-
{"database": "mydb",
115-
"retentionPolicy": "mypolicy",
116-
"points": [{"name": "cpu_load_short",
117-
"tags": {"host": "server01",
118-
"region": "us-west"},
119-
"timestamp": "2009-11-10T23:00:00Z",
120-
"values": {"value": 0.64}}]}
121-
)
122-
123-
self.assertEqual(
124-
json.loads(m.last_request.body),
125-
{"database": "mydb",
126-
"retentionPolicy": "mypolicy",
127-
"points": [{"name": "cpu_load_short",
128-
"tags": {"host": "server01",
129-
"region": "us-west"},
130-
"timestamp": "2009-11-10T23:00:00Z",
131-
"values": {"value": 0.64}}]}
132-
)
106+
with requests_mock.Mocker() as m:
107+
m.register_uri(
108+
requests_mock.POST,
109+
"http://localhost:8086/write"
110+
)
111+
cli = InfluxDBClient(database='db')
112+
cli.write(
113+
{"database": "mydb",
114+
"retentionPolicy": "mypolicy",
115+
"points": [{"name": "cpu_load_short",
116+
"tags": {"host": "server01",
117+
"region": "us-west"},
118+
"timestamp": "2009-11-10T23:00:00Z",
119+
"values": {"value": 0.64}}]}
120+
)
121+
122+
self.assertEqual(
123+
json.loads(m.last_request.body),
124+
{"database": "mydb",
125+
"retentionPolicy": "mypolicy",
126+
"points": [{"name": "cpu_load_short",
127+
"tags": {"host": "server01",
128+
"region": "us-west"},
129+
"timestamp": "2009-11-10T23:00:00Z",
130+
"values": {"value": 0.64}}]}
131+
)
133132

134133
def test_write_points(self):
135134
with requests_mock.Mocker() as m:
@@ -539,7 +538,7 @@ def test_get_database_users(self):
539538
cli = InfluxDBClient('localhost', 8086, 'username', 'password', 'db')
540539

541540
example_response = \
542-
'[{"name":"paul","isAdmin":false,"writeTo":".*","readFrom":".*"},' \
541+
'[{"name":"paul","isAdmin":false,"writeTo":".*","readFrom":".*"},'\
543542
'{"name":"bobby","isAdmin":false,"writeTo":".*","readFrom":".*"}]'
544543

545544
with requests_mock.Mocker() as m:

tests/influxdb/dataframe_client_test.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"""
33
unit tests for misc module
44
"""
5+
from .client_test import _mocked_session
6+
57
import unittest
68
import json
79
import requests_mock
@@ -16,8 +18,6 @@
1618
from pandas.util.testing import assert_frame_equal
1719
from influxdb import DataFrameClient
1820

19-
from .client_test import _mocked_session
20-
2121

2222
@skipIfPYpy
2323
class TestDataFrameClient(unittest.TestCase):

0 commit comments

Comments
 (0)