aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/api_entities.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-06-03 22:46:16 -0700
committerBryan Newbold <bnewbold@archive.org>2020-06-03 22:46:16 -0700
commit62d3299471b7b4229ae63e21e9d45ef7efde4348 (patch)
treefc0d04531ce4c81224723bd3646c88f74c7c42a2 /fatcat_scholar/api_entities.py
parent58688676ee2d96d9d7006e2fd8a14d47f271aa8f (diff)
downloadfatcat-scholar-62d3299471b7b4229ae63e21e9d45ef7efde4348.tar.gz
fatcat-scholar-62d3299471b7b4229ae63e21e9d45ef7efde4348.zip
reformat python code with black
Diffstat (limited to 'fatcat_scholar/api_entities.py')
-rw-r--r--fatcat_scholar/api_entities.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/fatcat_scholar/api_entities.py b/fatcat_scholar/api_entities.py
index 738c5c8..df24eda 100644
--- a/fatcat_scholar/api_entities.py
+++ b/fatcat_scholar/api_entities.py
@@ -1,10 +1,10 @@
-
import json
import collections
from fatcat_openapi_client import ApiClient
_global_serde_api_client = ApiClient()
+
def entity_to_dict(entity, api_client=None):
"""
Hack to take advantage of the code-generated serialization code.
@@ -19,6 +19,7 @@ def entity_to_dict(entity, api_client=None):
api_client = _global_serde_api_client
return api_client.sanitize_for_serialization(entity)
+
def entity_from_json(json_str, entity_type, api_client=None):
"""
Hack to take advantage of the code-generated deserialization code
@@ -27,10 +28,11 @@ def entity_from_json(json_str, entity_type, api_client=None):
"""
if not api_client:
api_client = _global_serde_api_client
- 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, entity_type, api_client=None):
json_str = json.dumps(obj)
return entity_from_json(json_str, entity_type, api_client=api_client)