From e3cb6bc3c049c9899b55768c607b71d253d31ca9 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 31 Jul 2023 09:30:24 +0300 Subject: Fix linting and typing issues. --- gn3/auth/authorisation/resources/models.py | 1 - gn3/auth/authorisation/resources/views.py | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'gn3/auth') diff --git a/gn3/auth/authorisation/resources/models.py b/gn3/auth/authorisation/resources/models.py index 45d316c..b301a93 100644 --- a/gn3/auth/authorisation/resources/models.py +++ b/gn3/auth/authorisation/resources/models.py @@ -268,7 +268,6 @@ def phenotype_resource_data( offset: int = 0, limit: Optional[int] = None) -> Sequence[sqlite3.Row]: """Fetch data linked to a Phenotype resource""" - from gn3.debug import __pk__ cursor.execute( ("SELECT * FROM phenotype_resources AS pr " "INNER JOIN linked_phenotype_data AS lpd " diff --git a/gn3/auth/authorisation/resources/views.py b/gn3/auth/authorisation/resources/views.py index c39d4ab..feacdd6 100644 --- a/gn3/auth/authorisation/resources/views.py +++ b/gn3/auth/authorisation/resources/views.py @@ -82,12 +82,12 @@ def __safe_get_requests_page__(key: str = "page") -> int: def __safe_get_requests_count__(key: str = "count_per_page") -> int: """Get the results page if it exists or default to the first page.""" try: - count = request.args.get(key) - if count is None: - return None - return abs(int(count, base=10)) + count = request.args.get(key, 0) + if count != 0: + return abs(int(count, base=10)) + return 0 except ValueError as _valerr: - return None + return 0 @resources.route("/view//data") @require_oauth("profile group resource") -- cgit v1.2.3