about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2025-07-09 08:36:42 -0500
committerFrederick Muriuki Muriithi2025-07-09 09:02:38 -0500
commit360cc3bd259c5e1c123bf8095d8474213597971d (patch)
treef845d603268ecefdf5975829691ac475005ae7fb
parentfb1e138b3efbd22eca59f2d8f836c1e61121c964 (diff)
downloadgn-auth-360cc3bd259c5e1c123bf8095d8474213597971d.tar.gz
Fix some linting issues.
-rw-r--r--gn_auth/auth/authorisation/resources/groups/models.py7
-rw-r--r--gn_auth/auth/authorisation/resources/groups/views.py6
-rw-r--r--gn_auth/auth/requests.py1
3 files changed, 8 insertions, 6 deletions
diff --git a/gn_auth/auth/authorisation/resources/groups/models.py b/gn_auth/auth/authorisation/resources/groups/models.py
index b8a5235..1d44ca4 100644
--- a/gn_auth/auth/authorisation/resources/groups/models.py
+++ b/gn_auth/auth/authorisation/resources/groups/models.py
@@ -237,9 +237,12 @@ def is_group_leader(conn: db.DbConnection, user: User, group: Group) -> bool:
         return "group-leader" in role_names
 
 
-def __build_groups_list_query__(base: str, search: Optional[str] = None) -> tuple[str, tuple[Optional[str], ...]]:
+def __build_groups_list_query__(
+        base: str,
+        search: Optional[str] = None
+) -> tuple[str, tuple[Optional[str], ...]]:
     """Build up the query from given search terms."""
-    if bool(search):
+    if search is not None and search.strip() != "":
         _search = search.strip()
         return ((f"{base} WHERE groups.group_name LIKE ? "
                  "OR groups.group_metadata LIKE ?"),
diff --git a/gn_auth/auth/authorisation/resources/groups/views.py b/gn_auth/auth/authorisation/resources/groups/views.py
index 28f64e2..e6c92cb 100644
--- a/gn_auth/auth/authorisation/resources/groups/views.py
+++ b/gn_auth/auth/authorisation/resources/groups/views.py
@@ -35,8 +35,8 @@ groups = Blueprint("groups", __name__)
 @require_oauth("profile group")
 def list_groups():
     """Return the list of groups that exist."""
-    _kwargs = {key: value for key, value in request_json().items()}
-    def __add_total_group_count__(conn, groups_info):
+    _kwargs = request_json()
+    def __add_total_group_count__(groups_info):
         return {
             "groups": groups_info[0],
             "total-groups": groups_info[1],
@@ -50,7 +50,7 @@ def list_groups():
             start=int(_kwargs.get("start", "0")),
             length=int(_kwargs.get("length", "0"))
         ).then(
-            partial(__add_total_group_count__, conn)
+            __add_total_group_count__
         ).maybe(
             {
                 "groups": [],
diff --git a/gn_auth/auth/requests.py b/gn_auth/auth/requests.py
index f577b9f..01ff765 100644
--- a/gn_auth/auth/requests.py
+++ b/gn_auth/auth/requests.py
@@ -1,5 +1,4 @@
 """Utilities to deal with requests."""
-import werkzeug
 from flask import request
 
 def request_json() -> dict: