From b322330b000a6d566e99cde1c29429a23b5f2cb3 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Thu, 2 Nov 2023 12:49:02 +0100 Subject: adding formatting with ruff --- scripts/common/queue.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'scripts/common/queue.py') diff --git a/scripts/common/queue.py b/scripts/common/queue.py index 4510d55..de49802 100644 --- a/scripts/common/queue.py +++ b/scripts/common/queue.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -''' common functions and stuff ''' +""" common functions and stuff """ import logging import os @@ -7,26 +7,27 @@ import pickle from litequeue import SQLQueue -QUEUE_DB = os.environ.get('el_QUEUE_db', 'litequeue.db') -QUEUE_DIR = os.environ.get('el_QUEUE_dir', 'queue') +QUEUE_DB = os.environ.get("el_QUEUE_db", "litequeue.db") +QUEUE_DIR = os.environ.get("el_QUEUE_dir", "queue") -QUEUE_DB = QUEUE_DIR + "/" + QUEUE_DB +QUEUE_DB = QUEUE_DIR + "/" + QUEUE_DB log = logging.getLogger(__name__) # Initialize queue q = SQLQueue(QUEUE_DB, maxsize=None) -def dbi(sql,values,**kwargs): - ''' insert into queue ''' - log.debug('function dbi()') - verbose = bool(kwargs['verbose']) if 'verbose' in kwargs else False - log.debug('Inserting into sqlite-queue') +def dbi(sql, values, **kwargs): + """insert into queue""" + log.debug("function dbi()") + verbose = bool(kwargs["verbose"]) if "verbose" in kwargs else False + + log.debug("Inserting into sqlite-queue") q.put(pickle.dumps([sql, values])) if verbose is True: - log.debug('verbose = True') - table = sql.split(' ')[2] + log.debug("verbose = True") + table = sql.split(" ")[2] num = 1 if isinstance(values, tuple) else len(values) print("Inserted " + str(num) + " item(s) into queue for " + str(table)) return True -- cgit v1.2.3