From af466e298ad74b8006e1fa9d9c6e249cd4dc9dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20K=C3=BCnzel?= <simonk@fsmpi.rwth-aachen.de> Date: Tue, 14 May 2024 00:09:56 +0200 Subject: [PATCH] Fix linter --- db.py | 5 ++--- server.py | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/db.py b/db.py index b8f274c..057ea6c 100644 --- a/db.py +++ b/db.py @@ -101,7 +101,6 @@ elif config['DB_ENGINE'] == 'postgres': user=config["POSTGRES_USER"], password=config["POSTGRES_PASSWORD"], dbname=config["POSTGRES_DATABASE"] - # TODO autocommit? ) if not hasattr(request, 'db'): request.db = g.db.cursor() @@ -124,7 +123,7 @@ def query(operation, *params, delim="sep", nlfix=True): try: cur = get_dbcursor() cur.execute(operation, params) - except Exception as e: + except Exception as e: # pylint: disable=broad-except if str(e) == 'Deadlock found when trying to get lock; try restarting transaction': tries += 1 retry = True @@ -133,7 +132,7 @@ def query(operation, *params, delim="sep", nlfix=True): rows = [] try: rows = cur.fetchall() - except Exception as e: + except Exception as e: # pylint: disable=broad-except if str(e) == 'No result set to fetch from.' or str(e) == "the last operation didn't produce a result": # no problem, we were just at the end of the result set pass diff --git a/server.py b/server.py index 9edc593..2a3eda8 100644 --- a/server.py +++ b/server.py @@ -461,6 +461,7 @@ courses.internal AS courses_internal ) +# pylint: disable=too-many-arguments def _query_search( table: str, search_columns: list, @@ -476,11 +477,11 @@ def _query_search( search_columns))} """ - words: list[str] = list(filter(lambda w: not w.isspace(), search_term.split(" "))) + words: list = list(filter(lambda w: not w.isspace(), search_term.split(" "))) if len(words) == 0: return [] - sub_queries: list[str] = [] - all_values: list[DbValueType] = [] + sub_queries: list = [] + all_values: list = [] prio = len(words) for word in words: word = word.lower() -- GitLab