summaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/transforms/entities.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2021-11-02 19:51:48 -0700
committerBryan Newbold <bnewbold@robocracy.org>2021-11-02 19:51:51 -0700
commit4c77bdb8d92523935454f1c406c954913f923c01 (patch)
tree2b2a1221cc78683afb9f18a87ccfd10ef0afbc64 /python/fatcat_tools/transforms/entities.py
parent3da07382d682a0c474ddc79f748a50ad2cc758cd (diff)
downloadfatcat-4c77bdb8d92523935454f1c406c954913f923c01.tar.gz
fatcat-4c77bdb8d92523935454f1c406c954913f923c01.zip
lint: resolve existing mypy type errors
Adds annotations and re-workes dataflow to satisfy existing mypy issues, without adding any additional type annotations to, eg, function signatures. There will probably be many more type errors when annotations are all added.
Diffstat (limited to 'python/fatcat_tools/transforms/entities.py')
-rw-r--r--python/fatcat_tools/transforms/entities.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/python/fatcat_tools/transforms/entities.py b/python/fatcat_tools/transforms/entities.py
index 799d5d6c..ee4017d8 100644
--- a/python/fatcat_tools/transforms/entities.py
+++ b/python/fatcat_tools/transforms/entities.py
@@ -1,6 +1,6 @@
import collections
import json
-from typing import Any, Dict, List, Optional
+from typing import Any, Dict, List, Mapping, Optional
import toml
from fatcat_openapi_client import ApiClient
@@ -31,12 +31,12 @@ def entity_from_json(
"""
if not api_client:
api_client = ApiClient()
- thing = collections.namedtuple("Thing", ["data"])
+ thing = collections.namedtuple("thing", ["data"])
thing.data = json_str
return api_client.deserialize(thing, entity_type)
-def entity_from_dict(obj: dict, entity_type, api_client=None):
+def entity_from_dict(obj: Mapping[str, Any], entity_type, api_client=None):
json_str = json.dumps(obj)
return entity_from_json(json_str, entity_type, api_client=api_client)