55import typing
66import warnings
77from collections .abc import Awaitable , Callable
8- from dataclasses import dataclass
98from typing import (
109 Any ,
1110)
3130)
3231
3332
34- @dataclass (frozen = True )
35- class _ExpectedParamType :
36- runtime_type : type [Any ]
37- display_name : str | None = None
38-
39- @property
40- def name (self ) -> str :
41- return self .display_name or self .runtime_type .__name__
42-
43-
4433def get_workflow_run_start_method_input_and_output_type_annotations (
4534 start : Callable [
4635 [NexusServiceType , WorkflowRunOperationContext , InputT ],
@@ -57,7 +46,7 @@ def get_workflow_run_start_method_input_and_output_type_annotations(
5746 """
5847 return _get_wrapped_start_method_input_and_output_type_annotations (
5948 start ,
60- expected_param_types = (_ExpectedParamType ( WorkflowRunOperationContext ) ,),
49+ expected_param_types = (WorkflowRunOperationContext ,),
6150 expected_return_origin = WorkflowHandle ,
6251 )
6352
@@ -84,11 +73,8 @@ def get_temporal_operation_start_method_input_and_output_type_annotations(
8473 return _get_wrapped_start_method_input_and_output_type_annotations (
8574 start ,
8675 expected_param_types = (
87- _ExpectedParamType (
88- TemporalNexusStartOperationContext ,
89- "TemporalNexusStartOperationContext" ,
90- ),
91- _ExpectedParamType (TemporalNexusClient ),
76+ TemporalNexusStartOperationContext ,
77+ TemporalNexusClient ,
9278 ),
9379 expected_return_origin = TemporalOperationResult ,
9480 )
@@ -97,7 +83,7 @@ def get_temporal_operation_start_method_input_and_output_type_annotations(
9783def _get_wrapped_start_method_input_and_output_type_annotations (
9884 start : Callable [..., Any ],
9985 * ,
100- expected_param_types : tuple [_ExpectedParamType , ...],
86+ expected_param_types : tuple [type [ Any ] , ...],
10187 expected_return_origin : type [Any ],
10288) -> tuple [
10389 type [Any ] | None ,
@@ -135,7 +121,7 @@ def _get_wrapped_start_method_input_and_output_type_annotations(
135121def _get_start_method_input_and_output_type_annotations (
136122 start : Callable [..., Any ],
137123 * ,
138- expected_param_types : tuple [_ExpectedParamType , ...],
124+ expected_param_types : tuple [type [ Any ] , ...],
139125) -> tuple [
140126 type [Any ] | None ,
141127 type [Any ] | None ,
@@ -164,10 +150,10 @@ def _get_start_method_input_and_output_type_annotations(
164150 for index , (param_type , expected_param_type ) in enumerate (
165151 zip (param_types , expected_param_types ), start = 1
166152 ):
167- if not issubclass (expected_param_type . runtime_type , param_type ):
153+ if not issubclass (expected_param_type , param_type ):
168154 warnings .warn (
169155 f"Expected parameter { index } of { start } to be an instance of "
170- f"{ expected_param_type .name } , but is { param_type } ."
156+ f"{ expected_param_type .__name__ } , but is { param_type } ."
171157 )
172158 input_type = None
173159
0 commit comments