Skip to content

Commit a10a66f

Browse files
committed
refactor: remove useless assignemnt
Signed-off-by: AnneY <evangeline-lun@foxmail.com>
1 parent 1906604 commit a10a66f

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

docarray/index/abstract.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -854,13 +854,9 @@ def _convert_dict_to_doc(
854854
:return: A Document object
855855
"""
856856
for field_name, _ in schema.__fields__.items():
857-
t_ = schema._get_field_type(field_name)
858-
if is_tensor_union(t_):
859-
t_ = AbstractTensor
860-
else:
861-
t_ = unwrap_optional_type(t_)
857+
t_ = unwrap_optional_type(schema._get_field_type(field_name))
862858

863-
if issubclass(t_, BaseDocument):
859+
if not is_union_type(t_) and issubclass(t_, BaseDocument):
864860
inner_dict = {}
865861

866862
fields = [

tests/index/base_classes/test_base_doc_store.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,6 @@ class OtherNestedDoc(NestedDoc):
342342
)
343343

344344

345-
# TODO change here
346345
def test_docs_validation_unions():
347346
class OptionalDoc(BaseDocument):
348347
tens: Optional[NdArray[10]] = Field(dim=1000)

0 commit comments

Comments
 (0)