Skip to content

Commit 162bc1f

Browse files
author
Joan Fontanals Martinez
committed
fix: fix mypy for doclist
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
1 parent c346709 commit 162bc1f

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

docarray/array/doc_list/doc_list.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
overload,
1616
)
1717

18-
from typing_inspect import is_union_type
18+
from typing_inspect import is_union_type, SupportsIndex
1919

2020
from docarray.array.any_array import AnyDocArray
2121
from docarray.array.doc_list.io import IOMixinArray
@@ -62,7 +62,6 @@ class DocList(
6262
PushPullMixin,
6363
IOMixinArray,
6464
AnyDocArray[T_doc],
65-
List[T_doc],
6665
):
6766
"""
6867
DocList is a container of Documents.
@@ -200,7 +199,7 @@ def extend(self, docs: Iterable[T_doc]):
200199
"""
201200
self._data.extend(self._validate_docs(docs))
202201

203-
def insert(self, i: int, doc: T_doc):
202+
def insert(self, i: SupportsIndex, doc: T_doc):
204203
"""
205204
Insert a Document to the `DocList`. The Document must be from the same
206205
class as the doc_type of this `DocList` otherwise it will fail.
@@ -303,7 +302,7 @@ def from_protobuf(cls: Type[T], pb_msg: 'DocListProto') -> T:
303302
return super().from_protobuf(pb_msg)
304303

305304
@overload
306-
def __getitem__(self, item: int) -> T_doc:
305+
def __getitem__(self, item: SupportsIndex) -> T_doc:
307306
...
308307

309308
@overload

0 commit comments

Comments
 (0)