Skip to content

Commit 6c1f811

Browse files
authored
[RSDK-5823] remove Board.model_attributes() from the SDK (#491)
This was removed from the RDK in viamrobotics/rdk#3253. From the perspective of the Python SDK, no information is being communicated with this function: it always says that the board is remote and nothing else. Strictly speaking, this is a breaking change because we don't know who out in the world is using this function. but my understanding is that the entire SDK is still in beta so breaking changes are okay. and anyone using it isn't getting any utility out of it, as previously stated.
1 parent 0cfdc4e commit 6c1f811

File tree

5 files changed

+1
-33
lines changed

5 files changed

+1
-33
lines changed

examples/server/v1/components.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,6 @@ async def status(self, extra: Optional[Dict[str, Any]] = None, **kwargs) -> Boar
332332
digital_interrupts={name: DigitalInterruptStatus(value=await di.value()) for (name, di) in self.digital_interrupts.items()},
333333
)
334334

335-
async def model_attributes(self) -> Board.Attributes:
336-
return Board.Attributes(remote=True)
337-
338335
async def set_power_mode(self, **kwargs):
339336
raise NotImplementedError()
340337

src/viam/components/board/board.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,6 @@ async def status(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optio
242242
"""
243243
...
244244

245-
@abc.abstractmethod
246-
async def model_attributes(self) -> Attributes:
247-
"""
248-
Get the attributes related to the model of this board.
249-
250-
Returns:
251-
Attributes: The attributes.
252-
"""
253-
...
254-
255245
@abc.abstractmethod
256246
async def set_power_mode(
257247
self, mode: PowerMode.ValueType, duration: Optional[timedelta] = None, *, timeout: Optional[float] = None, **kwargs

src/viam/components/board/client.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,6 @@ async def status(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optio
156156
response: StatusResponse = await self.client.Status(request, timeout=timeout)
157157
return response.status
158158

159-
async def model_attributes(self) -> Board.Attributes:
160-
return Board.Attributes(remote=True)
161-
162159
async def do_command(self, command: Mapping[str, ValueTypes], *, timeout: Optional[float] = None) -> Mapping[str, ValueTypes]:
163160
request = DoCommandRequest(name=self.name, command=dict_to_struct(command))
164161
response: DoCommandResponse = await self.client.DoCommand(request, timeout=timeout)

tests/mocks/components.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,6 @@ async def status(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optio
370370
digital_interrupts={name: DigitalInterruptStatus(value=await di.value()) for (name, di) in self.digital_interrupts.items()},
371371
)
372372

373-
async def model_attributes(self) -> Board.Attributes:
374-
return Board.Attributes(remote=True)
375-
376373
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None) -> List[Geometry]:
377374
self.extra = extra
378375
self.timeout = timeout

tests/test_board.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from grpclib import GRPCError
77
from grpclib.testing import ChannelFor
88

9-
from viam.components.board import Board, BoardClient
9+
from viam.components.board import BoardClient
1010
from viam.components.board.service import BoardRPCService
1111
from viam.components.generic.service import GenericRPCService
1212
from viam.errors import ResourceNotFoundError
@@ -121,11 +121,6 @@ async def test_status(self, board: MockBoard):
121121
assert board.extra == extra
122122
assert board.timeout == loose_approx(1.82)
123123

124-
@pytest.mark.asyncio
125-
async def test_model_attributes(self, board: MockBoard):
126-
attrs = await board.model_attributes()
127-
assert attrs == Board.Attributes(remote=True)
128-
129124
@pytest.mark.asyncio
130125
async def test_do(self, board: MockBoard):
131126
command = {"command": "args"}
@@ -415,14 +410,6 @@ async def test_status(self, board: MockBoard, service: BoardRPCService):
415410
assert board.extra == extra
416411
assert board.timeout == loose_approx(1.1)
417412

418-
@pytest.mark.asyncio
419-
async def test_model_attributes(self, board: MockBoard, service: BoardRPCService):
420-
async with ChannelFor([service]) as channel:
421-
client = BoardClient(name=board.name, channel=channel)
422-
423-
attrs = await client.model_attributes()
424-
assert attrs == Board.Attributes(remote=True)
425-
426413
@pytest.mark.asyncio
427414
async def test_do(self, board: MockBoard, service: BoardRPCService):
428415
async with ChannelFor([service]) as channel:

0 commit comments

Comments
 (0)