Skip to content

Commit

Permalink
replace usage of issubclass with safe_issubclass in `BaseDocWitho… (
Browse files Browse the repository at this point in the history
docarray#1904)

Signed-off-by: YuXuan Tay <wyextay@gmail.com>
Co-authored-by: Joan Fontanals <joan.martinez@jina.ai>
  • Loading branch information
yxtay and JoanFM authored Aug 17, 2024
1 parent 8f4ba7c commit e6802a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docarray/base_doc/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ def _exclude_doclist(
from docarray.array.any_array import AnyDocArray

type_ = self._get_field_annotation(field)
if isinstance(type_, type) and issubclass(type_, AnyDocArray):
if isinstance(type_, type) and safe_issubclass(type_, AnyDocArray):
doclist_exclude_fields.append(field)

original_exclude = exclude
Expand Down
4 changes: 2 additions & 2 deletions docarray/index/backends/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def python_type_to_db_type(self, python_type: Type) -> Any:
AbstractTensor: DataType.FLOAT_VECTOR,
}

if issubclass(python_type, ID):
if safe_issubclass(python_type, ID):
return DataType.VARCHAR

for py_type, db_type in type_map.items():
Expand Down Expand Up @@ -665,7 +665,7 @@ def find_batched(
if search_field:
if '__' in search_field:
fields = search_field.split('__')
if issubclass(self._schema._get_field_annotation(fields[0]), AnyDocArray): # type: ignore
if safe_issubclass(self._schema._get_field_annotation(fields[0]), AnyDocArray): # type: ignore
return self._subindices[fields[0]].find_batched(
queries,
search_field='__'.join(fields[1:]),
Expand Down

0 comments on commit e6802a2

Please sign in to comment.