aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/transforms/ingest.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-03 12:29:39 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-03 12:31:07 -0700
commit10a2374051568edf3d872988e730328d899a0fdd (patch)
tree795be5e149a021f84bc4305c1811e63cc86f7aa1 /python/fatcat_tools/transforms/ingest.py
parentcfab1ddcd8a05b62ecc16763d18a6ecee8fa234f (diff)
downloadfatcat-10a2374051568edf3d872988e730328d899a0fdd.tar.gz
fatcat-10a2374051568edf3d872988e730328d899a0fdd.zip
typing: first batch of python bulk type annotations
While these changes are more delicate than simple lint changes, this specific batch of edits and annotations was *relatively* simple, and resulted in few code changes other than function signature additions.
Diffstat (limited to 'python/fatcat_tools/transforms/ingest.py')
-rw-r--r--python/fatcat_tools/transforms/ingest.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/python/fatcat_tools/transforms/ingest.py b/python/fatcat_tools/transforms/ingest.py
index 30b5b190..cbf9e9bf 100644
--- a/python/fatcat_tools/transforms/ingest.py
+++ b/python/fatcat_tools/transforms/ingest.py
@@ -1,4 +1,8 @@
-INGEST_TYPE_CONTAINER_MAP = {
+from typing import Any, Dict, Optional
+
+from fatcat_openapi_client import ReleaseEntity
+
+INGEST_TYPE_CONTAINER_MAP: Dict[str, str] = {
# Optica
"twtpsm6ytje3nhuqfu3pa7ca7u": "html",
# Optics Express
@@ -14,7 +18,11 @@ INGEST_TYPE_CONTAINER_MAP = {
}
-def release_ingest_request(release, ingest_request_source="fatcat", ingest_type=None):
+def release_ingest_request(
+ release: ReleaseEntity,
+ ingest_request_source: str = "fatcat",
+ ingest_type: Optional[str] = None,
+) -> Optional[Dict[str, Any]]:
"""
Takes a full release entity object and returns an ingest request (as dict),
or None if it seems like this release shouldn't be ingested.