Skip to content

Commit

Permalink
fix linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
Moishe committed Mar 25, 2024
1 parent c6a7fa6 commit 8fe6d49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/dailyai/serializers/protobuf_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@ class ProtobufFrameSerializer(FrameSerializer):
def __init__(self):
pass

def serialize(self, frame: TextFrame | AudioFrame | TranscriptionQueueFrame) -> bytes:
def serialize(self, frame: Frame) -> bytes:
proto_frame = frame_protos.Frame()
if type(frame) not in self.SERIALIZABLE_TYPES:
raise ValueError(
f"Frame type {type(frame)} is not serializable. You may need to add it to ProtobufFrameSerializer.SERIALIZABLE_FIELDS.")

# type: ignore (unnecessary warnings, we check type above)
proto_optional_name = self.SERIALIZABLE_TYPES[type(frame)]
for field in dataclasses.fields(frame):
for field in dataclasses.fields(frame): # type: ignore
setattr(getattr(proto_frame, proto_optional_name), field.name,
getattr(frame, field.name))

Expand Down

0 comments on commit 8fe6d49

Please sign in to comment.