Skip to content

Commit 5dd251f

Browse files
github-actions[bot]njooma
authored andcommitted
Automated Protos Update (#505)
1 parent 574f32e commit 5dd251f

34 files changed

+436
-465
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ lint:
88
poetry run $(MAKE) _lint
99

1010
_format:
11-
black --exclude ".*/gen/.*" ./src
12-
isort ./src
11+
black --exclude ".*/gen/.*" ./src ./tests ./docs/examples
12+
isort ./src ./tests ./docs/examples
1313

1414
format:
1515
poetry run $(MAKE) _format

docs/examples/_server.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
CreateOrganizationInviteResponse,
3232
CreateOrganizationRequest,
3333
CreateOrganizationResponse,
34+
CreateRegistryItemRequest,
35+
CreateRegistryItemResponse,
3436
CreateRobotPartSecretRequest,
3537
CreateRobotPartSecretResponse,
3638
DeleteFragmentRequest,
@@ -47,6 +49,8 @@
4749
DeleteOrganizationMemberResponse,
4850
DeleteOrganizationRequest,
4951
DeleteOrganizationResponse,
52+
DeleteRegistryItemRequest,
53+
DeleteRegistryItemResponse,
5054
DeleteRobotPartRequest,
5155
DeleteRobotPartResponse,
5256
DeleteRobotPartSecretRequest,
@@ -63,6 +67,8 @@
6367
GetOrganizationNamespaceAvailabilityResponse,
6468
GetOrganizationRequest,
6569
GetOrganizationResponse,
70+
GetOrganizationsWithAccessToLocationRequest,
71+
GetOrganizationsWithAccessToLocationResponse,
6672
GetRobotAPIKeysRequest,
6773
GetRobotAPIKeysResponse,
6874
GetRobotPartHistoryRequest,
@@ -95,19 +101,13 @@
95101
ListOrganizationsByUserResponse,
96102
ListOrganizationsRequest,
97103
ListOrganizationsResponse,
104+
ListRegistryItemsRequest,
105+
ListRegistryItemsResponse,
98106
ListRobotsRequest,
99107
ListRobotsResponse,
100108
Location,
101109
LocationAuthRequest,
102110
LocationAuthResponse,
103-
CreateRegistryItemRequest,
104-
CreateRegistryItemResponse,
105-
GetOrganizationsWithAccessToLocationRequest,
106-
GetOrganizationsWithAccessToLocationResponse,
107-
ListRegistryItemsRequest,
108-
ListRegistryItemsResponse,
109-
UpdateRegistryItemRequest,
110-
UpdateRegistryItemResponse,
111111
)
112112
from viam.proto.app import LogEntry as LogEntryPB
113113
from viam.proto.app import (
@@ -143,6 +143,8 @@
143143
UpdateOrganizationInviteAuthorizationsResponse,
144144
UpdateOrganizationRequest,
145145
UpdateOrganizationResponse,
146+
UpdateRegistryItemRequest,
147+
UpdateRegistryItemResponse,
146148
UpdateRobotPartRequest,
147149
UpdateRobotPartResponse,
148150
UpdateRobotRequest,
@@ -188,12 +190,12 @@
188190
TabularData,
189191
TabularDataByFilterRequest,
190192
TabularDataByFilterResponse,
191-
TagsByFilterRequest,
192-
TagsByFilterResponse,
193193
TabularDataByMQLRequest,
194194
TabularDataByMQLResponse,
195195
TabularDataBySQLRequest,
196196
TabularDataBySQLResponse,
197+
TagsByFilterRequest,
198+
TagsByFilterResponse,
197199
)
198200
from viam.proto.app.datasync import (
199201
DataCaptureUploadRequest,
@@ -586,6 +588,9 @@ async def ListRegistryItems(self, stream: Stream[ListRegistryItemsRequest, ListR
586588
async def UpdateRegistryItem(self, stream: Stream[UpdateRegistryItemRequest, UpdateRegistryItemResponse]) -> None:
587589
raise NotImplementedError()
588590

591+
async def DeleteRegistryItem(self, stream: Stream[DeleteRegistryItemRequest, DeleteRegistryItemResponse]) -> None:
592+
raise NotImplementedError()
593+
589594

590595
async def main(*, host: str = "127.0.0.1", port: int = 9092) -> None:
591596
server = Server([MockData(), MockDataSync(), MockApp()])

docs/examples/example.ipynb

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"# Please excuse the boilerplate\n",
3131
"%autoawait asyncio\n",
3232
"import warnings\n",
33-
"warnings.filterwarnings('ignore')"
33+
"\n",
34+
"warnings.filterwarnings(\"ignore\")"
3435
]
3536
},
3637
{
@@ -47,12 +48,10 @@
4748
"from viam.robot.client import RobotClient\n",
4849
"from viam.rpc.dial import DialOptions\n",
4950
"\n",
51+
"\n",
5052
"async def connect() -> RobotClient:\n",
51-
" options = RobotClient.Options(\n",
52-
" dial_options=DialOptions(insecure=True, disable_webrtc=True),\n",
53-
" log_level=logging.FATAL\n",
54-
" )\n",
55-
" return await RobotClient.at_address('localhost:9091', options)"
53+
" options = RobotClient.Options(dial_options=DialOptions(insecure=True, disable_webrtc=True), log_level=logging.FATAL)\n",
54+
" return await RobotClient.at_address(\"localhost:9091\", options)"
5655
]
5756
},
5857
{
@@ -132,10 +131,12 @@
132131
"from viam.robot.client import RobotClient\n",
133132
"from viam.rpc.dial import DialOptions, dial\n",
134133
"\n",
134+
"\n",
135135
"async def connect_with_channel() -> RobotClient:\n",
136-
" async with await dial('localhost:9091', DialOptions(insecure=True, disable_webrtc=True)) as channel:\n",
136+
" async with await dial(\"localhost:9091\", DialOptions(insecure=True, disable_webrtc=True)) as channel:\n",
137137
" return await RobotClient.with_channel(channel, RobotClient.Options(refresh_interval=10, log_level=logging.FATAL))\n",
138138
"\n",
139+
"\n",
139140
"robot = await connect_with_channel()\n",
140141
"print(robot.resource_names)\n",
141142
"await robot.close()"
@@ -167,7 +168,7 @@
167168
"image.save(\"foo.png\")\n",
168169
"\n",
169170
"# Don't forget to close the robot when you're done!\n",
170-
"await robot.close()\n"
171+
"await robot.close()"
171172
]
172173
},
173174
{
@@ -210,6 +211,7 @@
210211
"source": [
211212
"from viam.services.vision import VisionClient\n",
212213
"\n",
214+
"\n",
213215
"async def vision():\n",
214216
" robot = await connect_with_channel()\n",
215217
" vision = VisionClient.from_robot(robot)\n",
@@ -884,13 +886,14 @@
884886
"from pygments.lexers import PythonLexer\n",
885887
"from pygments.formatters import HtmlFormatter\n",
886888
"import IPython\n",
887-
"with open('my_cool_arm.py') as f:\n",
889+
"\n",
890+
"with open(\"my_cool_arm.py\") as f:\n",
888891
" code = f.read()\n",
889892
"\n",
890893
"formatter = HtmlFormatter()\n",
891-
"IPython.display.HTML('<style type=\"text/css\">{}</style>{}'.format(\n",
892-
" formatter.get_style_defs('.highlight'),\n",
893-
" highlight(code, PythonLexer(), formatter)))"
894+
"IPython.display.HTML(\n",
895+
" '<style type=\"text/css\">{}</style>{}'.format(formatter.get_style_defs(\".highlight\"), highlight(code, PythonLexer(), formatter))\n",
896+
")"
894897
]
895898
},
896899
{
@@ -938,11 +941,13 @@
938941
"\n",
939942
"from my_cool_arm import MyCoolArm\n",
940943
"\n",
944+
"\n",
941945
"async def main():\n",
942-
" srv = Server([MyCoolArm('my-arm')])\n",
946+
" srv = Server([MyCoolArm(\"my-arm\")])\n",
943947
" await srv.serve()\n",
944948
"\n",
945-
"if __name__ == '__main__':\n",
949+
"\n",
950+
"if __name__ == \"__main__\":\n",
946951
" try:\n",
947952
" asyncio.run(main())\n",
948953
" except:\n",
@@ -1124,7 +1129,7 @@
11241129
"source": [
11251130
"from IPython.core.display import display, Image\n",
11261131
"\n",
1127-
"display(Image(filename='./codediff.png'))"
1132+
"display(Image(filename=\"./codediff.png\"))"
11281133
]
11291134
},
11301135
{
@@ -1160,8 +1165,9 @@
11601165
"from viam.rpc.dial import DialOptions, Credentials\n",
11611166
"from viam.app.viam_client import ViamClient\n",
11621167
"\n",
1168+
"\n",
11631169
"async def connect() -> ViamClient:\n",
1164-
" dial_options = DialOptions.with_api_key(api_key='<API_KEY>', api_key_id='<API_KEY_ID>')\n",
1170+
" dial_options = DialOptions.with_api_key(api_key=\"<API_KEY>\", api_key_id=\"<API_KEY_ID>\")\n",
11651171
" return await ViamClient.create_from_dial_options(dial_options)"
11661172
]
11671173
},
@@ -1191,6 +1197,7 @@
11911197
"from viam.app.app_client import AppClient\n",
11921198
"from viam.rpc.dial import _dial_direct\n",
11931199
"\n",
1200+
"\n",
11941201
"class MockViamClient:\n",
11951202
" @classmethod\n",
11961203
" async def create_viam_client(cls) -> Self:\n",
@@ -1199,15 +1206,16 @@
11991206
" self.data_client = DataClient(channel=self._channel, metadata={})\n",
12001207
" self.app_client = AppClient(channel=self._channel, metadata={})\n",
12011208
" return self\n",
1202-
" \n",
1209+
"\n",
12031210
" _channel: Channel\n",
12041211
" data_client: DataClient\n",
12051212
" app_client: AppClient\n",
12061213
"\n",
12071214
" def close(self):\n",
12081215
" self._channel.close()\n",
12091216
"\n",
1210-
"viam_client = await MockViamClient.create_viam_client()\n"
1217+
"\n",
1218+
"viam_client = await MockViamClient.create_viam_client()"
12111219
]
12121220
},
12131221
{
@@ -1260,10 +1268,7 @@
12601268
"from datetime import datetime\n",
12611269
"\n",
12621270
"left_motor_filter = data_client.create_filter(\n",
1263-
" component_name=\"left_motor\",\n",
1264-
" start_time=datetime(2023, 6, 5, 11),\n",
1265-
" end_time=datetime(2023, 6, 5, 13, 30),\n",
1266-
" tags=[\"speed_test_run\"]\n",
1271+
" component_name=\"left_motor\", start_time=datetime(2023, 6, 5, 11), end_time=datetime(2023, 6, 5, 13, 30), tags=[\"speed_test_run\"]\n",
12671272
")\n",
12681273
"\n",
12691274
"data = await data_client.tabular_data_by_filter(filter=left_motor_filter)\n",
@@ -1290,14 +1295,14 @@
12901295
"time_received_1 = datetime(2023, 6, 5, 11, 0, 3)\n",
12911296
"\n",
12921297
"await data_client.tabular_data_capture_upload(\n",
1293-
" part_id=\"<ID>\", # Unique ID of the relevant robot part.\n",
1294-
" component_type='rdk:component:motor',\n",
1295-
" component_name='left_motor',\n",
1296-
" method_name='IsPowered',\n",
1298+
" part_id=\"<ID>\", # Unique ID of the relevant robot part.\n",
1299+
" component_type=\"rdk:component:motor\",\n",
1300+
" component_name=\"left_motor\",\n",
1301+
" method_name=\"IsPowered\",\n",
12971302
" method_parameters=None,\n",
12981303
" tags=[\"tag_1\", \"tag_2\"],\n",
12991304
" data_request_times=[(time_requested_1, time_received_1)],\n",
1300-
" tabular_data=[{'PowerPCT': 0, 'IsPowered': False}]\n",
1305+
" tabular_data=[{\"PowerPCT\": 0, \"IsPowered\": False}],\n",
13011306
")"
13021307
]
13031308
},
@@ -1353,7 +1358,7 @@
13531358
"for location in my_locations:\n",
13541359
" more_robots = await app_client.list_robots(location_id=location.id)\n",
13551360
" robots += more_robots\n",
1356-
" \n",
1361+
"\n",
13571362
"for robot in robots:\n",
13581363
" print(robot.name)"
13591364
]
@@ -1439,7 +1444,7 @@
14391444
"assert logs[0].caller is not None\n",
14401445
"for item in logs[0].caller.items():\n",
14411446
" print(f\"{item[0]}: {item[1]}\")\n",
1442-
" \n",
1447+
"\n",
14431448
"print(f\"\\n*****PROTO*****\\n\")\n",
14441449
"print(logs[0].proto.caller)"
14451450
]

docs/examples/module_step2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# wifi-sensor/src/wifi_sensor_module.py
22
import asyncio
33
from typing import Any, ClassVar, Dict, Mapping, Optional
4+
45
from typing_extensions import Self
56

67
from viam.components.sensor import Sensor

docs/examples/module_step2_optional.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# wifi-sensor/src/wifi_sensor_module.py
22
import asyncio
33
from typing import Any, ClassVar, Dict, Mapping, Optional, Sequence
4+
45
from typing_extensions import Self
56

67
from viam.components.sensor import Sensor

docs/examples/module_step3.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# wifi-sensor/src/wifi_sensor_module.py
22
import asyncio
33
from typing import Any, ClassVar, Dict, Mapping, Optional
4+
45
from typing_extensions import Self
56

67
from viam.components.sensor import Sensor

0 commit comments

Comments
 (0)