From c676bcfef8974f430ed18c8a1bb17c721e6b387e Mon Sep 17 00:00:00 2001 From: Brian Helba Date: Wed, 29 Nov 2023 15:31:35 -0500 Subject: [PATCH] WIP: Fix RET503 Missing explicit `return` at the end of function able to return non-`None` value --- dandiapi/api/admin.py | 1 + dandiapi/api/models/asset.py | 2 ++ dandiapi/api/views/asset.py | 2 ++ 3 files changed, 5 insertions(+) diff --git a/dandiapi/api/admin.py b/dandiapi/api/admin.py index 0aa90ec7d..149848905 100644 --- a/dandiapi/api/admin.py +++ b/dandiapi/api/admin.py @@ -142,6 +142,7 @@ def queryset(self, request, queryset): status = self.value() if status: return queryset.filter(status=status) + return None @admin.register(Version) diff --git a/dandiapi/api/models/asset.py b/dandiapi/api/models/asset.py index 1a14c27b6..7d5daceea 100644 --- a/dandiapi/api/models/asset.py +++ b/dandiapi/api/models/asset.py @@ -214,6 +214,8 @@ def sha256(self): return self.blob.sha256 elif self.is_embargoed_blob: return self.embargoed_blob.sha256 + else: + raise RuntimeError('Zarr does not support SHA256') @property def digest(self) -> dict[str, str]: diff --git a/dandiapi/api/views/asset.py b/dandiapi/api/views/asset.py index 7e986372b..cd1a109e6 100644 --- a/dandiapi/api/views/asset.py +++ b/dandiapi/api/views/asset.py @@ -167,6 +167,8 @@ def download(self, request, *args, **kwargs): ) return HttpResponseRedirect(url) + else: + raise TypeError('Invalid content_disposition: %s', content_disposition) @swagger_auto_schema( method='GET',