diff --git a/swh/deposit/api/common.py b/swh/deposit/api/common.py --- a/swh/deposit/api/common.py +++ b/swh/deposit/api/common.py @@ -1117,7 +1117,7 @@ headers: ParsedRequestHeaders, collection_name: str, deposit_id: int, - ) -> Dict[str, Any]: + ) -> None: """Routine to deal with updating a deposit in some way. Returns @@ -1152,11 +1152,11 @@ @abstractmethod def process_delete( self, request: Request, collection_name: str, deposit_id: int - ) -> Dict: + ) -> None: """Routine to delete a resource. This is mostly not allowed except for the EM_IRI (cf. .api.deposit_update.APIUpdateArchive) """ - return {} + pass diff --git a/swh/deposit/api/edit.py b/swh/deposit/api/edit.py --- a/swh/deposit/api/edit.py +++ b/swh/deposit/api/edit.py @@ -3,8 +3,6 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from typing import Any, Dict - from rest_framework.request import Request from swh.deposit.models import Deposit @@ -50,7 +48,7 @@ headers: ParsedRequestHeaders, collection_name: str, deposit_id: int, - ) -> Dict[str, Any]: + ) -> None: """This allows the following scenarios: - multipart: replace all the deposit (status partial) metadata and archive @@ -71,14 +69,11 @@ - the provided xml atom entry is empty - the provided swhid does not exist in the archive - Returns: - 204 No content - """ # noqa swhid = headers.swhid if swhid is None: if request.content_type.startswith("multipart/"): - return self._multipart_upload( + self._multipart_upload( request, headers, collection_name, @@ -86,15 +81,17 @@ replace_archives=True, replace_metadata=True, ) - # standard metadata update (replace all metadata already provided to the - # deposit by the new ones) - return self._atom_entry( - request, - headers, - collection_name, - deposit_id=deposit_id, - replace_metadata=True, - ) + else: + # standard metadata update (replace all metadata already provided to the + # deposit by the new ones) + self._atom_entry( + request, + headers, + collection_name, + deposit_id=deposit_id, + replace_metadata=True, + ) + return # Update metadata on a deposit already ingested # Write to the metadata storage (and the deposit backend) @@ -133,17 +130,10 @@ deposit, parse_swhid(swhid), metadata, raw_metadata, deposit.origin_url, ) - return { - "deposit_id": deposit.id, - "deposit_date": deposit_request.date, - "status": deposit.status, - "archive": None, - } - - def process_delete(self, req, collection_name: str, deposit_id: int) -> Dict: + def process_delete(self, req, collection_name: str, deposit_id: int) -> None: """Delete the container (deposit). source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_deleteconteiner # noqa """ - return self._delete_deposit(collection_name, deposit_id) + self._delete_deposit(collection_name, deposit_id) diff --git a/swh/deposit/api/edit_media.py b/swh/deposit/api/edit_media.py --- a/swh/deposit/api/edit_media.py +++ b/swh/deposit/api/edit_media.py @@ -3,7 +3,7 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from typing import Any, Dict, Optional, Tuple +from typing import Dict, Optional, Tuple from rest_framework import status @@ -35,7 +35,7 @@ def process_put( self, req, headers: ParsedRequestHeaders, collection_name: str, deposit_id: int - ) -> Dict[str, Any]: + ) -> None: """Replace existing content for the existing deposit. source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_editingcontent_binary # noqa @@ -50,7 +50,7 @@ ) raise DepositError(BAD_REQUEST, msg) - return self._binary_upload( + self._binary_upload( req, headers, collection_name, deposit_id=deposit_id, replace_archives=True ) @@ -84,7 +84,7 @@ self._binary_upload(req, headers, collection_name, deposit_id), ) - def process_delete(self, req, collection_name: str, deposit_id: int) -> Dict: + def process_delete(self, req, collection_name: str, deposit_id: int) -> None: """Delete content (archives) from existing deposit. source: http://swordapp.github.io/SWORDv2-Profile/SWORDProfile.html#protocoloperations_deletingcontent # noqa @@ -93,4 +93,4 @@ 204 Created """ - return self._delete_archives(collection_name, deposit_id) + self._delete_archives(collection_name, deposit_id) diff --git a/swh/deposit/api/private/deposit_update_status.py b/swh/deposit/api/private/deposit_update_status.py --- a/swh/deposit/api/private/deposit_update_status.py +++ b/swh/deposit/api/private/deposit_update_status.py @@ -3,8 +3,6 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from typing import Dict - from rest_framework.parsers import JSONParser from swh.model.identifiers import DIRECTORY, REVISION, SNAPSHOT, swhid @@ -71,7 +69,7 @@ headers: ParsedRequestHeaders, collection_name: str, deposit_id: int, - ) -> Dict: + ) -> None: """Update the deposit with status and SWHIDs Returns: @@ -109,5 +107,3 @@ deposit.status = status deposit.save() - - return {}