mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-06 17:48:12 +08:00
+4
-1
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import warnings
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_caching import Cache
|
from flask_caching import Cache
|
||||||
@@ -7,11 +8,13 @@ from flask_cors import CORS
|
|||||||
from flask_restful_swagger_2 import get_swagger_blueprint
|
from flask_restful_swagger_2 import get_swagger_blueprint
|
||||||
|
|
||||||
from .rest_api.rest import get_api_resources
|
from .rest_api.rest import get_api_resources
|
||||||
from .util.utils import Float32JSONEncoder
|
from .util.utils import Float32JSONEncoder, custom_format_warning
|
||||||
from .web import webapp
|
from .web import webapp
|
||||||
|
|
||||||
REACTIVE_LIMIT = 1_000_000
|
REACTIVE_LIMIT = 1_000_000
|
||||||
|
|
||||||
|
warnings.formatwarning = custom_format_warning
|
||||||
|
|
||||||
app = Flask(__name__, static_folder="web/static")
|
app = Flask(__name__, static_folder="web/static")
|
||||||
app.json_encoder = Float32JSONEncoder
|
app.json_encoder = Float32JSONEncoder
|
||||||
cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000})
|
cache = Cache(app, config={"CACHE_TYPE": "simple", "CACHE_DEFAULT_TIMEOUT": 860000})
|
||||||
|
|||||||
@@ -15,6 +15,10 @@ class Float32JSONEncoder(json.JSONEncoder):
|
|||||||
return json.JSONEncoder.default(self, obj)
|
return json.JSONEncoder.default(self, obj)
|
||||||
|
|
||||||
|
|
||||||
|
def custom_format_warning(msg, *args, **kwargs):
|
||||||
|
return f"[cellxgene] Warning: {msg} \n"
|
||||||
|
|
||||||
|
|
||||||
def get_mime_type(default="application/json", acceptable_types=["application/json", "text/csv"], query_param=None,
|
def get_mime_type(default="application/json", acceptable_types=["application/json", "text/csv"], query_param=None,
|
||||||
header=None):
|
header=None):
|
||||||
mime_type = default
|
mime_type = default
|
||||||
|
|||||||
Reference in New Issue
Block a user