diff --git a/db.py b/db.py index b8f274c63c03003e8bfae0603b0cad6661ccc883..057ea6cd14d634a1c0f930c8f1aeb27bf379601e 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 9edc593b7fb4172fd7283f0a20612629e90a31a1..2a3eda8440d06a9c1260857c5b1a4ea461d9a690 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()