Skip to content

Commit 7c81ddf

Browse files
Mike ProsserMike Prosser
authored andcommitted
joe's feedback
1 parent 99eb153 commit 7c81ddf

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

src/nipanel/_panel_client.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ def start_panel(self, panel_id: str, panel_script_path: str, python_path: str) -
6969
7070
Returns:
7171
The URL of the panel.
72+
73+
Raises:
74+
grpc.RpcError: With status code:
75+
- INVALID_ARGUMENT: If the panel script filename doesn't end in .py, or
76+
if the panel identifier contains invalid characters (only alphanumeric
77+
characters and underscores are allowed).
78+
- NOT_FOUND: If the panel script file or Python executable file was not found.
7279
"""
7380
start_panel_request = StartPanelRequest(
7481
panel_id=panel_id, panel_script_path=panel_script_path, python_path=python_path
@@ -82,6 +89,11 @@ def stop_panel(self, panel_id: str, reset: bool) -> None:
8289
Args:
8390
panel_id: The ID of the panel to stop.
8491
reset: Whether to reset all storage associated with panel.
92+
93+
Raises:
94+
grpc.RpcError: With status code:
95+
- INVALID_ARGUMENT: If the panel identifier contains invalid characters
96+
(only alphanumeric characters and underscores are allowed).
8597
"""
8698
stop_panel_request = StopPanelRequest(panel_id=panel_id, reset=reset)
8799
self._invoke_with_retry(self._get_stub().StopPanel, stop_panel_request)
@@ -109,6 +121,11 @@ def set_value(self, panel_id: str, value_id: str, value: object, notify: bool) -
109121
value_id: The ID of the control.
110122
value: The value to set.
111123
notify: Whether to notify other clients of the new value.
124+
125+
Raises:
126+
grpc.RpcError: With status code:
127+
- INVALID_ARGUMENT: If the panel identifier or value identifier contains
128+
invalid characters (only alphanumeric characters and underscores are allowed).
112129
"""
113130
new_any = to_any(value)
114131
set_value_request = SetValueRequest(
@@ -125,12 +142,18 @@ def get_value(self, panel_id: str, value_id: str) -> object:
125142
126143
Returns:
127144
The value.
145+
146+
Raises:
147+
grpc.RpcError: With status code:
148+
- INVALID_ARGUMENT: If the panel identifier or value identifier contains
149+
invalid characters (only alphanumeric characters and underscores are allowed).
150+
- NOT_FOUND: If the value with the specified identifier was not found.
128151
"""
129-
try_get_value_request = GetValueRequest(panel_id=panel_id, value_id=value_id)
130-
response = self._invoke_with_retry(self._get_stub().GetValue, try_get_value_request)
152+
get_value_request = GetValueRequest(panel_id=panel_id, value_id=value_id)
153+
response = self._invoke_with_retry(self._get_stub().GetValue, get_value_request)
131154
return from_any(response.value)
132155

133-
def try_get_value(self, panel_id: str, value_id: str) -> object:
156+
def try_get_value(self, panel_id: str, value_id: str) -> object | None:
134157
"""Try to get the value for the control with value_id.
135158
136159
Args:
@@ -139,6 +162,11 @@ def try_get_value(self, panel_id: str, value_id: str) -> object:
139162
140163
Returns:
141164
The value if found, otherwise None.
165+
166+
Raises:
167+
grpc.RpcError: With status code:
168+
- INVALID_ARGUMENT: If the panel identifier or value identifier contains
169+
invalid characters (only alphanumeric characters and underscores are allowed).
142170
"""
143171
try_get_value_request = GetValueRequest(panel_id=panel_id, value_id=value_id)
144172
response = self._invoke_with_retry(self._get_stub().TryGetValue, try_get_value_request)

0 commit comments

Comments
 (0)