Skip to content

Commit 586960e

Browse files
committed
Revert immplementing WithSerializationContext on CompositePayloadConverter
1 parent cbfd2f3 commit 586960e

File tree

1 file changed

+1
-30
lines changed

1 file changed

+1
-30
lines changed

temporalio/converter.py

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ def from_payload(
301301
raise NotImplementedError
302302

303303

304-
class CompositePayloadConverter(PayloadConverter, WithSerializationContext):
304+
class CompositePayloadConverter(PayloadConverter):
305305
"""Composite payload converter that delegates to a list of encoding payload converters.
306306
307307
Encoding/decoding are attempted on each payload converter successively until
@@ -321,9 +321,6 @@ def __init__(self, *converters: EncodingPayloadConverter) -> None:
321321
"""
322322
# Insertion order preserved here since Python 3.7
323323
self.converters = {c.encoding.encode(): c for c in converters}
324-
self._any_converters_with_context = any(
325-
isinstance(c, WithSerializationContext) for c in converters
326-
)
327324

328325
def to_payloads(
329326
self, values: Sequence[Any]
@@ -387,32 +384,6 @@ def from_payloads(
387384
) from err
388385
return values
389386

390-
def with_context(self, context: Optional[SerializationContext]) -> Self:
391-
"""Return a copy of this converter with context-aware child converters.
392-
393-
Returns a new instance with the same set of converters, using with_context() on the child
394-
converters for those that support it.
395-
396-
Args:
397-
context: The serialization context to use, or None for no context.
398-
399-
Returns:
400-
A new CompositePayloadConverter with context-aware converters, or self if no converters
401-
support context.
402-
"""
403-
print(
404-
f"🌈 CompositePayloadConverter.with_context({context}) {self._any_converters_with_context}"
405-
)
406-
if not self._any_converters_with_context:
407-
return self
408-
new_converters = []
409-
for converter in self.converters.values():
410-
if isinstance(converter, WithSerializationContext):
411-
new_converters.append(converter.with_context(context))
412-
else:
413-
new_converters.append(converter)
414-
return type(self)(*new_converters)
415-
416387

417388
class DefaultPayloadConverter(CompositePayloadConverter):
418389
"""Default payload converter compatible with other Temporal SDKs.

0 commit comments

Comments
 (0)