From 62d3299471b7b4229ae63e21e9d45ef7efde4348 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Wed, 3 Jun 2020 22:46:16 -0700 Subject: reformat python code with black --- fatcat_scholar/api_entities.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fatcat_scholar/api_entities.py') 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) -- cgit v1.2.3