@@ -1590,12 +1590,10 @@ def _outbound_schedule_activity(
15901590 "Activity must have start_to_close_timeout or schedule_to_close_timeout"
15911591 )
15921592
1593- handle : Optional [ _ActivityHandle ] = None
1593+ handle : _ActivityHandle
15941594
15951595 # Function that runs in the handle
15961596 async def run_activity () -> Any :
1597- nonlocal handle
1598- assert handle
15991597 while True :
16001598 # Mark it as started each loop because backoff could cause it to
16011599 # be marked as unstarted
@@ -1662,12 +1660,10 @@ async def _outbound_signal_external_workflow(
16621660 async def _outbound_start_child_workflow (
16631661 self , input : StartChildWorkflowInput
16641662 ) -> _ChildWorkflowHandle :
1665- handle : Optional [ _ChildWorkflowHandle ] = None
1663+ handle : _ChildWorkflowHandle
16661664
16671665 # Common code for handling cancel for start and run
16681666 def apply_child_cancel_error () -> None :
1669- nonlocal handle
1670- assert handle
16711667 # Send a cancel request to the child
16721668 cancel_command = self ._add_command ()
16731669 handle ._apply_cancel_command (cancel_command )
@@ -1685,9 +1681,7 @@ def apply_child_cancel_error() -> None:
16851681
16861682 # Function that runs in the handle
16871683 async def run_child () -> Any :
1688- nonlocal handle
16891684 while True :
1690- assert handle
16911685 try :
16921686 # We have to shield because we don't want the future itself
16931687 # to be cancelled
@@ -2438,17 +2432,17 @@ async def signal_external_workflow(
24382432
24392433 def start_activity (
24402434 self , input : StartActivityInput
2441- ) -> temporalio .workflow .ActivityHandle :
2435+ ) -> temporalio .workflow .ActivityHandle [ Any ] :
24422436 return self ._instance ._outbound_schedule_activity (input )
24432437
24442438 async def start_child_workflow (
24452439 self , input : StartChildWorkflowInput
2446- ) -> temporalio .workflow .ChildWorkflowHandle :
2440+ ) -> temporalio .workflow .ChildWorkflowHandle [ Any , Any ] :
24472441 return await self ._instance ._outbound_start_child_workflow (input )
24482442
24492443 def start_local_activity (
24502444 self , input : StartLocalActivityInput
2451- ) -> temporalio .workflow .ActivityHandle :
2445+ ) -> temporalio .workflow .ActivityHandle [ Any ] :
24522446 return self ._instance ._outbound_schedule_activity (input )
24532447
24542448
0 commit comments