Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docarray/array/abstract_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from docarray.utils._typing import change_cls_name

if TYPE_CHECKING:
from docarray.proto import DocArrayProto, NodeProto
from docarray.proto import DocumentArrayProto, NodeProto
from docarray.typing.tensor.abstract_tensor import AbstractTensor

T = TypeVar('T', bound='AnyDocArray')
Expand Down Expand Up @@ -130,12 +130,12 @@ def _set_data_column(

@classmethod
@abstractmethod
def from_protobuf(cls: Type[T], pb_msg: 'DocArrayProto') -> T:
def from_protobuf(cls: Type[T], pb_msg: 'DocumentArrayProto') -> T:
"""create a Document from a protobuf message"""
...

@abstractmethod
def to_protobuf(self) -> 'DocArrayProto':
def to_protobuf(self) -> 'DocumentArrayProto':
"""Convert DocArray into a Protobuf message"""
...

Expand Down
4 changes: 2 additions & 2 deletions docarray/array/array/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pydantic.fields import ModelField

from docarray.array.stacked.array_stacked import DocArrayStacked
from docarray.proto import DocArrayProto
from docarray.proto import DocumentArrayProto
from docarray.typing import TorchTensor
from docarray.typing.tensor.abstract_tensor import AbstractTensor

Expand Down Expand Up @@ -285,7 +285,7 @@ def traverse_flat(
return flattened

@classmethod
def from_protobuf(cls: Type[T], pb_msg: 'DocArrayProto') -> T:
def from_protobuf(cls: Type[T], pb_msg: 'DocumentArrayProto') -> T:
"""create a Document from a protobuf message
:param pb_msg: The protobuf message from where to construct the DocArray
"""
Expand Down
14 changes: 7 additions & 7 deletions docarray/array/array/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
import pandas as pd

from docarray import DocArray
from docarray.proto import DocArrayProto
from docarray.proto import DocumentArrayProto

T = TypeVar('T', bound='IOMixinArray')

Expand Down Expand Up @@ -108,19 +108,19 @@ def __init__(
...

@classmethod
def from_protobuf(cls: Type[T], pb_msg: 'DocArrayProto') -> T:
def from_protobuf(cls: Type[T], pb_msg: 'DocumentArrayProto') -> T:
"""create a Document from a protobuf message
:param pb_msg: The protobuf message from where to construct the DocArray
"""
return cls(
cls.document_type.from_protobuf(doc_proto) for doc_proto in pb_msg.docs
)

def to_protobuf(self) -> 'DocArrayProto':
def to_protobuf(self) -> 'DocumentArrayProto':
"""Convert DocArray into a Protobuf message"""
from docarray.proto import DocArrayProto
from docarray.proto import DocumentArrayProto

da_proto = DocArrayProto()
da_proto = DocumentArrayProto()
for doc in self:
da_proto.docs.append(doc.to_protobuf())

Expand Down Expand Up @@ -551,9 +551,9 @@ def _load_binary_all(
compress = None

if protocol is not None and protocol == 'protobuf-array':
from docarray.proto import DocArrayProto
from docarray.proto import DocumentArrayProto

dap = DocArrayProto()
dap = DocumentArrayProto()
dap.ParseFromString(d)

return cls.from_protobuf(dap)
Expand Down
4 changes: 2 additions & 2 deletions docarray/array/stacked/array_stacked.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,14 @@ def from_protobuf(cls: Type[T], pb_msg: 'DocArrayStackedProto') -> T:
def to_protobuf(self) -> 'DocArrayStackedProto':
"""Convert DocArray into a Protobuf message"""
from docarray.proto import (
DocArrayProto,
DocArrayStackedProto,
DocumentArrayProto,
ListOfAnyProto,
ListOfDocArrayProto,
NdArrayProto,
)

da_proto = DocArrayProto()
da_proto = DocumentArrayProto()
for doc in self:
da_proto.docs.append(doc.to_protobuf())

Expand Down
8 changes: 4 additions & 4 deletions docarray/proto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
if __pb__version__.startswith('4'):
from docarray.proto.pb.docarray_pb2 import (
DictOfAnyProto,
DocArrayProto,
DocArrayStackedProto,
DocumentArrayProto,
DocumentProto,
ListOfAnyProto,
ListOfDocArrayProto,
Expand All @@ -14,8 +14,8 @@
else:
from docarray.proto.pb2.docarray_pb2 import (
DictOfAnyProto,
DocArrayProto,
DocArrayStackedProto,
DocumentArrayProto,
DocumentProto,
ListOfAnyProto,
ListOfDocArrayProto,
Expand All @@ -24,12 +24,12 @@
)

__all__ = [
'DocArrayProto',
'DocumentArrayProto',
'DocumentProto',
'NdArrayProto',
'NodeProto',
'DocArrayStackedProto',
'DocArrayProto',
'DocumentArrayProto',
'ListOfDocArrayProto',
'ListOfAnyProto',
'DictOfAnyProto',
Expand Down
6 changes: 3 additions & 3 deletions docarray/proto/docarray.proto
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ message NodeProto {
// a sub Document
DocumentProto document = 7;
// a sub DocArray
DocArrayProto document_array = 8;
DocumentArrayProto document_array = 8;
//any list
ListOfAnyProto list = 9;
//any set
Expand Down Expand Up @@ -91,13 +91,13 @@ message ListOfAnyProto {
repeated NodeProto data = 1;
}

message DocArrayProto {
message DocumentArrayProto {
repeated DocumentProto docs = 1; // a list of Documents
}


message ListOfDocArrayProto {
repeated DocArrayProto data = 1;
repeated DocumentArrayProto data = 1;
}

message DocArrayStackedProto{
Expand Down
52 changes: 26 additions & 26 deletions docarray/proto/pb/docarray_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading