Fixed typing.

This commit is contained in:
2026-06-13 00:59:18 +00:00
parent 43f2cdbd53
commit acabc049e7
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -6,7 +6,7 @@ from typing import Any, TypeVar
import msgspec import msgspec
from kanta.serialization.framing import LineFramer from kanta.serialization.framing import Framer, LineFramer
T = TypeVar("T") T = TypeVar("T")
@@ -14,7 +14,7 @@ T = TypeVar("T")
class JsonSerializer: class JsonSerializer:
"""Line-based JSON serializer.""" """Line-based JSON serializer."""
framer_cls = LineFramer framer_cls: type[Framer] = LineFramer
def encode(self, obj: Any) -> bytes: def encode(self, obj: Any) -> bytes:
return msgspec.json.encode(obj) return msgspec.json.encode(obj)
+2 -2
View File
@@ -6,7 +6,7 @@ from typing import Any, TypeVar
import msgspec import msgspec
from kanta.serialization.framing import BinFramer from kanta.serialization.framing import BinFramer, Framer
T = TypeVar("T") T = TypeVar("T")
@@ -14,7 +14,7 @@ T = TypeVar("T")
class MsgPackSerializer: class MsgPackSerializer:
"""Binary serializer using MessagePack format.""" """Binary serializer using MessagePack format."""
framer_cls = BinFramer framer_cls: type[Framer] = BinFramer
def encode(self, obj: Any) -> bytes: def encode(self, obj: Any) -> bytes:
return msgspec.msgpack.encode(obj) return msgspec.msgpack.encode(obj)