Skip to content

Commit 11c71f2

Browse files
authored
Merge pull request influxdata#424 from cadnce/master
Tidy up
2 parents 199e22e + 268f2a7 commit 11c71f2

File tree

6 files changed

+25
-18
lines changed

6 files changed

+25
-18
lines changed

influxdb/_dataframe_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def _convert_dataframe_to_lines(self,
227227
measurement,
228228
field_columns=None,
229229
tag_columns=None,
230-
global_tags={},
230+
global_tags=None,
231231
time_precision=None,
232232
numeric_precision=None):
233233

@@ -366,7 +366,7 @@ def _stringify_dataframe(self,
366366

367367
if datatype == 'field':
368368
# If dealing with fields, format ints and strings correctly
369-
dataframe[int_columns] = dataframe[int_columns] + 'i'
369+
dataframe[int_columns] += 'i'
370370
dataframe[string_columns] = '"' + dataframe[string_columns] + '"'
371371
elif datatype == 'tag':
372372
dataframe = dataframe.apply(_escape_pandas_series)

influxdb/client.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ def request(self, url, method='GET', params=None, data=None,
205205
:param expected_response_code: the expected response code of
206206
the request, defaults to 200
207207
:type expected_response_code: int
208+
:param headers: headers to add to the request
209+
:type headers: dict
208210
:returns: the response from the request
209211
:rtype: :class:`requests.Response`
210212
:raises InfluxDBServerError: if the response code is any server error
@@ -245,7 +247,7 @@ def request(self, url, method='GET', params=None, data=None,
245247
else:
246248
raise e
247249

248-
if response.status_code >= 500 and response.status_code < 600:
250+
if 500 <= response.status_code < 600:
249251
raise InfluxDBServerError(response.content)
250252
elif response.status_code == expected_response_code:
251253
return response
@@ -322,6 +324,11 @@ def query(self,
322324
:param params: additional parameters for the request, defaults to {}
323325
:type params: dict
324326
327+
:param epoch: response timestamps to be in epoch format either 'h',
328+
'm', 's', 'ms', 'u', or 'ns',defaults to `None` which is
329+
RFC3339 UTC format with nanosecond precision
330+
:type epoch: str
331+
325332
:param expected_response_code: the expected status code of response,
326333
defaults to 200
327334
:type expected_response_code: int
@@ -396,7 +403,7 @@ def write_points(self,
396403
397404
:param points: the list of points to be written in the database
398405
:type points: list of dictionaries, each dictionary represents a point
399-
:type data: (if protocol is 'json') list of dicts, where each dict
406+
:type points: (if protocol is 'json') list of dicts, where each dict
400407
represents a point.
401408
(if protocol is 'line') sequence of line protocol strings.
402409
:param time_precision: Either 's', 'm', 'ms' or 'u', defaults to None
@@ -575,7 +582,7 @@ def alter_retention_policy(self, name, database=None,
575582
:type duration: str
576583
:param replication: the new replication of the existing
577584
retention policy
578-
:type replication: str
585+
:type replication: int
579586
:param default: whether or not to set the modified policy as default
580587
:type default: bool
581588
@@ -704,9 +711,9 @@ def delete_series(self, database=None, measurement=None, tags=None):
704711
deleted, defaults to client's current database
705712
:type database: str
706713
:param measurement: Delete all series from a measurement
707-
:type id: str
714+
:type measurement: str
708715
:param tags: Delete all series that match given tags
709-
:type id: dict
716+
:type tags: dict
710717
"""
711718
database = database or self._database
712719
query_str = 'DROP SERIES'

influxdb/tests/client_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def __init__(self, *args, **kwargs):
838838

839839
def query(self,
840840
query,
841-
params={},
841+
params=None,
842842
expected_response_code=200,
843843
database=None):
844844
if query == 'Fail':

influxdb/tests/helper_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ class Meta:
261261
self.assertEqual(point2['time'], yesterday)
262262

263263
def testInvalidHelpers(self):
264-
'''
264+
"""
265265
Tests errors in invalid helpers.
266-
'''
266+
"""
267267
class MissingMeta(SeriesHelper):
268268
pass
269269

influxdb/tests/influxdb08/helper_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def testSingleSeriesName(self):
8383
'Resetting helper did not empty datapoints.')
8484

8585
def testSeveralSeriesNames(self):
86-
'''
86+
"""
8787
Tests JSON conversion when there is only one series name.
88-
'''
88+
"""
8989
TestSeriesHelper.MySeriesHelper(server_name='us.east-1', time=159)
9090
TestSeriesHelper.MySeriesHelper(server_name='fr.paris-10', time=158)
9191
TestSeriesHelper.MySeriesHelper(server_name='lu.lux', time=157)
@@ -116,9 +116,9 @@ def testSeveralSeriesNames(self):
116116
'Resetting helper did not empty datapoints.')
117117

118118
def testInvalidHelpers(self):
119-
'''
119+
"""
120120
Tests errors in invalid helpers.
121-
'''
121+
"""
122122
class MissingMeta(SeriesHelper):
123123
pass
124124

influxdb/tests/server_tests/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ def _teardown_influxdb_server(inst):
4141

4242

4343
class SingleTestCaseWithServerMixin(object):
44-
''' A mixin for unittest.TestCase to start an influxdb server instance
44+
""" A mixin for unittest.TestCase to start an influxdb server instance
4545
in a temporary directory **for each test function/case**
46-
'''
46+
"""
4747

4848
# 'influxdb_template_conf' attribute must be set
4949
# on the TestCase class or instance.
@@ -53,10 +53,10 @@ class SingleTestCaseWithServerMixin(object):
5353

5454

5555
class ManyTestCasesWithServerMixin(object):
56-
''' Same than SingleTestCaseWithServerMixin
56+
""" Same than SingleTestCaseWithServerMixin
5757
but creates a single instance for the whole class.
5858
Also pre-creates a fresh database: 'db'.
59-
'''
59+
"""
6060

6161
# 'influxdb_template_conf' attribute must be set on the class itself !
6262

0 commit comments

Comments
 (0)