Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 08b7e7b

Browse filesBrowse files
committed
fix: raise exception when type of DocList is object
Signed-off-by: punndcoder28 <puneethk.2899@gmail.com>
1 parent d0b9990 commit 08b7e7b
Copy full SHA for 08b7e7b

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎docarray/array/doc_list/doc_list.py

Copy file name to clipboardExpand all lines: docarray/array/doc_list/doc_list.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,11 @@ def __class_getitem__(cls, item: Union[Type[BaseDoc], TypeVar, str]):
337337

338338
if isinstance(item, type) and safe_issubclass(item, BaseDoc):
339339
return AnyDocArray.__class_getitem__.__func__(cls, item) # type: ignore
340-
else:
341-
return super().__class_getitem__(item)
340+
341+
if isinstance(item, object) and not isinstance(item, TypeVar):
342+
raise TypeError(f'Expecting a type, got {item} of type {type(item)}')
343+
344+
return super().__class_getitem__(item)
342345

343346
def __repr__(self):
344347
return AnyDocArray.__repr__(self) # type: ignore

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.