Skip to content

Commit a977092

Browse files
Mike ProsserMike Prosser
authored andcommitted
rename to TryGetValue
1 parent 97cdef0 commit a977092

File tree

10 files changed

+136
-89
lines changed

10 files changed

+136
-89
lines changed

protos/ni/pythonpanel/v1/python_panel_service.proto

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,36 @@ option ruby_package = "NI::PythonPanel::V1";
1818
service PythonPanelService {
1919
// Start a panel (or connect to if it has already been started)
2020
// Status Codes for errors:
21-
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
22-
// - NOT_FOUND: the file for the panel was not found
21+
// - INVALID_ARGUMENT:
22+
// - The panel script filename doesn't end in .py.
23+
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
24+
// - NOT_FOUND:
25+
// - The panel script file was not found.
26+
// - The python executable file was not found.
2327
rpc StartPanel(StartPanelRequest) returns (StartPanelResponse);
2428

2529
// Stop a panel
2630
// Status Codes for errors:
27-
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
31+
// - INVALID_ARGUMENT:
32+
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
2833
rpc StopPanel(StopPanelRequest) returns (StopPanelResponse);
2934

3035
// Enumerate the panels available in the system, including information about the state of the panels and what values they have.
3136
// Status Codes for errors:
3237
rpc EnumeratePanels(EnumeratePanelsRequest) returns (EnumeratePanelsResponse);
3338

34-
// Get a value for a control on the panel
39+
// Try to get a value for a control on the panel
3540
// Status Codes for errors:
36-
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
37-
rpc GetValue(GetValueRequest) returns (GetValueResponse);
41+
// - INVALID_ARGUMENT:
42+
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
43+
// - The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
44+
rpc TryGetValue(TryGetValueRequest) returns (TryGetValueResponse);
3845

3946
// Set a value for a control on the panel
4047
// Status Codes for errors:
41-
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
48+
// - INVALID_ARGUMENT:
49+
// - The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
50+
// - The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
4251
rpc SetValue(SetValueRequest) returns (SetValueResponse);
4352
}
4453

@@ -88,16 +97,16 @@ message EnumeratePanelsResponse {
8897
repeated PanelInformation panels = 1;
8998
}
9099

91-
message GetValueRequest {
100+
message TryGetValueRequest {
92101
// Unique ID of the panel
93102
string panel_id = 1;
94103

95104
// Unique ID of value
96105
string value_id = 2;
97106
}
98107

99-
message GetValueResponse {
100-
// The value
108+
message TryGetValueResponse {
109+
// The value, if it was found
101110
optional google.protobuf.Any value = 1;
102111
}
103112

src/ni/pythonpanel/v1/python_panel_service_pb2.py

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ni/pythonpanel/v1/python_panel_service_pb2.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class EnumeratePanelsResponse(google.protobuf.message.Message):
138138
global___EnumeratePanelsResponse = EnumeratePanelsResponse
139139

140140
@typing.final
141-
class GetValueRequest(google.protobuf.message.Message):
141+
class TryGetValueRequest(google.protobuf.message.Message):
142142
DESCRIPTOR: google.protobuf.descriptor.Descriptor
143143

144144
PANEL_ID_FIELD_NUMBER: builtins.int
@@ -155,16 +155,16 @@ class GetValueRequest(google.protobuf.message.Message):
155155
) -> None: ...
156156
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "value_id", b"value_id"]) -> None: ...
157157

158-
global___GetValueRequest = GetValueRequest
158+
global___TryGetValueRequest = TryGetValueRequest
159159

160160
@typing.final
161-
class GetValueResponse(google.protobuf.message.Message):
161+
class TryGetValueResponse(google.protobuf.message.Message):
162162
DESCRIPTOR: google.protobuf.descriptor.Descriptor
163163

164164
VALUE_FIELD_NUMBER: builtins.int
165165
@property
166166
def value(self) -> google.protobuf.any_pb2.Any:
167-
"""The value"""
167+
"""The value, if it was found"""
168168

