Skip to content

Commit

Permalink
removing commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
drifter089 authored Nov 28, 2024
1 parent 1f8aa61 commit 65eef94
Showing 1 changed file with 17 additions and 30 deletions.
47 changes: 17 additions & 30 deletions src/zenodopy/zenodopy.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,41 +439,28 @@ def _check_parent_doi(self, dep_id, project_obj):
return False

def change_metadata(self, metadata: ZenodoMetadata):
# """Change project's metadata.
# Args:
# metadata (ZenodoMetadata): The metadata to update.
# Returns:
# dict: Dictionary with the updated metadata.
# """
"""
Change project's metadata.
Args:
metadata (ZenodoMetadata): The metadata to update.
Returns:
dict: Dictionary with the updated metadata if the request is successful.
Raises an error if the request fails.
This function updates the project's metadata on Zenodo.
It sets the `publication_date` to the current date and prepares the metadata for the API request.
The metadata is sent as a JSON payload to the Zenodo API endpoint using a PUT request.
If the request is successful, it returns the updated metadata as a dictionary.
If the request fails, it raises an error with the status of the failed request.
"""
metadata.publication_date = datetime.now().strftime("%Y-%m-%d")

data = {
"metadata": metadata.__dict__
}


# if json_file_path is None:
# raise ValueError("You need to supply a path")

# if not Path(os.path.expanduser(json_file_path)).exists():
# raise ValueError(
# f"{json_file_path} does not exist. Please check you entered the correct path"
# )

# if json_file_path:
# with open(json_file_path, "rb") as json_file:
# file_data = json.load(json_file)

# if upload_type is None:
# upload_types = self._get_upload_types()
# warnings.warn(
# f"upload_type not set, so defaulted to 'other', possible choices include {upload_types}",
# UserWarning,
# )
# upload_type = "other"

# file_data["metadata"]["publication_date"] = datetime.now().strftime("%Y-%m-%d")

r = requests.put(
f"{self._endpoint}/deposit/depositions/{self.deposition_id}",
auth=self._bearer_auth,
Expand Down Expand Up @@ -809,4 +796,4 @@ def _delete_project(self, dep_id=None):
self.bucket = None
self.deposition_id = None
# else:
# print(f'Project title {self.title} is still available.')
# print(f'Project title {self.title} is still available.')

0 comments on commit 65eef94

Please sign in to comment.