Skip to content

Commit e6802a2

Browse files
yxtayJoan Fontanals
andauthored
replace usage of issubclass with safe_issubclass in `BaseDocWitho… (docarray#1904)
Signed-off-by: YuXuan Tay <wyextay@gmail.com> Co-authored-by: Joan Fontanals <joan.martinez@jina.ai>
1 parent 8f4ba7c commit e6802a2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

docarray/base_doc/doc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def _exclude_doclist(
326326
from docarray.array.any_array import AnyDocArray
327327

328328
type_ = self._get_field_annotation(field)
329-
if isinstance(type_, type) and issubclass(type_, AnyDocArray):
329+
if isinstance(type_, type) and safe_issubclass(type_, AnyDocArray):
330330
doclist_exclude_fields.append(field)
331331

332332
original_exclude = exclude

docarray/index/backends/milvus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def python_type_to_db_type(self, python_type: Type) -> Any:
192192
AbstractTensor: DataType.FLOAT_VECTOR,
193193
}
194194

195-
if issubclass(python_type, ID):
195+
if safe_issubclass(python_type, ID):
196196
return DataType.VARCHAR
197197

198198
for py_type, db_type in type_map.items():
@@ -665,7 +665,7 @@ def find_batched(
665665
if search_field:
666666
if '__' in search_field:
667667
fields = search_field.split('__')
668-
if issubclass(self._schema._get_field_annotation(fields[0]), AnyDocArray): # type: ignore
668+
if safe_issubclass(self._schema._get_field_annotation(fields[0]), AnyDocArray): # type: ignore
669669
return self._subindices[fields[0]].find_batched(
670670
queries,
671671
search_field='__'.join(fields[1:]),

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy