Skip to content

Commit

Permalink
style: Correct script style
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalch committed Jan 19, 2024
1 parent bdf3d53 commit 71d6a93
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions ckan_pkg_checker/checkers/link_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,19 +179,17 @@ def _check_url_from_list_dict(self, list_dict, key, test_title, check_results):

def _check_resource_url(self, url, test_title, resource_id, resource_results):
"""Verify a single resource URL"""
check_result = self._check_url_status(
test_title, url, resource_id
)
check_result = self._check_url_status(test_title, url, resource_id)
if check_result:
resource_results.append(check_result)

def _check_resource_url_from_list(self, urls, test_title, resource_id, resource_results):
def _check_resource_url_from_list(
self, urls, test_title, resource_id, resource_results
):
"""Verify resource URLs within the list"""
for url in urls:
if url:
check_result = self._check_url_status(
test_title, url, resource_id
)
check_result = self._check_url_status(test_title, url, resource_id)
if check_result:
resource_results.append(check_result)

Expand All @@ -206,27 +204,36 @@ def _check_resource(self, pkg, resource):
pass
if access_url:
self._check_resource_url(
url=access_url, test_title=TEST_ACCESS_URL, resource_id=resource["id"], resource_results=resource_results
url=access_url,
test_title=TEST_ACCESS_URL,
resource_id=resource["id"],
resource_results=resource_results,
)

if download_url and download_url != access_url:
self._check_resource_url(
url=download_url, test_title=TEST_DOWNLOAD_URL, resource_id=resource["id"],
resource_results=resource_results
url=download_url,
test_title=TEST_DOWNLOAD_URL,
resource_id=resource["id"],
resource_results=resource_results,
)

# Check documentation URLs for the resources
if "documentation" in resource:
self._check_resource_url_from_list(
urls=resource.get("documentation"), test_title=TEST_RESOURCE_DOCUMENTATION_URL, resource_id=resource["id"],
resource_results=resource_results
urls=resource.get("documentation"),
test_title=TEST_RESOURCE_DOCUMENTATION_URL,
resource_id=resource["id"],
resource_results=resource_results,
)

# Check documentation URLs for the resources
if "access_services" in resource:
self._check_resource_url_from_list(
urls=resource.get("access_services"), test_title=TEST_ACCESS_SERVICES_URL, resource_id=resource["id"],
resource_results=resource_results
urls=resource.get("access_services"),
test_title=TEST_ACCESS_SERVICES_URL,
resource_id=resource["id"],
resource_results=resource_results,
)
return resource_results

Expand Down

0 comments on commit 71d6a93

Please sign in to comment.