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

feat: make DocList an actual Python List - #1457

#1457
Merged
JoanFM merged 17 commits into
maindocarray/docarray:mainfrom
feat-make-doclist-a-listdocarray/docarray:feat-make-doclist-a-listCopy head branch name to clipboard
Apr 27, 2023
Merged

feat: make DocList an actual Python List#1457
JoanFM merged 17 commits into
maindocarray/docarray:mainfrom
feat-make-doclist-a-listdocarray/docarray:feat-make-doclist-a-listCopy head branch name to clipboard

Conversation

@JoanFM

@JoanFM JoanFM commented Apr 26, 2023

Copy link
Copy Markdown
Member

This PR needs to make sure that DocList is a List, thus fixing the issue that I cannot call schema of a BaseDoc having nested DocList.

@github-actions github-actions Bot added size/s and removed size/xs labels Apr 26, 2023
@JoanFM
JoanFM force-pushed the feat-make-doclist-a-list branch 2 times, most recently from f7a713f to 162bc1f Compare April 26, 2023 13:56

@JohannesMessner JohannesMessner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JoanFM JoanFM changed the title feat: try to make DocList and actual Python List feat: try to make DocList an actual Python List Apr 26, 2023
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM
JoanFM force-pushed the feat-make-doclist-a-list branch from 162bc1f to ba6f5f9 Compare April 26, 2023 14:07
@JoanFM
JoanFM requested a review from JohannesMessner April 26, 2023 14:37
Comment thread docarray/array/doc_list/sequence_indexing_mixin.py Outdated
Comment thread docarray/array/doc_list/sequence_indexing_mixin.py Outdated
@@ -139,7 +142,7 @@ def _del_from_indices(self: T, item: Iterable[int]) -> None:
# each delete
del self._data[ix]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still have _data ?

@samsja samsja left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but here we still have the _data things this looks weird no ?

@jupyterjazz

Copy link
Copy Markdown
Contributor

this line is the problem

if isinstance(docs, List):

after this change, it's always true

we could do this

if not isinstance(docs, DocList) and isinstance(docs, List):

Comment thread docarray/index/abstract.py Outdated
Signed-off-by: Joan Fontanals Martinez <joan.martinez@jina.ai>
@JoanFM
JoanFM force-pushed the feat-make-doclist-a-list branch from cefa41b to 65b89d5 Compare April 26, 2023 15:41
@JoanFM
JoanFM marked this pull request as draft April 26, 2023 16:42
Joan Fontanals Martinez and others added 4 commits April 26, 2023 19:55
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
return super().__getitem__(item)

@classmethod
def __class_getitem__(cls, item: Union[Type[BaseDoc], TypeVar, str]):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have this redefined at different inheritance levels

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure to understand how it will look like

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not quite understand this need? what super has another _class_getitem?

Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
@JoanFM JoanFM changed the title feat: try to make DocList an actual Python List feat: make DocList an actual Python List Apr 27, 2023
samsja added 3 commits April 27, 2023 10:44
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
Signed-off-by: samsja <sami.jaghouar@hotmail.fr>
@github-actions

Copy link
Copy Markdown

📝 Docs are deployed on https://ft-feat-make-doclist-a-list--jina-docs.netlify.app 🎉

@JoanFM
JoanFM merged commit b3649b4 into main Apr 27, 2023
@JoanFM
JoanFM deleted the feat-make-doclist-a-list branch April 27, 2023 09:44

@jupyterjazz jupyterjazz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! I'll try out fastapi integration now

Comment on lines +191 to +197
"""Return all v @classmethod
def __class_getitem__(cls, item: Union[Type[BaseDoc], TypeVar, str]):alues of the fields from all docs this doc_list contains
@classmethod
def __class_getitem__(cls, item: Union[Type[BaseDoc], TypeVar, str]):
:param field: name of the fields to extract
:return: Returns a list of the field value for each document
in the doc_list like container

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note for myself to correct this docstring in my fastapi PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

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