44
55import traceback
66from datetime import datetime
7- from typing import Any , Callable , Dict , Optional
7+ from typing import Any , Callable
88
99from pydantic import BaseModel
1010from uipath .core .tracing import UiPathTraceManager
@@ -40,14 +40,14 @@ def __init__(
4040 self ,
4141 runtime_factory : UiPathRuntimeFactoryProtocol ,
4242 trace_manager : UiPathTraceManager ,
43- on_run_updated : Optional [ RunUpdatedCallback ] = None ,
44- on_log : Optional [ LogCallback ] = None ,
45- on_trace : Optional [ TraceCallback ] = None ,
43+ on_run_updated : RunUpdatedCallback | None = None ,
44+ on_log : LogCallback | None = None ,
45+ on_trace : TraceCallback | None = None ,
4646 ) -> None :
4747 """Initialize RunService with runtime factory and trace manager."""
4848 self .runtime_factory = runtime_factory
4949 self .trace_manager = trace_manager
50- self .runs : Dict [str , ExecutionRun ] = {}
50+ self .runs : dict [str , ExecutionRun ] = {}
5151
5252 self .on_run_updated = on_run_updated
5353 self .on_log = on_log
@@ -68,7 +68,7 @@ def register_run(self, run: ExecutionRun) -> None:
6868 self .runs [run .id ] = run
6969 self ._emit_run_updated (run )
7070
71- def get_run (self , run_id : str ) -> Optional [ ExecutionRun ] :
71+ def get_run (self , run_id : str ) -> ExecutionRun | None :
7272 """Get a registered run."""
7373 return self .runs .get (run_id )
7474
@@ -78,7 +78,7 @@ async def execute(self, run: ExecutionRun) -> None:
7878 This is the extracted version of the old `_execute_runtime` method.
7979 """
8080 try :
81- execution_input : Optional [ dict [str , Any ]] = {}
81+ execution_input : dict [str , Any ] | None = {}
8282 execution_options : UiPathExecuteOptions = UiPathExecuteOptions ()
8383
8484 if run .status == "suspended" :
@@ -239,7 +239,7 @@ def handle_trace(self, trace_msg: TraceMessage) -> None:
239239 if self .on_trace is not None :
240240 self .on_trace (trace_msg )
241241
242- def get_debug_bridge (self , run_id : str ) -> Optional [ TextualDebugBridge ] :
242+ def get_debug_bridge (self , run_id : str ) -> TextualDebugBridge | None :
243243 """Get the debug bridge for a run."""
244244 return self .debug_bridges .get (run_id )
245245
0 commit comments