This repository was archived by the owner on Oct 29, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ def write_points(self,
44
44
dataframe ,
45
45
measurement ,
46
46
tags = None ,
47
- tag_columns = [] ,
48
- field_columns = [] ,
47
+ tag_columns = None ,
48
+ field_columns = None ,
49
49
time_precision = None ,
50
50
database = None ,
51
51
retention_policy = None ,
@@ -72,6 +72,10 @@ def write_points(self,
72
72
figures for float and all significant figures for int datatypes.
73
73
74
74
"""
75
+ if tag_columns is None :
76
+ tag_columns = []
77
+ if field_columns is None :
78
+ field_columns = []
75
79
if batch_size :
76
80
number_batches = int (math .ceil (len (dataframe ) / float (batch_size )))
77
81
for batch in range (number_batches ):
@@ -166,8 +170,8 @@ def _convert_dataframe_to_json(self,
166
170
dataframe ,
167
171
measurement ,
168
172
tags = None ,
169
- tag_columns = [] ,
170
- field_columns = [] ,
173
+ tag_columns = None ,
174
+ field_columns = None ,
171
175
time_precision = None ):
172
176
173
177
if not isinstance (dataframe , pd .DataFrame ):
@@ -221,9 +225,9 @@ def _convert_dataframe_to_json(self,
221
225
def _convert_dataframe_to_lines (self ,
222
226
dataframe ,
223
227
measurement ,
224
- field_columns = [] ,
225
- tag_columns = [] ,
226
- global_tags = {} ,
228
+ field_columns = None ,
229
+ tag_columns = None ,
230
+ global_tags = None ,
227
231
time_precision = None ,
228
232
numeric_precision = None ):
229
233
@@ -242,6 +246,8 @@ def _convert_dataframe_to_lines(self,
242
246
field_columns = []
243
247
if tag_columns is None :
244
248
tag_columns = []
249
+ if global_tags is None :
250
+ global_tags = {}
245
251
246
252
# Make sure field_columns and tag_columns are lists
247
253
field_columns = list (field_columns ) if list (field_columns ) else []
Original file line number Diff line number Diff line change @@ -131,8 +131,8 @@ def _port(self):
131
131
def _get_port (self ):
132
132
return self .__port
133
133
134
- @staticmethod
135
- def from_DSN (dsn , ** kwargs ):
134
+ @classmethod
135
+ def from_DSN (cls , dsn , ** kwargs ):
136
136
"""Return an instance of :class:`~.InfluxDBClient` from the provided
137
137
data source name. Supported schemes are "influxdb", "https+influxdb"
138
138
and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient`
@@ -169,7 +169,7 @@ def from_DSN(dsn, **kwargs):
169
169
init_args ['port' ] = port
170
170
init_args .update (kwargs )
171
171
172
- return InfluxDBClient (** init_args )
172
+ return cls (** init_args )
173
173
174
174
def switch_database (self , database ):
175
175
"""Change the client's database.
You can’t perform that action at this time.
0 commit comments