-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(fetchResults): deserialize results
Deserialize fetchResults results.
- Loading branch information
Showing
4 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
fetchResults API | ||
Author: Will Pringle <[email protected]> | ||
Date: September 2024 | ||
""" | ||
|
||
import pythonmonkey as pm | ||
from .. import dry | ||
from .. import js | ||
from .job_serializers import default_serializers, deserialize | ||
|
||
def fetch_results_maker(fetch_results_js): | ||
def fetch_results(*args): | ||
serialized_results = dry.aio.blockify(fetch_results_js)(*args) | ||
|
||
results = [] | ||
for element in serialized_results: | ||
deserialized_value = deserialize(element['value'], default_serializers) | ||
slice_number = int(element['slice']) | ||
|
||
results.append({ 'slice': slice_number, 'value': deserialized_value }) | ||
|
||
return results | ||
return fetch_results | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters