When reading annotations from tiledb, check if the values are byte literals and if so, decode them. Also pin s3f3 to 0.4.2. (#1788)

This commit is contained in:
maniarathi
2020-08-22 09:42:11 -07:00
committed by GitHub
parent fae9ac9382
commit a5c9ffa880
3 changed files with 11 additions and 10 deletions
@@ -74,6 +74,10 @@ class AnnotationsHostedTileDB(Annotations):
indexes = list()
for col_name, col_val in data.items():
# If the column values are byte literals, decode them
if isinstance(col_val[0], bytes):
col_val = [value.decode('utf-8') for value in col_val]
if repr_meta and col_name in repr_meta:
new_col = pd.Series(col_val, dtype=repr_meta[col_name])
data[col_name] = new_col
+1 -1
View File
@@ -20,5 +20,5 @@ scipy>=1.3.0
requests>=2.22.0
sqlalchemy>=1.3.18
tiledb>=0.5.9,>=0.6.2
s3fs>=0.4.2
s3fs==0.4.2
gunicorn>=20.0.4
@@ -1,22 +1,20 @@
import json
from os import path, listdir
import shutil
import unittest
from os import path, listdir
from unittest.mock import MagicMock, patch
import numpy as np
import pandas as pd
import tiledb
from flask import Flask
import server.test.unit.decode_fbs as decode_fbs
import shutil
import numpy as np
import pandas as pd
from server.common.errors import AnnotationCategoryNameError
from server.common.rest import schema_get_helper, annotations_put_fbs_helper
from server.data_common.matrix_loader import MatrixDataType
from server.db.cellxgene_orm import CellxGeneDataset, Annotation
from server.test import data_with_tmp_annotations, make_fbs, data_with_tmp_tiledb_annotations
from server.data_common.matrix_loader import MatrixDataType
from server.common.errors import AnnotationCategoryNameError
class auth(object):
@@ -77,7 +75,6 @@ class WritableTileDBStoredAnnotationTest(unittest.TestCase):
def test_write_labels_creates_a_dataset_if_it_doesnt_exist(self):
with self.app.test_request_context():
new_name = 'new_dataset/location'
self.data.get_location = MagicMock(return_value=new_name)
num_datasets = len(self.db.query([CellxGeneDataset]))