diff --git a/docarray/array/mixins/proto.py b/docarray/array/mixins/proto.py index a38637f4e6d..de9aee858e6 100644 --- a/docarray/array/mixins/proto.py +++ b/docarray/array/mixins/proto.py @@ -28,8 +28,8 @@ def to_protobuf(self) -> 'DocumentArrayProto': dap.docs.append(doc.to_protobuf()) return dap - def _to_nested_item_protobuf(self) -> 'NodeProto': - """Convert a DocumentArray into a nested item protobuf message. + def _to_node_protobuf(self) -> NodeProto: + """Convert a DocumentArray into a NodeProto protobuf message. This function should be called when a DocumentArray is nested into another Document that need to be converted into a protobuf diff --git a/docarray/document/base_node.py b/docarray/document/base_node.py index 507511aef56..514d6031523 100644 --- a/docarray/document/base_node.py +++ b/docarray/document/base_node.py @@ -10,8 +10,8 @@ class BaseNode(ABC): """ @abstractmethod - def _to_nested_item_protobuf(self) -> 'NodeProto': - """Convert itself into a nested item protobuf message. This function should + def _to_node_protobuf(self) -> NodeProto: + """Convert itself into a NodeProto message. This function should be called when the self is nested into another Document that need to be converted into a protobuf diff --git a/docarray/document/mixins/proto.py b/docarray/document/mixins/proto.py index dea1bc13115..0f4f5fc7a64 100644 --- a/docarray/document/mixins/proto.py +++ b/docarray/document/mixins/proto.py @@ -61,7 +61,7 @@ def to_protobuf(self) -> 'DocumentProto': for field, value in self: try: if isinstance(value, BaseNode): - nested_item = value._to_nested_item_protobuf() + nested_item = value._to_node_protobuf() elif type(value) is str: nested_item = NodeProto(text=value) @@ -91,8 +91,8 @@ def to_protobuf(self) -> 'DocumentProto': return DocumentProto(data=data) - def _to_nested_item_protobuf(self) -> 'NodeProto': - """Convert Document into a nested item protobuf message. This function should be + def _to_node_protobuf(self) -> NodeProto: + """Convert Document into a NodeProto protobuf message. This function should be called when the Document is nest into another Document that need to be converted into a protobuf diff --git a/docarray/typing/tensor/tensor.py b/docarray/typing/tensor/tensor.py index cf576ffe3d5..32e14fb1362 100644 --- a/docarray/typing/tensor/tensor.py +++ b/docarray/typing/tensor/tensor.py @@ -1,4 +1,4 @@ -from typing import Union, TypeVar, Any, TYPE_CHECKING, Type, cast +from typing import TYPE_CHECKING, Any, Type, TypeVar, Union, cast import numpy as np @@ -40,8 +40,8 @@ def validate( def from_ndarray(cls: Type[T], value: np.ndarray) -> T: return value.view(cls) - def _to_nested_item_protobuf(self: T) -> 'NodeProto': - """Convert Document into a nested item protobuf message. This function should + def _to_node_protobuf(self: T) -> NodeProto: + """Convert Document into a NodeProto protobuf message. This function should be called when the Document is nested into another Document that need to be converted into a protobuf diff --git a/docarray/typing/url/any_url.py b/docarray/typing/url/any_url.py index 382a01fca46..c8cf3ed872b 100644 --- a/docarray/typing/url/any_url.py +++ b/docarray/typing/url/any_url.py @@ -5,8 +5,8 @@ class AnyUrl(BaseAnyUrl, BaseNode): - def _to_nested_item_protobuf(self) -> 'NodeProto': - """Convert Document into a nested item protobuf message. This function should + def _to_node_protobuf(self) -> NodeProto: + """Convert Document into a NodeProto protobuf message. This function should be called when the Document is nested into another Document that need to be converted into a protobuf