mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-01 12:18:12 +08:00
thuang-compress-annotation (#1980)
* thuang-compress-annotation * compress test * use zlib.decompress directly
This commit is contained in:
@@ -2,6 +2,7 @@ import copy
|
||||
import logging
|
||||
import sys
|
||||
from http import HTTPStatus
|
||||
import zlib
|
||||
|
||||
from flask import make_response, jsonify, current_app, abort
|
||||
from werkzeug.urls import url_unquote
|
||||
@@ -159,13 +160,17 @@ def annotations_put_fbs_helper(data_adaptor, fbs):
|
||||
annotations.write_labels(new_label_df, data_adaptor)
|
||||
|
||||
|
||||
def inflate(data):
|
||||
return zlib.decompress(data)
|
||||
|
||||
|
||||
def annotations_obs_put(request, data_adaptor):
|
||||
annotations = data_adaptor.dataset_config.user_annotations
|
||||
if annotations is None:
|
||||
return abort(HTTPStatus.NOT_IMPLEMENTED)
|
||||
|
||||
anno_collection = request.args.get("annotation-collection-name", default=None)
|
||||
fbs = request.get_data()
|
||||
fbs = inflate(request.get_data())
|
||||
|
||||
if anno_collection is not None:
|
||||
if not annotations.is_safe_collection_name(anno_collection):
|
||||
|
||||
Reference in New Issue
Block a user