mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 02:08:11 +08:00
Style guide cleanup
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
class QueryStringError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def _convert_variable(datatype, variable):
|
||||
"""
|
||||
Convert variable to number (float/int)
|
||||
@@ -19,6 +20,7 @@ def _convert_variable(datatype, variable):
|
||||
except ValueError:
|
||||
raise
|
||||
|
||||
|
||||
def parse_filter(filter, schema):
|
||||
"""
|
||||
{key: variable_type
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import json
|
||||
|
||||
from numpy import float32, integer
|
||||
from flask import make_response, jsonify, Response
|
||||
|
||||
|
||||
class Float32JSONEncoder(json.JSONEncoder):
|
||||
def default(self, obj):
|
||||
if isinstance(obj, float32):
|
||||
@@ -10,6 +12,7 @@ class Float32JSONEncoder(json.JSONEncoder):
|
||||
return int(obj)
|
||||
return json.JSONEncoder.default(self, obj)
|
||||
|
||||
|
||||
def make_payload(data, errormessage="", errorcode=200):
|
||||
"""
|
||||
Creates JSON respons for requests
|
||||
@@ -31,13 +34,7 @@ def make_payload(data, errormessage="", errorcode=200):
|
||||
}
|
||||
}), errorcode)
|
||||
|
||||
|
||||
def make_streaming_response(data_generator, errorcode=200, content_type="application/json"):
|
||||
# TODO headers
|
||||
return Response(data_generator, status=errorcode, content_type=content_type)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user