chore(document): change type hint for tags in docarray.document.data.…#735
chore(document): change type hint for tags in docarray.document.data.…#735JoanFM merged 2 commits intodocarray:mainfrom
Conversation
| self._data.tags = value | ||
|
|
||
| @property | ||
| def _metadata(self) -> Optional[Dict[str, 'StructValueType']]: |
There was a problem hiding this comment.
_property.py is auto-generated using scripts/gen_doc_property_mixin.py. This line is the same as the code in the main branch https://github.com/docarray/docarray/blob/main/docarray/document/mixins/_property.py.
There was a problem hiding this comment.
@JoanFM sorry, my mistake. I double-checked, and getter and setter for _metadata are missing in the version of _property.py in my branch because the script scripts/gen_doc_property_mixin.py has the following code
for f in fields(DocumentData):
if f.name.startswith('_'):
continue
....(see https://github.com/docarray/docarray/blob/main/scripts/gen_doc_property_mixin.py)
and therefore it skips all fields starting with _. I do not know why you have those getter and setter in the main branch. I can remove the if in the script, but in that case the script would generate also getter and setter for other fields of Document starting with _, such as _reference_doc. Alternatively, I may add the getter and setter for _metadata manually.
What do you prefer? Any other idea?
| from docarray import DocumentArray | ||
| from docarray.typing import ArrayType, StructValueType, DocumentContentType | ||
| if TYPE_CHECKING: | ||
| from ...score import NamedScore |
There was a problem hiding this comment.
I can do that: it is a simple change to the script scripts/gen_doc_property_mixin.py
7a0f6e0 to
235a247
Compare
235a247 to
8515311
Compare
Codecov ReportBase: 88.29% // Head: 79.80% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #735 +/- ##
==========================================
- Coverage 88.29% 79.80% -8.50%
==========================================
Files 134 133 -1
Lines 6648 6655 +7
==========================================
- Hits 5870 5311 -559
- Misses 778 1344 +566
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
…DocumentData
Goals: