From 9937eb959615e0a947fd0715197f1dd44d0821c0 Mon Sep 17 00:00:00 2001 From: Alex Ioannidis Date: Wed, 6 Sep 2023 16:29:36 +0200 Subject: [PATCH] global: add missing docstrings --- site/zenodo_rdm/api.py | 8 ++++++++ site/zenodo_rdm/legacy/deserializers/schemas.py | 1 + site/zenodo_rdm/legacy/serializers/__init__.py | 2 ++ site/zenodo_rdm/legacy/serializers/schemas/zenodojson.py | 1 + 4 files changed, 12 insertions(+) diff --git a/site/zenodo_rdm/api.py b/site/zenodo_rdm/api.py index 3b9d2373..e5e49e18 100644 --- a/site/zenodo_rdm/api.py +++ b/site/zenodo_rdm/api.py @@ -14,6 +14,8 @@ class DraftRecordIdProvider(RecordIdProvider): + """Draft numerical auto-incrementing record ID provider.""" + default_status_with_obj = PIDStatus.NEW @classmethod @@ -33,10 +35,14 @@ def create(cls, object_type=None, object_uuid=None, options=None, **kwargs): class ZenodoRDMParent(RDMParent): + """Zenodo RDMParent API class.""" + pid = PIDField("id", provider=DraftRecordIdProvider, delete=True) class ZenodoRDMRecord(RDMRecord): + """Zenodo RDMRecord API class.""" + pid = PIDField("id", provider=DraftRecordIdProvider, delete=True) parent_record_cls = ZenodoRDMParent @@ -46,6 +52,8 @@ class ZenodoRDMRecord(RDMRecord): class ZenodoRDMDraft(RDMDraft): + """Zenodo RDMDraft API class.""" + pid = PIDField("id", provider=DraftRecordIdProvider, delete=False) parent_record_cls = ZenodoRDMParent diff --git a/site/zenodo_rdm/legacy/deserializers/schemas.py b/site/zenodo_rdm/legacy/deserializers/schemas.py index de84bf83..bf4adf44 100644 --- a/site/zenodo_rdm/legacy/deserializers/schemas.py +++ b/site/zenodo_rdm/legacy/deserializers/schemas.py @@ -32,6 +32,7 @@ class Meta: @pre_load() def load_default_license(self, data, **kwargs): + """Load default license.""" metadata = data.get("metadata", {}) if metadata and "license" not in metadata: metadata = data.setdefault("metadata", {}) diff --git a/site/zenodo_rdm/legacy/serializers/__init__.py b/site/zenodo_rdm/legacy/serializers/__init__.py index 0dbf05fd..62d7ac26 100644 --- a/site/zenodo_rdm/legacy/serializers/__init__.py +++ b/site/zenodo_rdm/legacy/serializers/__init__.py @@ -17,6 +17,8 @@ class LegacyListSchema(BaseListSchema): """Legacy top-level array/list schema.""" class Meta: + """Meta class.""" + exclude = ("aggregations",) @post_dump() diff --git a/site/zenodo_rdm/legacy/serializers/schemas/zenodojson.py b/site/zenodo_rdm/legacy/serializers/schemas/zenodojson.py index 9882b517..9dd5f099 100644 --- a/site/zenodo_rdm/legacy/serializers/schemas/zenodojson.py +++ b/site/zenodo_rdm/legacy/serializers/schemas/zenodojson.py @@ -137,6 +137,7 @@ def dump_communities(self, obj): return missing def dump_alternate_identifiers(self, obj): + """Dump alternate identifiers.""" result = [] rel_id_schema = common.RelatedIdentifierSchema(exclude=("relation",)) alternate_identifiers = obj.get("identifiers", [])