Skip to content

Commit 27e8730

Browse files
RSDK-9560: remove AnalogNames and DigitalInterruptNames from python sdk (#808)
1 parent 0008854 commit 27e8730

File tree

5 files changed

+0
-88
lines changed

5 files changed

+0
-88
lines changed

examples/server/v1/components.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,6 @@ async def gpio_pin_by_name(self, name: str) -> Board.GPIOPin:
306306
except KeyError:
307307
raise ResourceNotFoundError("Board.GPIOPin", name)
308308

309-
async def analog_names(self) -> List[str]:
310-
return [key for key in self.analogs.keys()]
311-
312-
async def digital_interrupt_names(self) -> List[str]:
313-
return [key for key in self.digital_interrupts.keys()]
314-
315309
async def set_power_mode(self, **kwargs):
316310
raise NotImplementedError()
317311

src/viam/components/board/board.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -364,44 +364,6 @@ async def gpio_pin_by_name(self, name: str) -> GPIOPin:
364364
"""
365365
...
366366

367-
@abc.abstractmethod
368-
async def analog_names(self) -> List[str]:
369-
"""
370-
Get the names of all known analog readers and/or writers.
371-
372-
::
373-
374-
my_board = Board.from_robot(robot=machine, name="my_board")
375-
376-
# Get the name of every Analog configured on the board.
377-
names = await my_board.analog_names()
378-
379-
Returns:
380-
List[str]: The list of names of all known analog readers/writers.
381-
382-
For more information, see `Board component <https://docs.viam.com/components/board/>`_.
383-
"""
384-
...
385-
386-
@abc.abstractmethod
387-
async def digital_interrupt_names(self) -> List[str]:
388-
"""
389-
Get the names of all known digital interrupts.
390-
391-
::
392-
393-
my_board = Board.from_robot(robot=machine, name="my_board")
394-
395-
# Get the name of every DigitalInterrupt configured on the board.
396-
names = await my_board.digital_interrupt_names()
397-
398-
Returns:
399-
List[str]: The names of the digital interrupts.
400-
401-
For more information, see `Board component <https://docs.viam.com/components/board/>`_.
402-
"""
403-
...
404-
405367
@abc.abstractmethod
406368
async def set_power_mode(
407369
self, mode: PowerMode.ValueType, duration: Optional[timedelta] = None, *, timeout: Optional[float] = None, **kwargs

src/viam/components/board/client.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,6 @@ async def digital_interrupt_by_name(self, name: str) -> Board.DigitalInterrupt:
184184
async def gpio_pin_by_name(self, name: str) -> Board.GPIOPin:
185185
return GPIOPinClient(name, self)
186186

187-
async def analog_names(self) -> List[str]:
188-
if self._analog_names is None:
189-
return []
190-
return self._analog_names
191-
192-
async def digital_interrupt_names(self) -> List[str]:
193-
if self._digital_interrupt_names is None:
194-
return []
195-
return self._digital_interrupt_names
196-
197187
async def do_command(
198188
self,
199189
command: Mapping[str, ValueTypes],

tests/mocks/components.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,6 @@ async def gpio_pin_by_name(self, name: str) -> Board.GPIOPin:
327327
except KeyError:
328328
raise ResourceNotFoundError("Board.GPIOPin", name)
329329

330-
async def analog_names(self) -> List[str]:
331-
return [key for key in self.analogs.keys()]
332-
333-
async def digital_interrupt_names(self) -> List[str]:
334-
return [key for key in self.digital_interrupts.keys()]
335-
336330
async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None) -> List[Geometry]:
337331
self.extra = extra
338332
self.timeout = timeout

tests/test_board.py

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ async def test_gpio_pin_by_name(self, board: MockBoard):
113113
pin = await board.gpio_pin_by_name("pin1")
114114
assert pin.name == "pin1"
115115

116-
async def test_analog_names(self, board: MockBoard):
117-
names = await board.analog_names()
118-
assert names == ["analog1"]
119-
120-
async def test_digital_interrupt_names(self, board: MockBoard):
121-
names = await board.digital_interrupt_names()
122-
assert names == ["interrupt1"]
123-
124116
async def test_do(self, board: MockBoard):
125117
command = {"command": "args"}
126118
resp = await board.do_command(command)
@@ -357,26 +349,6 @@ async def test_gpio_pin_by_name(self, board: MockBoard, service: BoardRPCService
357349
pin = await client.gpio_pin_by_name("pin1")
358350
assert pin.name == "pin1"
359351

360-
async def test_analog_names(self, board: MockBoard, service: BoardRPCService):
361-
async with ChannelFor([service]) as channel:
362-
client = BoardClient(name=board.name, channel=channel)
363-
364-
reader = await client.analog_by_name("analog1")
365-
assert reader.name == "analog1"
366-
367-
names = await client.analog_names()
368-
assert names == ["analog1"]
369-
370-
async def test_digital_interrupt_names(self, board: MockBoard, service: BoardRPCService):
371-
async with ChannelFor([service]) as channel:
372-
client = BoardClient(name=board.name, channel=channel)
373-
374-
interrupt = await client.digital_interrupt_by_name("interrupt1")
375-
assert interrupt.name == "interrupt1"
376-
377-
names = await client.digital_interrupt_names()
378-
assert names == ["interrupt1"]
379-
380352
async def test_do(self, board: MockBoard, service: BoardRPCService):
381353
async with ChannelFor([service]) as channel:
382354
client = BoardClient(board.name, channel)

0 commit comments

Comments
 (0)