Skip to content

feat(v2): access attribute at document array level#790

Merged
JohannesMessner merged 3 commits into
feat-rewrite-v2from
feat-v2-da-attribute
Nov 15, 2022
Merged

feat(v2): access attribute at document array level#790
JohannesMessner merged 3 commits into
feat-rewrite-v2from
feat-v2-da-attribute

Conversation

@samsja

@samsja samsja commented Nov 15, 2022

Copy link
Copy Markdown
Member

What this PR do

This PR allow bulk access at document array level

from docarray import DocumentArray, Document



class Mmdoc(BaseDocument):
    text: str

da = DocumentArray[Mmdoc](
    (Mmdoc(text=f'hello') for _ in range(10))
)

assert da.text == 10*['hello']

@samsja samsja changed the base branch from main to feat-rewrite-v2 November 15, 2022 14:15
Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
@samsja samsja force-pushed the feat-v2-da-attribute branch from 4f8300a to 2d79f9b Compare November 15, 2022 14:23
Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
@JohannesMessner JohannesMessner merged commit e4791fd into feat-rewrite-v2 Nov 15, 2022
@JohannesMessner JohannesMessner deleted the feat-v2-da-attribute branch November 15, 2022 17:31
samsja added a commit that referenced this pull request Nov 17, 2022
* feat(da): add get attribute mixin to da

Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>

* feat(da): generate attribute on the fly at the da level

Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>

* feat(da): add comment

Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>

Signed-off-by: Sami Jaghouar <sami.jaghouar@hotmail.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants