Doc strings to imperative mood

This commit is contained in:
Julian Stirling 2025-07-10 00:36:23 +01:00
parent dceb640c77
commit f51dae7b3a
10 changed files with 88 additions and 79 deletions

View file

@ -25,7 +25,7 @@ def parse_arguments() -> Namespace:
def script_directory(path):
"""Resolves path to directory of the current script"""
"""Resolve path to directory of the current script"""
return os.path.join(os.path.dirname(os.path.realpath(__file__)), path)

View file

@ -22,7 +22,7 @@ class Zenodo:
self.zenodo_url = "https://zenodo.org/api/deposit/depositions"
def create_new_deposit(self):
"""Creates a new (unpublished) Zenodo deposit and return its deposition ID."""
"""Create a new (unpublished) Zenodo deposit and return its deposition ID."""
headers = {"Content-Type": "application/json"}
r = requests.post(
self.zenodo_url,
@ -35,7 +35,7 @@ class Zenodo:
return r.json()
def set_metadata(self, deposition_id, metadata):
"""Sets the given metadata for the specified deposit."""
"""Set the given metadata for the specified deposit."""
headers = {"Content-Type": "application/json"}
r = requests.put(
self.zenodo_url + "/{}".format(deposition_id),
@ -47,7 +47,7 @@ class Zenodo:
print(r.json())
def upload_file(self, deposition_id, file_path):
"""Uploads a new file for the given deposit."""
"""Upload a new file for the given deposit."""
file_name = os.path.basename(file_path)
data = {"filename": file_name}
files = {"file": open(file_path, "rb")}
@ -61,7 +61,7 @@ class Zenodo:
print(r.json())
def publish_deposit(self, deposition_id):
"""Publishes the given deposit. BEWARE: It is now visible to all!!!"""
"""Publish the given deposit. BEWARE: It is now visible to all!!!"""
r = requests.post(
self.zenodo_url + "/{}/actions/publish".format(deposition_id),
params={"access_token": self._api_token},
@ -70,7 +70,7 @@ class Zenodo:
print(r.json())
def create_new_version(self, deposition_id):
"""Creates a new version of an already published deposit."""
"""Create a new version of an already published deposit."""
r = requests.post(
self.zenodo_url + "/{}/actions/newversion".format(deposition_id),
params={"access_token": self._api_token},
@ -80,7 +80,7 @@ class Zenodo:
return os.path.basename(r.json()["links"]["latest_draft"])
def remove_all_files(self, deposition_id):
"""Removes all uploaded files of a unpublished deposit."""
"""Remove all uploaded files of a unpublished deposit."""
r = requests.get(
self.zenodo_url + "/{}/files".format(deposition_id),
params={"access_token": self._api_token},