aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/transforms/elasticsearch.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_tools/transforms/elasticsearch.py')
-rw-r--r--python/fatcat_tools/transforms/elasticsearch.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/python/fatcat_tools/transforms/elasticsearch.py b/python/fatcat_tools/transforms/elasticsearch.py
index e39e9ea4..d4962205 100644
--- a/python/fatcat_tools/transforms/elasticsearch.py
+++ b/python/fatcat_tools/transforms/elasticsearch.py
@@ -7,6 +7,7 @@ from fatcat_openapi_client import (
ContainerEntity,
EntityEdit,
FileEntity,
+ FileUrl,
ReleaseEntity,
)
@@ -355,7 +356,7 @@ def _rte_content_helper(release: ReleaseEntity) -> dict:
- other webarchive or repository URLs
- any other URL
"""
- t = dict(
+ t: Dict[str, Any] = dict(
file_count=len(release.files or []),
fileset_count=len(release.filesets or []),
webcapture_count=len(release.webcaptures or []),
@@ -403,7 +404,7 @@ def _rte_content_helper(release: ReleaseEntity) -> dict:
return t
-def _rte_url_helper(url_obj) -> dict:
+def _rte_url_helper(url_obj: FileUrl) -> Dict[str, Any]:
"""
Takes a location URL ('url' and 'rel' keys) and returns generic preservation status.
@@ -427,7 +428,9 @@ def _rte_url_helper(url_obj) -> dict:
return t
-def container_to_elasticsearch(entity, force_bool=True, stats=None):
+def container_to_elasticsearch(
+ entity: Any, force_bool: bool = True, stats: Optional[Dict[str, Any]] = None
+) -> Dict[str, Any]:
"""
Converts from an entity model/schema to elasticsearch oriented schema.