diff --git a/ckanext/doi/lib/api.py b/ckanext/doi/lib/api.py index 6915d6b..685092d 100644 --- a/ckanext/doi/lib/api.py +++ b/ckanext/doi/lib/api.py @@ -47,7 +47,7 @@ def test_mode(self): Whether to run in test mode. Defaults to true. - :return: test mode enabled as boolean (true=enabled) + :returns: test mode enabled as boolean (true=enabled) """ if self._test_mode is None: self._test_mode = doi_test_mode() @@ -58,7 +58,7 @@ def get_prefix(cls): """ Get the prefix to use for DOIs. - :return: config prefix setting + :returns: config prefix setting """ prefix = toolkit.config.get('ckanext.doi.prefix') if prefix is None: @@ -77,7 +77,7 @@ def generate_doi(self): The database is checked for previous usage, as is Datacite itself. Use whatever value is retuned from this function quickly to avoid double use as this function uses no locking. - :return: the full, unique DOI + :returns: the full, unique DOI """ # the list of valid characters is larger than just lowercase and the digits but we don't # need that many options and URLs with just alphanumeric characters in them are nicer. We @@ -133,7 +133,7 @@ def set_metadata(self, doi, xml_dict): :param doi: the DOI to update the metadata for :param xml_dict: the metadata as an xml dict (generated from build_xml_dict) - :return: + :returns: """ xml_dict['identifiers'] = [{'identifierType': 'DOI', 'identifier': doi}] @@ -149,7 +149,7 @@ def get_metadata(self, doi): Retrieve metadata for a given DOI on datacite. :param doi: the DOI for which to retrieve the stored metadata - :return: + :returns: """ try: metadata = self.client.metadata_get(doi) @@ -163,7 +163,7 @@ def check_for_update(self, doi, xml_dict): :param doi: the DOI of the package :param xml_dict: the xml_dict generated by build_xml_dict - :return: True if the two are the same, False if not + :returns: True if the two are the same, False if not """ posted_xml = self.get_metadata(doi) if posted_xml is None or posted_xml.strip() == '': diff --git a/ckanext/doi/lib/helpers.py b/ckanext/doi/lib/helpers.py index df68e7e..f48cf41 100644 --- a/ckanext/doi/lib/helpers.py +++ b/ckanext/doi/lib/helpers.py @@ -49,7 +49,7 @@ def date_or_none(date_object_or_string): Try and convert the given object into a datetime; if not possible, return None. :param date_object_or_string: a datetime or date string - :return: datetime or None + :returns: datetime or None """ if isinstance(date_object_or_string, datetime): return date_object_or_string @@ -63,6 +63,6 @@ def doi_test_mode(): """ Determines whether we're running in test mode. - :return: bool + :returns: bool """ return toolkit.asbool(get_setting('ckanext.doi.test_mode', default=get_debug())) diff --git a/ckanext/doi/lib/metadata.py b/ckanext/doi/lib/metadata.py index b716dac..1d9204e 100644 --- a/ckanext/doi/lib/metadata.py +++ b/ckanext/doi/lib/metadata.py @@ -261,7 +261,7 @@ def build_xml_dict(metadata_dict): generate the xml. :param metadata_dict: a dict of metadata generated from build_metadata_dict - :return: dict that can be passed directly to datacite.schema42.tostring() + :returns: dict that can be passed directly to datacite.schema42.tostring() """ # required fields first (DOI will be added later) diff --git a/ckanext/doi/lib/xml_utils.py b/ckanext/doi/lib/xml_utils.py index 1855dd2..2145bf9 100644 --- a/ckanext/doi/lib/xml_utils.py +++ b/ckanext/doi/lib/xml_utils.py @@ -30,7 +30,7 @@ def create_contributor( strings :param identifiers: a list of dicts with "identifier", "scheme", and (optionally) "scheme_uri" - :return: a dict + :returns: a dict """ if is_org and full_name is None: raise ValueError('Creator name must be supplied as full_name="Org Name"') diff --git a/ckanext/doi/model/crud.py b/ckanext/doi/model/crud.py index 4cea6c5..1a9bd33 100644 --- a/ckanext/doi/model/crud.py +++ b/ckanext/doi/model/crud.py @@ -22,7 +22,7 @@ def create(cls, identifier, package_id, published=None): :param identifier: a new DOI string :param package_id: the id of the package this DOI represents :param published: when this DOI was published (datetime, nullable) - :return: the newly created record object + :returns: the newly created record object """ new_record = DOI( identifier=identifier, package_id=package_id, published=published @@ -37,7 +37,7 @@ def read_doi(cls, identifier): Retrieve a record with a given DOI. :param identifier: the DOI string - :return: the record object + :returns: the record object """ return Session.query(DOI).get(identifier) @@ -49,7 +49,7 @@ def read_package(cls, package_id, create_if_none=False): :param package_id: the id of the package :param create_if_none: generate a new DOI and add a record if no record is found for the given package - :return: the record object + :returns: the record object """ from ckanext.doi.lib.api import DataciteClient @@ -67,7 +67,7 @@ def update_doi(cls, identifier, **kwargs): :param identifier: the DOI string :param kwargs: the values to be updated - :return: the updated record object + :returns: the updated record object """ update_dict = {k: v for k, v in kwargs.items() if k in cls.cols} Session.query(DOI).filter(DOI.identifier == identifier).update(update_dict) @@ -82,7 +82,7 @@ def update_package(cls, package_id, **kwargs): :param package_id: the id of the package :param kwargs: the values to be updated - :return: the updated record object + :returns: the updated record object """ update_dict = {k: v for k, v in kwargs.items() if k in cls.cols} Session.query(DOI).filter(DOI.package_id == package_id).update(update_dict) @@ -95,7 +95,7 @@ def delete_doi(cls, identifier): Delete the record with a given DOI. :param identifier: the DOI string - :return: True if a record was deleted, False if not + :returns: True if a record was deleted, False if not """ to_delete = cls.read_doi(identifier) if to_delete is not None: @@ -111,7 +111,7 @@ def delete_package(cls, package_id): Delete the record associated with a given package. :param package_id: the id of the package - :return: True if a record was deleted, False if not + :returns: True if a record was deleted, False if not """ to_delete = cls.read_package(package_id) if to_delete is not None: