Skip to content

Commit 7982dfe

Browse files
cristipufuclaude
andcommitted
fix: add docstrings and remove unused import for ruff compliance
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aebcb62 commit 7982dfe

3 files changed

Lines changed: 27 additions & 4 deletions

File tree

src/uipath/dev/server/debug_bridge.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class WebDebugBridge:
2222
"""
2323

2424
def __init__(self, mode: ExecutionMode = ExecutionMode.RUN):
25+
"""Initialize the web debug bridge."""
2526
self._mode = mode
2627
self._auto_resume = mode == ExecutionMode.RUN
2728
self._resume_event = asyncio.Event()
@@ -43,33 +44,39 @@ def __init__(self, mode: ExecutionMode = ExecutionMode.RUN):
4344
# ------------------------------------------------------------------
4445

4546
async def connect(self) -> None:
47+
"""Establish connection to debugger."""
4648
logger.debug("WebDebugBridge connected (mode=%s)", self._mode)
4749

4850
async def disconnect(self) -> None:
51+
"""Close connection to debugger."""
4952
self._resume_event.set()
5053
self._terminate_event.set()
5154
logger.debug("WebDebugBridge disconnected")
5255

5356
async def emit_execution_started(self, **kwargs: Any) -> None:
57+
"""Notify debugger that execution started."""
5458
logger.debug("Execution started")
5559
if self.on_execution_started:
5660
self.on_execution_started()
5761

5862
async def emit_state_update(self, state_event: UiPathRuntimeStateEvent) -> None:
63+
"""Notify debugger of runtime state update."""
5964
logger.debug("State update: %s", state_event.node_name)
6065
if self.on_state_update:
6166
self.on_state_update(state_event)
6267

6368
async def emit_breakpoint_hit(
6469
self, breakpoint_result: UiPathBreakpointResult
6570
) -> None:
71+
"""Notify debugger that a breakpoint was hit."""
6672
logger.debug("Breakpoint hit: %s", breakpoint_result)
6773
if self.on_breakpoint_hit:
6874
self.on_breakpoint_hit(breakpoint_result)
6975

7076
async def emit_execution_suspended(
7177
self, runtime_result: UiPathRuntimeResult
7278
) -> None:
79+
"""Notify debugger that execution is suspended."""
7380
logger.debug("Execution suspended")
7481
if runtime_result.trigger is None:
7582
return
@@ -86,21 +93,25 @@ async def emit_execution_suspended(
8693
)
8794

8895
async def emit_execution_resumed(self, resume_data: Any) -> None:
96+
"""Notify debugger that execution resumed."""
8997
logger.debug("Execution resumed")
9098

9199
async def emit_execution_completed(
92100
self, runtime_result: UiPathRuntimeResult
93101
) -> None:
102+
"""Notify debugger that execution completed."""
94103
logger.debug("Execution completed")
95104
if self.on_execution_completed:
96105
self.on_execution_completed(runtime_result)
97106

98107
async def emit_execution_error(self, error: str) -> None:
108+
"""Notify debugger that an error occurred."""
99109
logger.error("Execution error: %s", error)
100110
if self.on_execution_error:
101111
self.on_execution_error(error)
102112

103113
async def wait_for_resume(self) -> Any:
114+
"""Wait for resume command from debugger."""
104115
if self._auto_resume:
105116
self._auto_resume = False # Only auto-resume the first (initial) pause
106117
return {}
@@ -114,22 +125,27 @@ async def wait_for_resume(self) -> Any:
114125
return self._resume_data
115126

116127
async def wait_for_terminate(self) -> None:
128+
"""Wait for terminate command from debugger."""
117129
await self._terminate_event.wait()
118130

119131
def get_breakpoints(self) -> list[str] | Literal["*"]:
132+
"""Get nodes to suspend execution at."""
120133
return self._breakpoints
121134

122135
# ------------------------------------------------------------------
123136
# Control methods (called from RunService / WS handler)
124137
# ------------------------------------------------------------------
125138

126139
def resume(self, resume_data: Any) -> None:
140+
"""Signal that execution should resume."""
127141
self._resume_data = resume_data or {}
128142
self._resume_event.set()
129143

130144
def quit(self) -> None:
145+
"""Signal that execution should quit."""
131146
self._terminate_event.set()
132147
self._resume_event.set()
133148

134149
def set_breakpoints(self, breakpoints: list[str] | Literal["*"]) -> None:
150+
"""Set breakpoints."""
135151
self._breakpoints = breakpoints

src/uipath/dev/server/ws/handler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from uipath.dev.models.chat import get_user_message, get_user_message_event
1212
from uipath.dev.models.data import ChatData
13-
from uipath.dev.models.execution import ExecutionMode
1413
from uipath.dev.server.ws.protocol import ClientCommand, parse_client_message
1514

1615
router = APIRouter()

src/uipath/dev/services/run_service.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,17 @@ class DebugBridgeProtocol(UiPathDebugProtocol, Protocol):
4545
on_execution_completed: Callable[[UiPathRuntimeResult], None] | None
4646
on_execution_error: Callable[[str], None] | None
4747

48-
def resume(self, resume_data: Any) -> None: ...
49-
def quit(self) -> None: ...
50-
def set_breakpoints(self, breakpoints: list[str] | Literal["*"]) -> None: ...
48+
def resume(self, resume_data: Any) -> None:
49+
"""Signal that execution should resume."""
50+
...
51+
52+
def quit(self) -> None:
53+
"""Signal that execution should quit."""
54+
...
55+
56+
def set_breakpoints(self, breakpoints: list[str] | Literal["*"]) -> None:
57+
"""Set breakpoints."""
58+
...
5159

5260

5361
DebugBridgeFactory = Callable[[ExecutionMode], DebugBridgeProtocol]

0 commit comments

Comments
 (0)