diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-17 16:11:44 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2021-11-23 17:39:02 -0800 |
commit | f208054f6883589239f21d5e46545960c45ece18 (patch) | |
tree | a58de9b342d22b8980f67e14ac8144e273835ffb /python | |
parent | 16e0a5cef642f1d180354fa1da9ea568ebdd3946 (diff) | |
download | fatcat-f208054f6883589239f21d5e46545960c45ece18.tar.gz fatcat-f208054f6883589239f21d5e46545960c45ece18.zip |
python: fix api annotations (DefaultApi not ApiClient)
Diffstat (limited to 'python')
30 files changed, 71 insertions, 71 deletions
diff --git a/python/fatcat_tools/cleanups/common.py b/python/fatcat_tools/cleanups/common.py index c8ca5800..1b467b59 100644 --- a/python/fatcat_tools/cleanups/common.py +++ b/python/fatcat_tools/cleanups/common.py @@ -5,7 +5,7 @@ import sys from collections import Counter from typing import Any, Dict, List, Sequence -from fatcat_openapi_client import ApiClient, Editgroup +from fatcat_openapi_client import DefaultApi, Editgroup from fatcat_tools.transforms import entity_from_dict, entity_to_dict @@ -29,7 +29,7 @@ class EntityCleaner: This class is pretty similar to EntityImporter, but isn't subclassed. """ - def __init__(self, api: ApiClient, entity_type: Any, **kwargs) -> None: + def __init__(self, api: DefaultApi, entity_type: Any, **kwargs) -> None: eg_extra = kwargs.get("editgroup_extra", dict()) eg_extra["git_rev"] = eg_extra.get( @@ -46,7 +46,7 @@ class EntityCleaner: ) self.editgroup_extra = eg_extra self.reset() - self.ac = ApiClient() + self.ac = DefaultApi() if self.dry_run_mode: print("Running in dry-run mode!") diff --git a/python/fatcat_tools/cleanups/file_release_bugfix.py b/python/fatcat_tools/cleanups/file_release_bugfix.py index dc27f9b5..cbc3a114 100644 --- a/python/fatcat_tools/cleanups/file_release_bugfix.py +++ b/python/fatcat_tools/cleanups/file_release_bugfix.py @@ -4,7 +4,7 @@ import sys from typing import Any, Dict import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from fatcat_tools import authenticated_api, public_api, uuid2fcid from fatcat_tools.importers.common import EntityImporter, JsonLinePusher @@ -24,7 +24,7 @@ class FileReleaseBugfix(EntityImporter): python -m fatcat_tools.cleans.file_release_bugfix - < blah.json """ - def __init__(self, api: ApiClient, **kwargs): + def __init__(self, api: DefaultApi, **kwargs): eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/cleanups/file_short_wayback_ts.py b/python/fatcat_tools/cleanups/file_short_wayback_ts.py index bdd49f9b..4e029f2b 100644 --- a/python/fatcat_tools/cleanups/file_short_wayback_ts.py +++ b/python/fatcat_tools/cleanups/file_short_wayback_ts.py @@ -5,7 +5,7 @@ import sys from typing import Any, Dict import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from fatcat_tools import authenticated_api, entity_from_dict, public_api from fatcat_tools.importers.common import EntityImporter, JsonLinePusher @@ -25,7 +25,7 @@ class FileShortWaybackTimestampCleanup(EntityImporter): python -m fatcat_tools.cleans.file_short_wayback_ts - < blah.json """ - def __init__(self, api: ApiClient, **kwargs): + def __init__(self, api: DefaultApi, **kwargs): eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/cleanups/files.py b/python/fatcat_tools/cleanups/files.py index 309924e3..7a81f759 100644 --- a/python/fatcat_tools/cleanups/files.py +++ b/python/fatcat_tools/cleanups/files.py @@ -1,4 +1,4 @@ -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from fatcat_openapi_client.rest import ApiException from .common import EntityCleaner @@ -9,7 +9,7 @@ class FileCleaner(EntityCleaner): File fixups! """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/cleanups/release_lowercase_doi.py b/python/fatcat_tools/cleanups/release_lowercase_doi.py index 5e3275db..d3f5bbd3 100644 --- a/python/fatcat_tools/cleanups/release_lowercase_doi.py +++ b/python/fatcat_tools/cleanups/release_lowercase_doi.py @@ -2,7 +2,7 @@ import argparse import os import sys -from fatcat_openapi_client import ApiClient, ApiException, ReleaseEntity, ReleaseExtIds +from fatcat_openapi_client import DefaultApi, ApiException, ReleaseEntity, ReleaseExtIds from fatcat_tools import authenticated_api, public_api from fatcat_tools.importers.common import EntityImporter, LinePusher @@ -27,7 +27,7 @@ class ReleaseLowercaseDoiCleanup(EntityImporter): update. """ - def __init__(self, api: ApiClient, **kwargs): + def __init__(self, api: DefaultApi, **kwargs): eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/importers/arabesque.py b/python/fatcat_tools/importers/arabesque.py index 92289bb3..4702290a 100644 --- a/python/fatcat_tools/importers/arabesque.py +++ b/python/fatcat_tools/importers/arabesque.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from fatcat_tools.normal import b32_hex @@ -42,7 +42,7 @@ class ArabesqueMatchImporter(EntityImporter): """ def __init__( - self, api: ApiClient, extid_type: str, require_grobid: bool = True, **kwargs + self, api: DefaultApi, extid_type: str, require_grobid: bool = True, **kwargs ) -> None: eg_desc = ( diff --git a/python/fatcat_tools/importers/arxiv.py b/python/fatcat_tools/importers/arxiv.py index dd2c2284..22b8b2ea 100644 --- a/python/fatcat_tools/importers/arxiv.py +++ b/python/fatcat_tools/importers/arxiv.py @@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client from bs4 import BeautifulSoup -from fatcat_openapi_client import ApiClient, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseEntity from pylatexenc.latex2text import LatexNodes2Text from fatcat_tools.normal import clean_doi @@ -92,7 +92,7 @@ class ArxivRawImporter(EntityImporter): the "most recent" version; can be a simple sort? """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/chocula.py b/python/fatcat_tools/importers/chocula.py index c44fec3b..e07651f7 100644 --- a/python/fatcat_tools/importers/chocula.py +++ b/python/fatcat_tools/importers/chocula.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, ContainerEntity +from fatcat_openapi_client import DefaultApi, ContainerEntity from fatcat_tools.normal import clean_str @@ -17,7 +17,7 @@ class ChoculaImporter(EntityImporter): See guide for details on the many 'extra' fields used here. """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index e2157ee5..ca4739a1 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -17,7 +17,7 @@ import lxml from bs4 import BeautifulSoup from confluent_kafka import Consumer, KafkaException from fatcat_openapi_client import ( - ApiClient, + DefaultApi, ContainerEntity, EntityEdit, FileEntity, @@ -92,7 +92,7 @@ class EntityImporter: implementors must write insert_batch appropriately """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_extra = kwargs.get("editgroup_extra", dict()) eg_extra["git_rev"] = eg_extra.get( diff --git a/python/fatcat_tools/importers/crossref.py b/python/fatcat_tools/importers/crossref.py index 52bd7465..ca0b489d 100644 --- a/python/fatcat_tools/importers/crossref.py +++ b/python/fatcat_tools/importers/crossref.py @@ -2,7 +2,7 @@ import datetime from typing import Any, Dict, List, Optional, Sequence import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, ReleaseContrib, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseContrib, ReleaseEntity from fatcat_tools.biblio_lookup_tables import CONTAINER_TYPE_MAP from fatcat_tools.normal import clean_doi, clean_str, lookup_license_slug @@ -42,7 +42,7 @@ class CrossrefImporter(EntityImporter): See https://github.com/CrossRef/rest-api-doc for JSON schema notes """ - def __init__(self, api: ApiClient, issn_map_file: Sequence, **kwargs) -> None: + def __init__(self, api: DefaultApi, issn_map_file: Sequence, **kwargs) -> None: eg_desc: Optional[str] = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/datacite.py b/python/fatcat_tools/importers/datacite.py index b310f8bc..db6302e5 100644 --- a/python/fatcat_tools/importers/datacite.py +++ b/python/fatcat_tools/importers/datacite.py @@ -19,7 +19,7 @@ import dateparser import fatcat_openapi_client import langdetect import pycountry -from fatcat_openapi_client import ApiClient, ReleaseContrib, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseContrib, ReleaseEntity from fatcat_tools.biblio_lookup_tables import DATACITE_TYPE_MAP from fatcat_tools.normal import clean_doi, clean_str, lookup_license_slug @@ -94,7 +94,7 @@ class DataciteImporter(EntityImporter): def __init__( self, - api: ApiClient, + api: DefaultApi, issn_map_file: Sequence, debug: bool = False, insert_log_file: bool = None, diff --git a/python/fatcat_tools/importers/dblp_container.py b/python/fatcat_tools/importers/dblp_container.py index 36fe5f00..378945af 100644 --- a/python/fatcat_tools/importers/dblp_container.py +++ b/python/fatcat_tools/importers/dblp_container.py @@ -7,7 +7,7 @@ import sys # noqa: F401 from typing import Any, Dict, List, Optional, Sequence import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, ContainerEntity +from fatcat_openapi_client import DefaultApi, ContainerEntity from fatcat_tools.importers.common import EntityImporter from fatcat_tools.normal import clean_str @@ -16,7 +16,7 @@ from fatcat_tools.normal import clean_str class DblpContainerImporter(EntityImporter): def __init__( self, - api: ApiClient, + api: DefaultApi, issn_map_file: Sequence, dblp_container_map_file: Sequence, dblp_container_map_output: Any, diff --git a/python/fatcat_tools/importers/dblp_release.py b/python/fatcat_tools/importers/dblp_release.py index 5f78ca3a..b7880292 100644 --- a/python/fatcat_tools/importers/dblp_release.py +++ b/python/fatcat_tools/importers/dblp_release.py @@ -28,7 +28,7 @@ from typing import Any, Dict, List, Optional, Sequence import bs4 import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseEntity from fatcat_tools.importers.common import EntityImporter from fatcat_tools.normal import ( @@ -46,7 +46,7 @@ from fatcat_tools.transforms import entity_to_dict class DblpReleaseImporter(EntityImporter): def __init__( - self, api: ApiClient, dblp_container_map_file: Optional[Sequence] = None, **kwargs + self, api: DefaultApi, dblp_container_map_file: Optional[Sequence] = None, **kwargs ) -> None: eg_desc = kwargs.get( diff --git a/python/fatcat_tools/importers/doaj_article.py b/python/fatcat_tools/importers/doaj_article.py index 92dbe574..5a3d79bd 100644 --- a/python/fatcat_tools/importers/doaj_article.py +++ b/python/fatcat_tools/importers/doaj_article.py @@ -9,7 +9,7 @@ import warnings from typing import Any, Dict, List, Optional, Sequence import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseEntity from fatcat_tools.importers.common import MAX_ABSTRACT_LENGTH, EntityImporter from fatcat_tools.normal import ( @@ -26,7 +26,7 @@ from fatcat_tools.normal import ( class DoajArticleImporter(EntityImporter): - def __init__(self, api: ApiClient, issn_map_file: Sequence, **kwargs) -> None: + def __init__(self, api: DefaultApi, issn_map_file: Sequence, **kwargs) -> None: eg_desc = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/file_meta.py b/python/fatcat_tools/importers/file_meta.py index 892c1dcd..a7d69320 100644 --- a/python/fatcat_tools/importers/file_meta.py +++ b/python/fatcat_tools/importers/file_meta.py @@ -1,7 +1,7 @@ from typing import Any, Dict import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from .common import EntityImporter @@ -17,7 +17,7 @@ class FileMetaImporter(EntityImporter): imported which were missing file size, mimetype, md5, and/or sha256. """ - def __init__(self, api: ApiClient, require_grobid: bool = True, **kwargs): + def __init__(self, api: DefaultApi, require_grobid: bool = True, **kwargs): eg_desc = kwargs.pop("editgroup_description", None) or "File metadata updates" eg_extra = kwargs.pop("editgroup_extra", dict()) diff --git a/python/fatcat_tools/importers/fileset_generic.py b/python/fatcat_tools/importers/fileset_generic.py index d0c8b221..bb90a18f 100644 --- a/python/fatcat_tools/importers/fileset_generic.py +++ b/python/fatcat_tools/importers/fileset_generic.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FilesetEntity +from fatcat_openapi_client import DefaultApi, FilesetEntity from fatcat_tools import entity_from_dict @@ -20,7 +20,7 @@ class FilesetImporter(EntityImporter): Currently only creates (insert), no updates. """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = kwargs.pop("editgroup_description", None) or "Generic Fileset entity import" eg_extra = kwargs.pop("editgroup_extra", dict()) diff --git a/python/fatcat_tools/importers/grobid_metadata.py b/python/fatcat_tools/importers/grobid_metadata.py index 3c85132c..ec920a16 100644 --- a/python/fatcat_tools/importers/grobid_metadata.py +++ b/python/fatcat_tools/importers/grobid_metadata.py @@ -5,7 +5,7 @@ import json from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity, ReleaseEntity +from fatcat_openapi_client import DefaultApi, FileEntity, ReleaseEntity from fatcat_tools.normal import clean_doi, clean_str @@ -24,7 +24,7 @@ class GrobidMetadataImporter(EntityImporter): TODO: relaxing 'None' constraint on parse_record() might make this refactor-able. """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/ingest.py b/python/fatcat_tools/importers/ingest.py index 4f1cc3c4..3dea0446 100644 --- a/python/fatcat_tools/importers/ingest.py +++ b/python/fatcat_tools/importers/ingest.py @@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client from fatcat_openapi_client import ( - ApiClient, + DefaultApi, FileEntity, FilesetEntity, FilesetUrl, @@ -16,7 +16,7 @@ from .common import EntityImporter, make_rel_url class IngestFileResultImporter(EntityImporter): def __init__( - self, api: fatcat_openapi_client.ApiClient, require_grobid: bool = True, **kwargs + self, api: fatcat_openapi_client.DefaultApi, require_grobid: bool = True, **kwargs ) -> None: eg_desc = ( @@ -369,7 +369,7 @@ class SavePaperNowFileImporter(IngestFileResultImporter): them for further human review (as opposed to accepting by default). """ - def __init__(self, api: ApiClient, submit_mode: bool = True, **kwargs) -> None: + def __init__(self, api: DefaultApi, submit_mode: bool = True, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) @@ -408,7 +408,7 @@ class IngestWebResultImporter(IngestFileResultImporter): into webcapture objects. """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) @@ -576,7 +576,7 @@ class SavePaperNowWebImporter(IngestWebResultImporter): Like SavePaperNowFileImporter, but for webcapture (HTML) ingest. """ - def __init__(self, api: ApiClient, submit_mode: bool = True, **kwargs) -> None: + def __init__(self, api: DefaultApi, submit_mode: bool = True, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) @@ -628,7 +628,7 @@ class IngestFilesetResultImporter(IngestFileResultImporter): results into fileset objects. """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) @@ -854,7 +854,7 @@ class SavePaperNowFilesetImporter(IngestFilesetResultImporter): Like SavePaperNowFileImporter, but for fileset/dataset ingest. """ - def __init__(self, api: ApiClient, submit_mode: bool = True, **kwargs) -> None: + def __init__(self, api: DefaultApi, submit_mode: bool = True, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/importers/jalc.py b/python/fatcat_tools/importers/jalc.py index 9916a55f..8740d3ff 100644 --- a/python/fatcat_tools/importers/jalc.py +++ b/python/fatcat_tools/importers/jalc.py @@ -4,7 +4,7 @@ from typing import Any, Dict, List, Optional, Sequence import fatcat_openapi_client from bs4 import BeautifulSoup -from fatcat_openapi_client import ApiClient, ReleaseContrib, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseContrib, ReleaseEntity from fatcat_tools.normal import clean_doi, clean_str, is_cjk @@ -102,7 +102,7 @@ class JalcImporter(EntityImporter): NOTE: some JALC DOIs seem to get cross-registered with Crossref """ - def __init__(self, api: ApiClient, issn_map_file: Sequence, **kwargs) -> None: + def __init__(self, api: DefaultApi, issn_map_file: Sequence, **kwargs) -> None: eg_desc = kwargs.get("editgroup_description", "Automated import of JALC DOI metadata") eg_extra = kwargs.get("editgroup_extra", dict()) diff --git a/python/fatcat_tools/importers/journal_metadata.py b/python/fatcat_tools/importers/journal_metadata.py index fc1dfcbd..4a7a103f 100644 --- a/python/fatcat_tools/importers/journal_metadata.py +++ b/python/fatcat_tools/importers/journal_metadata.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, ContainerEntity +from fatcat_openapi_client import DefaultApi, ContainerEntity from fatcat_tools.normal import clean_str @@ -37,7 +37,7 @@ class JournalMetadataImporter(EntityImporter): See guide for details on the many 'extra' fields used here. """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/jstor.py b/python/fatcat_tools/importers/jstor.py index 79691c9a..21c192ef 100644 --- a/python/fatcat_tools/importers/jstor.py +++ b/python/fatcat_tools/importers/jstor.py @@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional, Sequence import fatcat_openapi_client from bs4 import BeautifulSoup -from fatcat_openapi_client import ApiClient, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseEntity from fatcat_tools.biblio_lookup_tables import LANG_MAP_MARC from fatcat_tools.normal import clean_doi, clean_str @@ -37,7 +37,7 @@ class JstorImporter(EntityImporter): Collection) """ - def __init__(self, api: ApiClient, issn_map_file: Sequence, **kwargs) -> None: + def __init__(self, api: DefaultApi, issn_map_file: Sequence, **kwargs) -> None: eg_desc = kwargs.get("editgroup_description", "Automated import of JSTOR XML metadata") eg_extra = kwargs.get("editgroup_extra", dict()) diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py index 70290d81..22523dd7 100644 --- a/python/fatcat_tools/importers/matched.py +++ b/python/fatcat_tools/importers/matched.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from fatcat_tools.normal import clean_doi @@ -32,7 +32,7 @@ class MatchedImporter(EntityImporter): - core_id, wikidata_id, pmcid, pmid: not as lists """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/importers/orcid.py b/python/fatcat_tools/importers/orcid.py index f3d82a86..d4799a39 100644 --- a/python/fatcat_tools/importers/orcid.py +++ b/python/fatcat_tools/importers/orcid.py @@ -2,7 +2,7 @@ import sys from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, CreatorEntity +from fatcat_openapi_client import DefaultApi, CreatorEntity from fatcat_tools.normal import clean_str @@ -26,7 +26,7 @@ def value_or_none(e: Any) -> Any: class OrcidImporter(EntityImporter): - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = kwargs.get( "editgroup_description", diff --git a/python/fatcat_tools/importers/pubmed.py b/python/fatcat_tools/importers/pubmed.py index a6c7409d..6d82f410 100644 --- a/python/fatcat_tools/importers/pubmed.py +++ b/python/fatcat_tools/importers/pubmed.py @@ -6,7 +6,7 @@ from typing import Any, Dict, List, Optional, Sequence import fatcat_openapi_client from bs4 import BeautifulSoup -from fatcat_openapi_client import ApiClient, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseEntity from fatcat_tools.biblio_lookup_tables import ( COUNTRY_NAME_MAP, @@ -29,7 +29,7 @@ class PubmedImporter(EntityImporter): """ def __init__( - self, api: ApiClient, issn_map_file: Sequence, lookup_refs: bool = True, **kwargs + self, api: DefaultApi, issn_map_file: Sequence, lookup_refs: bool = True, **kwargs ): eg_desc = kwargs.get( diff --git a/python/fatcat_tools/importers/shadow.py b/python/fatcat_tools/importers/shadow.py index 520258cb..61a7f3a6 100644 --- a/python/fatcat_tools/importers/shadow.py +++ b/python/fatcat_tools/importers/shadow.py @@ -1,7 +1,7 @@ from typing import Any, Dict, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, FileEntity +from fatcat_openapi_client import DefaultApi, FileEntity from fatcat_tools.normal import clean_doi, clean_isbn13, clean_pmid @@ -30,7 +30,7 @@ class ShadowLibraryImporter(EntityImporter): - datetime """ - def __init__(self, api: ApiClient, **kwargs) -> None: + def __init__(self, api: DefaultApi, **kwargs) -> None: eg_desc = ( kwargs.pop("editgroup_description", None) diff --git a/python/fatcat_tools/reviewers/review_common.py b/python/fatcat_tools/reviewers/review_common.py index d599b31f..c20b79ea 100644 --- a/python/fatcat_tools/reviewers/review_common.py +++ b/python/fatcat_tools/reviewers/review_common.py @@ -5,7 +5,7 @@ from collections import Counter from typing import Any, List, Optional import fatcat_openapi_client -from fatcat_openapi_client import ApiClient, Editgroup, EditgroupAnnotation, EntityEdit +from fatcat_openapi_client import DefaultApi, Editgroup, EditgroupAnnotation, EntityEdit """ checks should return: @@ -106,7 +106,7 @@ class EditCheck: class ReviewBot: - def __init__(self, api: fatcat_openapi_client.ApiClient, verbose: bool = False, **kwargs): + def __init__(self, api: fatcat_openapi_client.DefaultApi, verbose: bool = False, **kwargs): self.api = api self.checks: List[EditCheck] = [] @@ -281,7 +281,7 @@ class DummyReviewBot(ReviewBot): This bot reviews everything and always passes. """ - def __init__(self, api: ApiClient, **kwargs): + def __init__(self, api: DefaultApi, **kwargs): super().__init__(api, **kwargs) self.checks = [DummyCheck()] diff --git a/python/fatcat_tools/workers/changelog.py b/python/fatcat_tools/workers/changelog.py index ff358c66..3ea592bb 100644 --- a/python/fatcat_tools/workers/changelog.py +++ b/python/fatcat_tools/workers/changelog.py @@ -3,7 +3,7 @@ import time from typing import Any, Dict, List, Optional from confluent_kafka import Consumer, KafkaException, Producer -from fatcat_openapi_client import ApiClient, ReleaseEntity +from fatcat_openapi_client import DefaultApi, ReleaseEntity from fatcat_tools.transforms import release_ingest_request, release_to_elasticsearch @@ -18,7 +18,7 @@ class ChangelogWorker(FatcatWorker): def __init__( self, - api: ApiClient, + api: DefaultApi, kafka_hosts: str, produce_topic: str, poll_interval: float = 10.0, @@ -89,7 +89,7 @@ class EntityUpdatesWorker(FatcatWorker): def __init__( self, - api: ApiClient, + api: DefaultApi, kafka_hosts: str, consume_topic: str, release_topic: str, diff --git a/python/fatcat_tools/workers/elasticsearch.py b/python/fatcat_tools/workers/elasticsearch.py index 71c4dcf6..7c959e93 100644 --- a/python/fatcat_tools/workers/elasticsearch.py +++ b/python/fatcat_tools/workers/elasticsearch.py @@ -46,7 +46,7 @@ class ElasticsearchReleaseWorker(FatcatWorker): self.elasticsearch_backend = elasticsearch_backend self.elasticsearch_index = elasticsearch_index self.elasticsearch_release_index = elasticsearch_release_index - self.entity_type = ReleaseEntity + self.entity_type: Union[ReleaseEntity,ChangelogEntry,ContainerEntity] = ReleaseEntity self.transform_func: Callable = release_to_elasticsearch self.api_host = api_host self.query_stats = query_stats diff --git a/python/fatcat_tools/workers/worker_common.py b/python/fatcat_tools/workers/worker_common.py index 5239465b..f6b0293e 100644 --- a/python/fatcat_tools/workers/worker_common.py +++ b/python/fatcat_tools/workers/worker_common.py @@ -1,7 +1,7 @@ from typing import Any, Dict, Optional from confluent_kafka import Consumer, KafkaException, Message, TopicPartition -from fatcat_openapi_client import ApiClient +from fatcat_openapi_client import DefaultApi def most_recent_message(topic: str, kafka_config: Dict[str, Any]) -> Message: @@ -58,7 +58,7 @@ class FatcatWorker: kafka_hosts: str, produce_topic: Optional[str] = None, consume_topic: Optional[str] = None, - api: Optional[ApiClient] = None, + api: Optional[DefaultApi] = None, ) -> None: if api: self.api = api diff --git a/python/fatcat_web/editing_routes.py b/python/fatcat_web/editing_routes.py index ff869f90..a07be967 100644 --- a/python/fatcat_web/editing_routes.py +++ b/python/fatcat_web/editing_routes.py @@ -1,7 +1,7 @@ from typing import Any, Optional from fatcat_openapi_client import ( - ApiClient, + DefaultApi, ContainerEntity, CreatorEntity, Editgroup, @@ -31,7 +31,7 @@ from fatcat_web.forms import ( def generic_entity_create_from_toml( - user_api: ApiClient, entity_type: str, editgroup_id: str, toml_str: str + user_api: DefaultApi, entity_type: str, editgroup_id: str, toml_str: str ) -> EntityEdit: if entity_type == "container": entity = entity_from_toml(toml_str, ContainerEntity) @@ -60,7 +60,7 @@ def generic_entity_create_from_toml( def generic_entity_delete_edit( - user_api: ApiClient, entity_type: str, editgroup_id: str, edit_id: str + user_api: DefaultApi, entity_type: str, editgroup_id: str, edit_id: str ) -> None: try: if entity_type == "container": @@ -87,7 +87,7 @@ def generic_entity_delete_edit( def generic_entity_delete_entity( - user_api: ApiClient, entity_type: str, editgroup_id: str, entity_ident: str + user_api: DefaultApi, entity_type: str, editgroup_id: str, entity_ident: str ) -> EntityEdit: try: if entity_type == "container": @@ -112,7 +112,7 @@ def generic_entity_delete_entity( def generic_entity_update_from_toml( - user_api: ApiClient, entity_type: str, editgroup_id: str, existing_ident: str, toml_str: str + user_api: DefaultApi, entity_type: str, editgroup_id: str, existing_ident: str, toml_str: str ) -> EntityEdit: if entity_type == "container": entity = entity_from_toml(toml_str, ContainerEntity) @@ -140,7 +140,7 @@ def generic_entity_update_from_toml( return edit -def form_editgroup_get_or_create(api: ApiClient, edit_form: Any) -> Optional[Editgroup]: +def form_editgroup_get_or_create(api: DefaultApi, edit_form: Any) -> Optional[Editgroup]: """ This function expects a submitted, validated edit form """ |