diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-06-03 23:30:44 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-06-03 23:30:46 -0700 |
commit | 4c90b94c24e9e78382d12947fb27c203318d6c9c (patch) | |
tree | 56756e5ff572201369634a5cd90c7e529e032e13 /fatcat_scholar/api_entities.py | |
parent | ba7295cdf09c6b2bf288db85e15aa44b6782da06 (diff) | |
download | fatcat-scholar-4c90b94c24e9e78382d12947fb27c203318d6c9c.tar.gz fatcat-scholar-4c90b94c24e9e78382d12947fb27c203318d6c9c.zip |
flake8-annotation linting
Added some new annotations; need to finish more.
Diffstat (limited to 'fatcat_scholar/api_entities.py')
-rw-r--r-- | fatcat_scholar/api_entities.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/fatcat_scholar/api_entities.py b/fatcat_scholar/api_entities.py index df24eda..c4a4ace 100644 --- a/fatcat_scholar/api_entities.py +++ b/fatcat_scholar/api_entities.py @@ -1,11 +1,13 @@ import json import collections +from typing import Any, Optional + from fatcat_openapi_client import ApiClient _global_serde_api_client = ApiClient() -def entity_to_dict(entity, api_client=None): +def entity_to_dict(entity: Any, api_client: Optional[ApiClient] = None) -> dict: """ Hack to take advantage of the code-generated serialization code. @@ -20,7 +22,9 @@ def entity_to_dict(entity, api_client=None): return api_client.sanitize_for_serialization(entity) -def entity_from_json(json_str, entity_type, api_client=None): +def entity_from_json( + json_str: str, entity_type: Any, api_client: Optional[ApiClient] = None +) -> Any: """ Hack to take advantage of the code-generated deserialization code @@ -33,6 +37,8 @@ def entity_from_json(json_str, entity_type, api_client=None): return api_client.deserialize(thing, entity_type) -def entity_from_dict(obj, entity_type, api_client=None): +def entity_from_dict( + obj: dict, entity_type: Any, api_client: Optional[ApiClient] = None +) -> Any: json_str = json.dumps(obj) return entity_from_json(json_str, entity_type, api_client=api_client) |