Skip to content

Commit eadbf6a

Browse files
authored
docs: replace calls to __del__ with calls to close (influxdata#200)
1 parent a3e18ee commit eadbf6a

20 files changed

+58
-52
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
### Bug Fixes
44
1. [#193](https://github.com/influxdata/influxdb-client-python/pull/193): Fixed `tasks_api` to use proper function to get `Run`
55

6+
### Documentation
7+
1. [#200](https://github.com/influxdata/influxdb-client-python/pull/200): Updated docs, examples, tests: use `close` instead of `__del__`.
8+
69
## 1.14.0 [2021-01-29]
710

811
### Features

README.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ The batching is configurable by ``write_options``\ :
345345
"""
346346
Close client
347347
"""
348-
_write_client.__del__()
349-
_client.__del__()
348+
_write_client.close()
349+
_client.close()
350350
351351
.. marker-batching-end
352352
@@ -436,7 +436,7 @@ Data are writes in an asynchronous HTTP request.
436436
async_result = write_api.write(bucket="my-bucket", record=[_point1, _point2])
437437
async_result.get()
438438
439-
client.__del__()
439+
client.close()
440440
441441
Synchronous client
442442
""""""""""""""""""
@@ -456,7 +456,7 @@ Data are writes in a synchronous HTTP request.
456456
457457
write_api.write(bucket="my-bucket", record=[_point1, _point2])
458458
459-
client.__del__()
459+
client.close()
460460
461461
Queries
462462
^^^^^^^
@@ -537,7 +537,7 @@ The API also support streaming ``FluxRecord`` via `query_stream <https://github.
537537
"""
538538
Close client
539539
"""
540-
client.__del__()
540+
client.close()
541541
542542
Pandas DataFrame
543543
""""""""""""""""
@@ -580,7 +580,7 @@ The ``client`` is able to retrieve data in `Pandas DataFrame <https://pandas.pyd
580580
"""
581581
Close client
582582
"""
583-
client.__del__()
583+
client.close()
584584
585585
Output:
586586

@@ -677,7 +677,7 @@ If you would like to import gigabytes of data then use our multiprocessing examp
677677
Write data into InfluxDB
678678
"""
679679
write_api.write(bucket="my-bucket", record=data)
680-
write_api.__del__()
680+
write_api.close()
681681
682682
"""
683683
Querying max value of CBOE Volatility Index
@@ -701,7 +701,7 @@ If you would like to import gigabytes of data then use our multiprocessing examp
701701
"""
702702
Close client
703703
"""
704-
client.__del__()
704+
client.close()
705705
706706
.. marker-writes-end
707707
@@ -734,8 +734,8 @@ Efficiency write data from IOT sensor
734734
:param write_api: WriteApi
735735
:return: nothing
736736
"""
737-
write_api.__del__()
738-
db_client.__del__()
737+
write_api.close()
738+
db_client.close()
739739
740740
741741
def sensor_temperature():
@@ -930,7 +930,7 @@ The `delete_api.py <influxdb_client/client/delete_api.py>`_ supports deletes `po
930930
"""
931931
Close client
932932
"""
933-
client.__del__()
933+
client.close()
934934
935935
.. marker-delete-end
936936
@@ -1031,7 +1031,7 @@ that is replacement for python ``datetime.datetime`` object and also you should
10311031
"""
10321032
Close client
10331033
"""
1034-
client.__del__()
1034+
client.close()
10351035
10361036
10371037
Local tests

examples/import_data_set.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def parse_row(row: OrderedDict):
7171
Write data into InfluxDB
7272
"""
7373
write_api.write(bucket="my-bucket", record=data)
74-
write_api.__del__()
74+
write_api.close()
7575

7676
"""
7777
Querying max value of CBOE Volatility Index
@@ -95,4 +95,4 @@ def parse_row(row: OrderedDict):
9595
"""
9696
Close client
9797
"""
98-
client.__del__()
98+
client.close()

examples/import_data_set_multiprocessing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ def terminate(self) -> None:
6060
proc_name = self.name
6161
print()
6262
print('Writer: flushing data...')
63-
self.write_api.__del__()
64-
self.client.__del__()
63+
self.write_api.close()
64+
self.client.close()
6565
print('Writer: closed'.format(proc_name))
6666

6767

@@ -216,4 +216,4 @@ def init_counter(counter, progress, queue):
216216
"""
217217
Close client
218218
"""
219-
client.__del__()
219+
client.close()

examples/influxdb_18_example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
print(point.to_line_protocol())
1919

2020
write_api.write(bucket=bucket, record=point)
21-
write_api.__del__()
21+
write_api.close()
2222

2323
print('*** Query Points ***')
2424

examples/ingest_dataframe_default_tags.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@
4949
"""
5050
Close client
5151
"""
52-
client.__del__()
52+
client.close()

examples/iot_sensor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ def on_exit(db_client: InfluxDBClient, write_api: WriteApi):
2020
:param write_api: WriteApi
2121
:return: nothing
2222
"""
23-
write_api.__del__()
24-
db_client.__del__()
23+
write_api.close()
24+
db_client.close()
2525

2626

2727
def sensor_temperature():

examples/nanosecond_precision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@
4747
"""
4848
Close client
4949
"""
50-
client.__del__()
50+
client.close()

examples/query.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@
7575
"""
7676
Close client
7777
"""
78-
client.__del__()
78+
client.close()

examples/query_from_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"""
4747
Close client
4848
"""
49-
client.__del__()
49+
client.close()
5050

5151

5252

0 commit comments

Comments
 (0)