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

Tidy up #424

Merged
merged 3 commits into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions influxdb/_dataframe_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _convert_dataframe_to_lines(self,
measurement,
field_columns=None,
tag_columns=None,
global_tags={},
global_tags=None,
time_precision=None,
numeric_precision=None):

Expand Down Expand Up @@ -366,7 +366,7 @@ def _stringify_dataframe(self,

if datatype == 'field':
# If dealing with fields, format ints and strings correctly
dataframe[int_columns] = dataframe[int_columns] + 'i'
dataframe[int_columns] += 'i'
dataframe[string_columns] = '"' + dataframe[string_columns] + '"'
elif datatype == 'tag':
dataframe = dataframe.apply(_escape_pandas_series)
Expand Down
17 changes: 12 additions & 5 deletions influxdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ def request(self, url, method='GET', params=None, data=None,
:param expected_response_code: the expected response code of
the request, defaults to 200
:type expected_response_code: int
:param headers: headers to add to the request
:type headers: dict
:returns: the response from the request
:rtype: :class:`requests.Response`
:raises InfluxDBServerError: if the response code is any server error
Expand Down Expand Up @@ -245,7 +247,7 @@ def request(self, url, method='GET', params=None, data=None,
else:
raise e

if response.status_code >= 500 and response.status_code < 600:
if 500 <= response.status_code < 600:
raise InfluxDBServerError(response.content)
elif response.status_code == expected_response_code:
return response
Expand Down Expand Up @@ -322,6 +324,11 @@ def query(self,
:param params: additional parameters for the request, defaults to {}
:type params: dict

:param epoch: response timestamps to be in epoch format either 'h',
'm', 's', 'ms', 'u', or 'ns',defaults to `None` which is
RFC3339 UTC format with nanosecond precision
:type epoch: str

:param expected_response_code: the expected status code of response,
defaults to 200
:type expected_response_code: int
Expand Down Expand Up @@ -396,7 +403,7 @@ def write_points(self,

:param points: the list of points to be written in the database
:type points: list of dictionaries, each dictionary represents a point
:type data: (if protocol is 'json') list of dicts, where each dict
:type points: (if protocol is 'json') list of dicts, where each dict
represents a point.
(if protocol is 'line') sequence of line protocol strings.
:param time_precision: Either 's', 'm', 'ms' or 'u', defaults to None
Expand Down Expand Up @@ -575,7 +582,7 @@ def alter_retention_policy(self, name, database=None,
:type duration: str
:param replication: the new replication of the existing
retention policy
:type replication: str
:type replication: int
:param default: whether or not to set the modified policy as default
:type default: bool

Expand Down Expand Up @@ -704,9 +711,9 @@ def delete_series(self, database=None, measurement=None, tags=None):
deleted, defaults to client's current database
:type database: str
:param measurement: Delete all series from a measurement
:type id: str
:type measurement: str
:param tags: Delete all series that match given tags
:type id: dict
:type tags: dict
"""
database = database or self._database
query_str = 'DROP SERIES'
Expand Down
2 changes: 1 addition & 1 deletion influxdb/tests/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ def __init__(self, *args, **kwargs):

def query(self,
query,
params={},
params=None,
expected_response_code=200,
database=None):
if query == 'Fail':
Expand Down
4 changes: 2 additions & 2 deletions influxdb/tests/helper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ class Meta:
self.assertEqual(point2['time'], yesterday)

def testInvalidHelpers(self):
'''
"""
Tests errors in invalid helpers.
'''
"""
class MissingMeta(SeriesHelper):
pass

Expand Down
8 changes: 4 additions & 4 deletions influxdb/tests/influxdb08/helper_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def testSingleSeriesName(self):
'Resetting helper did not empty datapoints.')

def testSeveralSeriesNames(self):
'''
"""
Tests JSON conversion when there is only one series name.
'''
"""
TestSeriesHelper.MySeriesHelper(server_name='us.east-1', time=159)
TestSeriesHelper.MySeriesHelper(server_name='fr.paris-10', time=158)
TestSeriesHelper.MySeriesHelper(server_name='lu.lux', time=157)
Expand Down Expand Up @@ -116,9 +116,9 @@ def testSeveralSeriesNames(self):
'Resetting helper did not empty datapoints.')

def testInvalidHelpers(self):
'''
"""
Tests errors in invalid helpers.
'''
"""
class MissingMeta(SeriesHelper):
pass

Expand Down
8 changes: 4 additions & 4 deletions influxdb/tests/server_tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ def _teardown_influxdb_server(inst):


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

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


class ManyTestCasesWithServerMixin(object):
''' Same than SingleTestCaseWithServerMixin
""" Same than SingleTestCaseWithServerMixin
but creates a single instance for the whole class.
Also pre-creates a fresh database: 'db'.
'''
"""

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

Expand Down