Skip to content
Snippets Groups Projects
Commit af466e29 authored by Simon Künzel's avatar Simon Künzel
Browse files

Fix linter

parent 775edfe4
Branches
No related tags found
No related merge requests found
...@@ -101,7 +101,6 @@ elif config['DB_ENGINE'] == 'postgres': ...@@ -101,7 +101,6 @@ elif config['DB_ENGINE'] == 'postgres':
user=config["POSTGRES_USER"], user=config["POSTGRES_USER"],
password=config["POSTGRES_PASSWORD"], password=config["POSTGRES_PASSWORD"],
dbname=config["POSTGRES_DATABASE"] dbname=config["POSTGRES_DATABASE"]
# TODO autocommit?
) )
if not hasattr(request, 'db'): if not hasattr(request, 'db'):
request.db = g.db.cursor() request.db = g.db.cursor()
...@@ -124,7 +123,7 @@ def query(operation, *params, delim="sep", nlfix=True): ...@@ -124,7 +123,7 @@ def query(operation, *params, delim="sep", nlfix=True):
try: try:
cur = get_dbcursor() cur = get_dbcursor()
cur.execute(operation, params) 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': if str(e) == 'Deadlock found when trying to get lock; try restarting transaction':
tries += 1 tries += 1
retry = True retry = True
...@@ -133,7 +132,7 @@ def query(operation, *params, delim="sep", nlfix=True): ...@@ -133,7 +132,7 @@ def query(operation, *params, delim="sep", nlfix=True):
rows = [] rows = []
try: try:
rows = cur.fetchall() 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": 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 # no problem, we were just at the end of the result set
pass pass
......
...@@ -461,6 +461,7 @@ courses.internal AS courses_internal ...@@ -461,6 +461,7 @@ courses.internal AS courses_internal
) )
# pylint: disable=too-many-arguments
def _query_search( def _query_search(
table: str, table: str,
search_columns: list, search_columns: list,
...@@ -476,11 +477,11 @@ def _query_search( ...@@ -476,11 +477,11 @@ def _query_search(
search_columns))} 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: if len(words) == 0:
return [] return []
sub_queries: list[str] = [] sub_queries: list = []
all_values: list[DbValueType] = [] all_values: list = []
prio = len(words) prio = len(words)
for word in words: for word in words:
word = word.lower() word = word.lower()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment