Skip to content

Commit ddc9eb4

Browse files
aviauaviau
authored andcommitted
Docs: Examples are not doc tests
1 parent 71c2e43 commit ddc9eb4

File tree

3 files changed

+44
-34
lines changed

3 files changed

+44
-34
lines changed

influxdb/client.py

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,16 @@ def from_DSN(dsn, **kwargs):
115115
116116
:Example:
117117
118-
>>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
118+
::
119+
120+
>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
119121
localhost:8086/databasename', timeout=5)
120-
>>> type(cli)
121-
<class 'influxdb.client.InfluxDBClient'>
122-
>>> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
122+
>> type(cli)
123+
<class 'influxdb.client.InfluxDBClient'>
124+
>> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
123125
localhost:8086/databasename', timeout=5, udp_port=159)
124-
>>> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
125-
http://localhost:8086 - True 159
126+
>> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
127+
http://localhost:8086 - True 159
126128
127129
.. note:: parameters provided in `**kwargs` may override dsn parameters
128130
.. note:: when using "udp+influxdb" the specified port (if any) will
@@ -431,9 +433,11 @@ def get_list_database(self):
431433
432434
:Example:
433435
434-
>>> dbs = client.get_list_database()
435-
>>> dbs
436-
[{u'name': u'db1'}, {u'name': u'db2'}, {u'name': u'db3'}]
436+
::
437+
438+
>> dbs = client.get_list_database()
439+
>> dbs
440+
[{u'name': u'db1'}, {u'name': u'db2'}, {u'name': u'db3'}]
437441
"""
438442
return list(self.query("SHOW DATABASES").get_points())
439443

@@ -532,13 +536,15 @@ def get_list_retention_policies(self, database=None):
532536
533537
:Example:
534538
535-
>>> ret_policies = client.get_list_retention_policies('my_db')
536-
>>> ret_policies
537-
[{u'default': True,
538-
u'duration': u'0',
539-
u'name': u'default',
540-
u'replicaN': 1}]
541-
"""
539+
::
540+
541+
>> ret_policies = client.get_list_retention_policies('my_db')
542+
>> ret_policies
543+
[{u'default': True,
544+
u'duration': u'0',
545+
u'name': u'default',
546+
u'replicaN': 1}]
547+
"""
542548
rsp = self.query(
543549
"SHOW RETENTION POLICIES ON %s" % (database or self._database)
544550
)
@@ -555,8 +561,8 @@ def get_list_series(self, database=None):
555561
556562
:Example:
557563
558-
>>> series = client.get_list_series('my_database')
559-
>>> series
564+
>> series = client.get_list_series('my_database')
565+
>> series
560566
[{'name': u'cpu_usage',
561567
'tags': [{u'_id': 1,
562568
u'host': u'server01',
@@ -581,11 +587,13 @@ def get_list_users(self):
581587
582588
:Example:
583589
584-
>>> users = client.get_list_users()
585-
>>> users
586-
[{u'admin': True, u'user': u'user1'},
587-
{u'admin': False, u'user': u'user2'},
588-
{u'admin': False, u'user': u'user3'}]
590+
::
591+
592+
>> users = client.get_list_users()
593+
>> users
594+
[{u'admin': True, u'user': u'user1'},
595+
{u'admin': False, u'user': u'user2'},
596+
{u'admin': False, u'user': u'user3'}]
589597
"""
590598
return list(self.query("SHOW USERS").get_points())
591599

@@ -768,13 +776,15 @@ def from_DSN(dsn, client_base_class=InfluxDBClient,
768776
769777
:Example:
770778
771-
>>> cluster = InfluxDBClusterClient.from_DSN('influxdb://usr:pwd\
779+
::
780+
781+
>> cluster = InfluxDBClusterClient.from_DSN('influxdb://usr:pwd\
772782
@host1:8086,usr:pwd@host2:8086/db_name', timeout=5)
773-
>>> type(cluster)
774-
<class 'influxdb.client.InfluxDBClusterClient'>
775-
>>> cluster.clients
776-
[<influxdb.client.InfluxDBClient at 0x7feb480295d0>,
777-
<influxdb.client.InfluxDBClient at 0x7feb438ec950>]
783+
>> type(cluster)
784+
<class 'influxdb.client.InfluxDBClusterClient'>
785+
>> cluster.clients
786+
[<influxdb.client.InfluxDBClient at 0x7feb480295d0>,
787+
<influxdb.client.InfluxDBClient at 0x7feb438ec950>]
778788
"""
779789
conn_params = urlparse(dsn)
780790
netlocs = conn_params.netloc.split(',')

influxdb/influxdb08/client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ def from_DSN(dsn, **kwargs):
115115
also be passed to this function.
116116
117117
Examples:
118-
>>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
118+
>> cli = InfluxDBClient.from_DSN('influxdb://username:password@\
119119
... localhost:8086/databasename', timeout=5)
120-
>>> type(cli)
120+
>> type(cli)
121121
<class 'influxdb.client.InfluxDBClient'>
122-
>>> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
122+
>> cli = InfluxDBClient.from_DSN('udp+influxdb://username:pass@\
123123
... localhost:8086/databasename', timeout=5, udp_port=159)
124-
>>> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
124+
>> print('{0._baseurl} - {0.use_udp} {0.udp_port}'.format(cli))
125125
http://localhost:8086 - True 159
126126
127127
:param dsn: data source name

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ deps = -r{toxinidir}/requirements.txt
66
-r{toxinidir}/test-requirements.txt
77
py27,py32,py33,py34: pandas
88
# Only install pandas with non-pypy interpreters
9-
commands = nosetests -v {posargs}
9+
commands = nosetests -v --with-doctest {posargs}
1010

1111
[testenv:flake8]
1212
setenv = INFLUXDB_PYTHON_SKIP_SERVER_TESTS=False

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy