Skip to content

Commit 6fe8dbe

Browse files
committed
Make it a dataclass
1 parent deab876 commit 6fe8dbe

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

temporalio/worker/_workflow.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import sys
1010
import threading
11+
from dataclasses import dataclass
1112
from datetime import timezone
1213
from types import TracebackType
1314
from typing import (
@@ -720,20 +721,16 @@ def attempt_deadlock_interruption(self) -> None:
720721
)
721722

722723

724+
@dataclass(frozen=True)
723725
class _CommandAwarePayloadCodec(temporalio.converter.PayloadCodec):
724726
"""A payload codec that sets serialization context for the associated command.
725727
726728
This codec responds to the :py:data:`temporalio.bridge._visitor.current_command_seq` context
727729
variable set by the payload visitor.
728730
"""
729731

730-
def __init__(
731-
self,
732-
instance: WorkflowInstance,
733-
context_free_payload_codec: temporalio.converter.PayloadCodec,
734-
):
735-
self.instance = instance
736-
self.context_free_payload_codec = context_free_payload_codec
732+
instance: WorkflowInstance
733+
context_free_payload_codec: temporalio.converter.PayloadCodec
737734

738735
async def encode(
739736
self,

0 commit comments

Comments
 (0)