diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-03 12:29:39 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-03 12:31:07 -0700 |
commit | 10a2374051568edf3d872988e730328d899a0fdd (patch) | |
tree | 795be5e149a021f84bc4305c1811e63cc86f7aa1 /python/fatcat_tools/references.py | |
parent | cfab1ddcd8a05b62ecc16763d18a6ecee8fa234f (diff) | |
download | fatcat-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/references.py')
-rw-r--r-- | python/fatcat_tools/references.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/python/fatcat_tools/references.py b/python/fatcat_tools/references.py index 624020b5..f41b5973 100644 --- a/python/fatcat_tools/references.py +++ b/python/fatcat_tools/references.py @@ -8,7 +8,7 @@ See bulk citation and citation API proposals for design documentation. import argparse import datetime import sys -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Optional import elasticsearch from elasticsearch_dsl import Search @@ -65,7 +65,7 @@ class BiblioRef(BaseModel): target_unstructured: Optional[str] target_csl: Optional[Dict[str, Any]] - def hacks(self): + def hacks(self) -> "BiblioRef": """ Temporary (?) hacks to work around schema/data issues """ @@ -105,7 +105,7 @@ class EnrichedBiblioRef(BaseModel): @validator("release") @classmethod - def check_release(cls, v): + def check_release(cls: Any, v: ReleaseEntity) -> ReleaseEntity: if v is not None and not isinstance(v, ReleaseEntity): raise ValueError("expected a ReleaseEntity") return v @@ -399,7 +399,7 @@ def enrich_outbound_refs( return enriched -def run_ref_query(args) -> None: +def run_ref_query(args: argparse.Namespace) -> None: """ CLI helper/debug tool (prints to stdout) """ |