diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2018-11-15 13:11:52 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2018-11-15 13:15:15 -0800 |
commit | bb28a3fc1cc900f2dde31e1dbc492d9661034f41 (patch) | |
tree | f037dd3d1bab6cbf08a562dbdd4c09361fe0c030 /python/fatcat_tools/transforms.py | |
parent | 9f817c6c70a749f2ac449ab4edfd26c6dd8a7410 (diff) | |
download | fatcat-bb28a3fc1cc900f2dde31e1dbc492d9661034f41.tar.gz fatcat-bb28a3fc1cc900f2dde31e1dbc492d9661034f41.zip |
large refactor of python names/paths
- Add __init__.py files for fatcat_tools submodules, and use them in
imports
- Add a bunch of comments to files.
- rename a number of classes and functions to be less verbose
Diffstat (limited to 'python/fatcat_tools/transforms.py')
-rw-r--r-- | python/fatcat_tools/transforms.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/python/fatcat_tools/transforms.py b/python/fatcat_tools/transforms.py index e10c6ba5..147acd7c 100644 --- a/python/fatcat_tools/transforms.py +++ b/python/fatcat_tools/transforms.py @@ -3,6 +3,9 @@ import collections from fatcat_client import ReleaseEntity, ApiClient def entity_to_json(entity): + """ + Hack to take advantage of the code-generated serialization code + """ ac = ApiClient() return ac.sanitize_for_serialization(entity) @@ -15,11 +18,12 @@ def entity_from_json(json_str, entity_type): thing.data = json_str return ac.deserialize(thing, entity_type) -def release_elastic_dict(release): +def release_to_elasticsearch(release): """ Converts from an entity model/schema to elasticsearch oriented schema. Returns: dict + Raises exception on error (never returns None) """ if release.state != 'active': |