-
Notifications
You must be signed in to change notification settings - Fork 234
Validation bug Fix: DocList and DocVec are not coerced to each other #1568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: agaraman0 <agaraman0@gmail.com>
Hello @agaraman0 , can u please handle the tests and mypy errors? |
docarray/array/doc_list/doc_list.py
Outdated
elif isinstance(value, DocVec): | ||
return value.to_doc_list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here we need to test if the documen_type of the value and self are compatible.
If they are you can silence mypy by return cast(T, )
docarray/array/doc_list/doc_list.py
Outdated
elif isinstance(value, DocVec): | ||
return value.to_doc_list() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
elif isinstance(value, DocVec): | |
return value.to_doc_list() | |
elif isinstance(value, DocVec): | |
if issubclass(value.doc_type, self.doc_type) or value.doc_type == cls.doc_type: | |
return cast(T, value.to_doc_list() | |
else: | |
raise ValueError(f'DocList[value.doc_type] is not compatible with {cls}') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smth like this
Signed-off-by: agaraman0 <agaraman0@gmail.com>
Signed-off-by: agaraman0 <agaraman0@gmail.com>
Signed-off-by: agaraman0 <agaraman0@gmail.com>
Signed-off-by: agaraman0 <agaraman0@gmail.com>
fixes issue #1545