@@ -1590,12 +1590,10 @@ def _outbound_schedule_activity(
1590
1590
"Activity must have start_to_close_timeout or schedule_to_close_timeout"
1591
1591
)
1592
1592
1593
- handle : Optional [ _ActivityHandle ] = None
1593
+ handle : _ActivityHandle
1594
1594
1595
1595
# Function that runs in the handle
1596
1596
async def run_activity () -> Any :
1597
- nonlocal handle
1598
- assert handle
1599
1597
while True :
1600
1598
# Mark it as started each loop because backoff could cause it to
1601
1599
# be marked as unstarted
@@ -1662,12 +1660,10 @@ async def _outbound_signal_external_workflow(
1662
1660
async def _outbound_start_child_workflow (
1663
1661
self , input : StartChildWorkflowInput
1664
1662
) -> _ChildWorkflowHandle :
1665
- handle : Optional [ _ChildWorkflowHandle ] = None
1663
+ handle : _ChildWorkflowHandle
1666
1664
1667
1665
# Common code for handling cancel for start and run
1668
1666
def apply_child_cancel_error () -> None :
1669
- nonlocal handle
1670
- assert handle
1671
1667
# Send a cancel request to the child
1672
1668
cancel_command = self ._add_command ()
1673
1669
handle ._apply_cancel_command (cancel_command )
@@ -1685,9 +1681,7 @@ def apply_child_cancel_error() -> None:
1685
1681
1686
1682
# Function that runs in the handle
1687
1683
async def run_child () -> Any :
1688
- nonlocal handle
1689
1684
while True :
1690
- assert handle
1691
1685
try :
1692
1686
# We have to shield because we don't want the future itself
1693
1687
# to be cancelled
@@ -2438,17 +2432,17 @@ async def signal_external_workflow(
2438
2432
2439
2433
def start_activity (
2440
2434
self , input : StartActivityInput
2441
- ) -> temporalio .workflow .ActivityHandle :
2435
+ ) -> temporalio .workflow .ActivityHandle [ Any ] :
2442
2436
return self ._instance ._outbound_schedule_activity (input )
2443
2437
2444
2438
async def start_child_workflow (
2445
2439
self , input : StartChildWorkflowInput
2446
- ) -> temporalio .workflow .ChildWorkflowHandle :
2440
+ ) -> temporalio .workflow .ChildWorkflowHandle [ Any , Any ] :
2447
2441
return await self ._instance ._outbound_start_child_workflow (input )
2448
2442
2449
2443
def start_local_activity (
2450
2444
self , input : StartLocalActivityInput
2451
- ) -> temporalio .workflow .ActivityHandle :
2445
+ ) -> temporalio .workflow .ActivityHandle [ Any ] :
2452
2446
return self ._instance ._outbound_schedule_activity (input )
2453
2447
2454
2448
0 commit comments