1010TIMESERIES_DB = getattr (settings , "TIMESERIES_DATABASE" , None )
1111if not TIMESERIES_DB :
1212 TIMESERIES_DB = {
13- ' BACKEND' : ' openwisp_monitoring.db.backends.influxdb' ,
14- ' USER' : getattr (settings , ' INFLUXDB_USER' , ' openwisp' ),
15- ' PASSWORD' : getattr (settings , ' INFLUXDB_PASSWORD' , ' openwisp' ),
16- ' NAME' : getattr (settings , ' INFLUXDB_DATABASE' , ' openwisp2' ),
17- ' HOST' : getattr (settings , ' INFLUXDB_HOST' , ' localhost' ),
18- ' PORT' : getattr (settings , ' INFLUXDB_PORT' , ' 8086' ),
13+ " BACKEND" : " openwisp_monitoring.db.backends.influxdb" ,
14+ " USER" : getattr (settings , " INFLUXDB_USER" , " openwisp" ),
15+ " PASSWORD" : getattr (settings , " INFLUXDB_PASSWORD" , " openwisp" ),
16+ " NAME" : getattr (settings , " INFLUXDB_DATABASE" , " openwisp2" ),
17+ " HOST" : getattr (settings , " INFLUXDB_HOST" , " localhost" ),
18+ " PORT" : getattr (settings , " INFLUXDB_PORT" , " 8086" ),
1919 }
2020 logger .warning (
21- ' The previous method to define Timeseries Database has been deprecated. Please refer to the docs:\n '
22- ' https://github.com/openwisp/openwisp-monitoring#setup-integrate-in-an-existing-django-project'
21+ " The previous method to define Timeseries Database has been deprecated. Please refer to the docs:\n "
22+ " https://github.com/openwisp/openwisp-monitoring#setup-integrate-in-an-existing-django-project"
2323 )
2424
2525
@@ -31,17 +31,17 @@ def load_backend_module(backend_name=TIMESERIES_DB["BACKEND"], module=None):
3131 well defined.
3232 """
3333 try :
34- assert ' BACKEND' in TIMESERIES_DB , ' BACKEND'
35- if ' BACKEND' in TIMESERIES_DB and '2' in TIMESERIES_DB [' BACKEND' ]:
34+ assert " BACKEND" in TIMESERIES_DB , " BACKEND"
35+ if " BACKEND" in TIMESERIES_DB and "2" in TIMESERIES_DB [" BACKEND" ]:
3636 # InfluxDB 2.x specific checks
37- assert ' TOKEN' in TIMESERIES_DB , ' TOKEN'
38- assert ' ORG' in TIMESERIES_DB , ' ORG'
39- assert ' BUCKET' in TIMESERIES_DB , ' BUCKET'
37+ assert " TOKEN" in TIMESERIES_DB , " TOKEN"
38+ assert " ORG" in TIMESERIES_DB , " ORG"
39+ assert " BUCKET" in TIMESERIES_DB , " BUCKET"
4040 else :
4141 # InfluxDB 1.x specific checks
42- assert ' USER' in TIMESERIES_DB , ' USER'
43- assert ' PASSWORD' in TIMESERIES_DB , ' PASSWORD'
44- assert ' NAME' in TIMESERIES_DB , ' NAME'
42+ assert " USER" in TIMESERIES_DB , " USER"
43+ assert " PASSWORD" in TIMESERIES_DB , " PASSWORD"
44+ assert " NAME" in TIMESERIES_DB , " NAME"
4545 if module :
4646 return import_module (f"{ backend_name } .{ module } " )
4747 else :
@@ -55,7 +55,7 @@ def load_backend_module(backend_name=TIMESERIES_DB["BACKEND"], module=None):
5555 except ImportError as e :
5656 # The database backend wasn't found. Display a helpful error message
5757 # listing all built-in database backends.
58- builtin_backends = [' influxdb' , ' influxdb2' ]
58+ builtin_backends = [" influxdb" , " influxdb2" ]
5959 if backend_name not in [
6060 f"openwisp_monitoring.db.backends.{ b } " for b in builtin_backends
6161 ]:
@@ -66,5 +66,5 @@ def load_backend_module(backend_name=TIMESERIES_DB["BACKEND"], module=None):
6666 ) from e
6767
6868
69- timeseries_db = load_backend_module (module = ' client' ).DatabaseClient ()
70- timeseries_db .queries = load_backend_module (module = ' queries' )
69+ timeseries_db = load_backend_module (module = " client" ).DatabaseClient ()
70+ timeseries_db .queries = load_backend_module (module = " queries" )
0 commit comments