File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ def write_points(self,
4444 dataframe ,
4545 measurement ,
4646 tags = None ,
47- tag_columns = [] ,
48- field_columns = [] ,
47+ tag_columns = None ,
48+ field_columns = None ,
4949 time_precision = None ,
5050 database = None ,
5151 retention_policy = None ,
@@ -72,6 +72,10 @@ def write_points(self,
7272 figures for float and all significant figures for int datatypes.
7373
7474 """
75+ if tag_columns is None :
76+ tag_columns = []
77+ if field_columns is None :
78+ field_columns = []
7579 if batch_size :
7680 number_batches = int (math .ceil (len (dataframe ) / float (batch_size )))
7781 for batch in range (number_batches ):
@@ -166,8 +170,8 @@ def _convert_dataframe_to_json(self,
166170 dataframe ,
167171 measurement ,
168172 tags = None ,
169- tag_columns = [] ,
170- field_columns = [] ,
173+ tag_columns = None ,
174+ field_columns = None ,
171175 time_precision = None ):
172176
173177 if not isinstance (dataframe , pd .DataFrame ):
@@ -221,9 +225,9 @@ def _convert_dataframe_to_json(self,
221225 def _convert_dataframe_to_lines (self ,
222226 dataframe ,
223227 measurement ,
224- field_columns = [] ,
225- tag_columns = [] ,
226- global_tags = {} ,
228+ field_columns = None ,
229+ tag_columns = None ,
230+ global_tags = None ,
227231 time_precision = None ,
228232 numeric_precision = None ):
229233
@@ -242,6 +246,8 @@ def _convert_dataframe_to_lines(self,
242246 field_columns = []
243247 if tag_columns is None :
244248 tag_columns = []
249+ if global_tags is None :
250+ global_tags = {}
245251
246252 # Make sure field_columns and tag_columns are lists
247253 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):
131131 def _get_port (self ):
132132 return self .__port
133133
134- @staticmethod
135- def from_DSN (dsn , ** kwargs ):
134+ @classmethod
135+ def from_DSN (cls , dsn , ** kwargs ):
136136 """Return an instance of :class:`~.InfluxDBClient` from the provided
137137 data source name. Supported schemes are "influxdb", "https+influxdb"
138138 and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient`
@@ -169,7 +169,7 @@ def from_DSN(dsn, **kwargs):
169169 init_args ['port' ] = port
170170 init_args .update (kwargs )
171171
172- return InfluxDBClient (** init_args )
172+ return cls (** init_args )
173173
174174 def switch_database (self , database ):
175175 """Change the client's database.
You can’t perform that action at this time.
0 commit comments