/ haystack / marshal / protocol.py
protocol.py
 1  # SPDX-FileCopyrightText: 2022-present deepset GmbH <info@deepset.ai>
 2  #
 3  # SPDX-License-Identifier: Apache-2.0
 4  
 5  from typing import Any, Protocol
 6  
 7  
 8  class Marshaller(Protocol):
 9      def marshal(self, dict_: dict[str, Any]) -> str:
10          "Convert a dictionary to its string representation"
11          ...
12  
13      def unmarshal(self, data_: str | bytes | bytearray) -> dict[str, Any]:
14          """Convert a marshalled object to its dictionary representation"""
15          ...