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
12 changes: 6 additions & 6 deletions src/connect/codec.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def name(self) -> str:
str: The name of the codec.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def marshal(self, message: Any) -> bytes:
Expand All @@ -54,7 +54,7 @@ def marshal(self, message: Any) -> bytes:
ValueError: If the message is not a protobuf message.

"""
raise NotImplementedError
raise NotImplementedError()

@abc.abstractmethod
def unmarshal(self, data: bytes, message: Any) -> Any:
Expand All @@ -71,7 +71,7 @@ def unmarshal(self, data: bytes, message: Any) -> Any:
NotImplementedError: This method should be implemented by subclasses.

"""
raise NotImplementedError
raise NotImplementedError()


class ProtoBinaryCodec(Codec):
Expand Down Expand Up @@ -215,7 +215,7 @@ def get(self, name: str) -> Codec | None:
Codec: The codec associated with the given name.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def protobuf(self) -> Codec | None:
Expand All @@ -225,7 +225,7 @@ def protobuf(self) -> Codec | None:
Codec: An instance of the Codec class configured for protobuf encoding.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def names(self) -> list[str]:
Expand All @@ -235,7 +235,7 @@ def names(self) -> list[str]:
list[str]: A list of names as strings.

"""
pass
raise NotImplementedError()


class CodecMap(ReadOnlyCodecs):
Expand Down
6 changes: 3 additions & 3 deletions src/connect/compression.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def name(self) -> str:
str: The name of the compression algorithm.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def compress(self, data: bytes) -> bytes:
Expand All @@ -37,7 +37,7 @@ def compress(self, data: bytes) -> bytes:
bytes: The compressed data.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def decompress(self, data: bytes, read_max_bytes: int) -> bytes:
Expand All @@ -51,7 +51,7 @@ def decompress(self, data: bytes, read_max_bytes: int) -> bytes:
bytes: The decompressed data.

"""
pass
raise NotImplementedError()


class GZipCompression(Compression):
Expand Down
22 changes: 11 additions & 11 deletions src/connect/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def spec(self) -> Spec:
Spec: The specification details.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def peer(self) -> Any:
Expand All @@ -54,7 +54,7 @@ def peer(self) -> Any:
of the return value will depend on the implementation details.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
async def receive(self, message: Any) -> Any:
Expand All @@ -67,7 +67,7 @@ async def receive(self, message: Any) -> Any:
Any: The result of processing the message.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def request_header(self) -> Any:
Expand All @@ -77,7 +77,7 @@ def request_header(self) -> Any:
Any: The request header.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def send(self, message: Any) -> bytes:
Expand All @@ -90,7 +90,7 @@ def send(self, message: Any) -> bytes:
bytes: The response received after sending the message.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def response_header(self) -> MutableHeaders:
Expand All @@ -100,7 +100,7 @@ def response_header(self) -> MutableHeaders:
Any: The response header.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def response_trailer(self) -> MutableHeaders:
Expand All @@ -113,7 +113,7 @@ def response_trailer(self) -> MutableHeaders:
Any: The return type is not specified as this is a placeholder method.

"""
pass
raise NotImplementedError()

def close(self, data: bytes) -> Response:
"""Close the connection with the provided data.
Expand All @@ -128,7 +128,7 @@ def close(self, data: bytes) -> Response:
NotImplementedError: This method is not yet implemented.

"""
raise NotImplementedError
raise NotImplementedError()

def close_with_error(self, error: Exception) -> Response:
"""Close the connection and returns a response indicating an error.
Expand All @@ -143,7 +143,7 @@ def close_with_error(self, error: Exception) -> Response:
NotImplementedError: This method is not yet implemented.

"""
raise NotImplementedError
raise NotImplementedError()


class ReceiveConn(Protocol):
Expand All @@ -163,7 +163,7 @@ def spec(self) -> Spec:
Spec: The specification for the current object.

"""
raise NotImplementedError
raise NotImplementedError()

@abc.abstractmethod
async def receive(self, message: Any) -> Any:
Expand All @@ -179,7 +179,7 @@ async def receive(self, message: Any) -> Any:
NotImplementedError: This method should be implemented by subclasses.

"""
raise NotImplementedError
raise NotImplementedError()


T = TypeVar("T")
Expand Down
12 changes: 6 additions & 6 deletions src/connect/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def methods(self) -> list[HttpMethod]:
list[HttpMethod]: A list of HTTP methods.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def content_types(self) -> list[str]:
Expand All @@ -90,7 +90,7 @@ def content_types(self) -> list[str]:
None

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def can_handle_payload(self, request: Request, content_type: str) -> bool:
Expand All @@ -107,7 +107,7 @@ def can_handle_payload(self, request: Request, content_type: str) -> bool:
NotImplementedError: This method should be implemented by subclasses.

"""
raise NotImplementedError
raise NotImplementedError()

@abc.abstractmethod
async def conn(self, request: Request, response_headers: MutableHeaders) -> StreamingHandlerConn:
Expand All @@ -121,7 +121,7 @@ async def conn(self, request: Request, response_headers: MutableHeaders) -> Stre
StreamingHandlerConn: The connection handler for streaming.

"""
pass
raise NotImplementedError()


class Protocol(abc.ABC):
Expand All @@ -143,7 +143,7 @@ def handler(self, params: ProtocolHandlerParams) -> ProtocolHandler:
ProtocolHandler: An instance of ProtocolHandler based on the provided parameters.

"""
pass
raise NotImplementedError()

@abc.abstractmethod
def client(self) -> None:
Expand All @@ -152,7 +152,7 @@ def client(self) -> None:
This method currently does nothing and is intended to be implemented
in the future with the necessary client-side logic.
"""
pass
raise NotImplementedError()


def mapped_method_handlers(handlers: list[ProtocolHandler]) -> dict[HttpMethod, list[ProtocolHandler]]:
Expand Down
12 changes: 4 additions & 8 deletions src/connect/protocol_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,6 @@ async def stream() -> AsyncGenerator[bytes]:
class ProtocolConnect(Protocol):
"""ProtocolConnect is a class that implements the Protocol interface for handling connection protocols."""

def __init__(self) -> None:
"""Initialize the class instance."""
pass

def handler(self, params: ProtocolHandlerParams) -> ConnectHandler:
"""Handle the creation of a ConnectHandler based on the provided ProtocolHandlerParams.

Expand Down Expand Up @@ -280,7 +276,7 @@ def handler(self, params: ProtocolHandlerParams) -> ConnectHandler:

def client(self) -> None:
"""Handle the client connection."""
pass
raise NotImplementedError()


class ConnectUnmarshaler:
Expand Down Expand Up @@ -505,7 +501,7 @@ def spec(self) -> Spec:
NotImplementedError: If the method is not implemented by a subclass.

"""
raise NotImplementedError
raise NotImplementedError()

def peer(self) -> Any:
"""Return the peer information.
Expand All @@ -517,7 +513,7 @@ def peer(self) -> Any:
Any: The peer information.

"""
raise NotImplementedError
raise NotImplementedError()

async def receive(self, message: Any) -> Any:
"""Receives a message, unmarshals it, and returns the resulting object.
Expand All @@ -539,7 +535,7 @@ def request_header(self) -> Any:
Any: The request header.

"""
pass
raise NotImplementedError()

def send(self, message: Any) -> bytes:
"""Send a message by marshaling it into bytes.
Expand Down