169169
def __init__(
170170
self,
@@ -175,7 +175,7 @@ class GetValueResponse(google.protobuf.message.Message):
175175
def ClearField(self, field_name: typing.Literal["_value", b"_value", "value", b"value"]) -> None: ...
176176
def WhichOneof(self, oneof_group: typing.Literal["_value", b"_value"]) -> typing.Literal["value"] | None: ...
177177

178-
global___GetValueResponse = GetValueResponse
178+
global___TryGetValueResponse = TryGetValueResponse
179179

180180
@typing.final
181181
class SetValueRequest(google.protobuf.message.Message):

src/ni/pythonpanel/v1/python_panel_service_pb2_grpc.py

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def __init__(self, channel):
3030
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsRequest.SerializeToString,
3131
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsResponse.FromString,
3232
)
33-
self.GetValue = channel.unary_unary(
34-
'/ni.pythonpanel.v1.PythonPanelService/GetValue',
35-
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.SerializeToString,
36-
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueResponse.FromString,
33+
self.TryGetValue = channel.unary_unary(
34+
'/ni.pythonpanel.v1.PythonPanelService/TryGetValue',
35+
request_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueRequest.SerializeToString,
36+
response_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueResponse.FromString,
3737
)
3838
self.SetValue = channel.unary_unary(
3939
'/ni.pythonpanel.v1.PythonPanelService/SetValue',
@@ -49,8 +49,12 @@ class PythonPanelServiceServicer(object):
4949
def StartPanel(self, request, context):
5050
"""Start a panel (or connect to if it has already been started)
5151
Status Codes for errors:
52-
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
53-
- NOT_FOUND: the file for the panel was not found
52+
- INVALID_ARGUMENT:
53+
- The panel script filename doesn't end in .py.
54+
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
55+
- NOT_FOUND:
56+
- The panel script file was not found.
57+
- The python executable file was not found.
5458
"""
5559
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
5660
context.set_details('Method not implemented!')
@@ -59,7 +63,8 @@ def StartPanel(self, request, context):
5963
def StopPanel(self, request, context):
6064
"""Stop a panel
6165
Status Codes for errors:
62-
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
66+
- INVALID_ARGUMENT:
67+
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
6368
"""
6469
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
6570
context.set_details('Method not implemented!')
@@ -73,10 +78,12 @@ def EnumeratePanels(self, request, context):
7378
context.set_details('Method not implemented!')
7479
raise NotImplementedError('Method not implemented!')
7580

76-
def GetValue(self, request, context):
77-
"""Get a value for a control on the panel
81+
def TryGetValue(self, request, context):
82+
"""Try to get a value for a control on the panel
7883
Status Codes for errors:
79-
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
84+
- INVALID_ARGUMENT:
85+
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
86+
- The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
8087
"""
8188
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
8289
context.set_details('Method not implemented!')
@@ -85,7 +92,9 @@ def GetValue(self, request, context):
8592
def SetValue(self, request, context):
8693
"""Set a value for a control on the panel
8794
Status Codes for errors:
88-
- INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
95+
- INVALID_ARGUMENT:
96+
- The panel identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
97+
- The value identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
8998
"""
9099
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
91100
context.set_details('Method not implemented!')
@@ -109,10 +118,10 @@ def add_PythonPanelServiceServicer_to_server(servicer, server):
109118
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsRequest.FromString,
110119
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.EnumeratePanelsResponse.SerializeToString,
111120
),
112-
'GetValue': grpc.unary_unary_rpc_method_handler(
113-
servicer.GetValue,
114-
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.FromString,
115-
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueResponse.SerializeToString,
121+
'TryGetValue': grpc.unary_unary_rpc_method_handler(
122+
servicer.TryGetValue,
123+
request_deserializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueRequest.FromString,
124+
response_serializer=ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueResponse.SerializeToString,
116125
),
117126
'SetValue': grpc.unary_unary_rpc_method_handler(
118127
servicer.SetValue,
@@ -182,7 +191,7 @@ def EnumeratePanels(request,
182191
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
183192

184193
@staticmethod
185-
def GetValue(request,
194+
def TryGetValue(request,
186195
target,
187196
options=(),
188197
channel_credentials=None,
@@ -192,9 +201,9 @@ def GetValue(request,
192201
wait_for_ready=None,
193202
timeout=None,
194203
metadata=None):
195-
return grpc.experimental.unary_unary(request, target, '/ni.pythonpanel.v1.PythonPanelService/GetValue',
196-
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueRequest.SerializeToString,
197-
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.GetValueResponse.FromString,
204+
return grpc.experimental.unary_unary(request, target, '/ni.pythonpanel.v1.PythonPanelService/TryGetValue',
205+
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueRequest.SerializeToString,
206+
ni_dot_pythonpanel_dot_v1_dot_python__panel__service__pb2.TryGetValueResponse.FromString,
198207
options, channel_credentials,
199208
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
200209

0 commit comments

Comments
 (0)