Skip to content

Commit

Permalink
RSDK-9560: remove AnalogNames and DigitalInterruptNames from pyth…
Browse files Browse the repository at this point in the history
…on sdk (#808)
  • Loading branch information
martha-johnston authored Dec 31, 2024
1 parent 0008854 commit 27e8730
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 88 deletions.
6 changes: 0 additions & 6 deletions examples/server/v1/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,12 +306,6 @@ async def gpio_pin_by_name(self, name: str) -> Board.GPIOPin:
except KeyError:
raise ResourceNotFoundError("Board.GPIOPin", name)

async def analog_names(self) -> List[str]:
return [key for key in self.analogs.keys()]

async def digital_interrupt_names(self) -> List[str]:
return [key for key in self.digital_interrupts.keys()]

async def set_power_mode(self, **kwargs):
raise NotImplementedError()

Expand Down
38 changes: 0 additions & 38 deletions src/viam/components/board/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,44 +364,6 @@ async def gpio_pin_by_name(self, name: str) -> GPIOPin:
"""
...

@abc.abstractmethod
async def analog_names(self) -> List[str]:
"""
Get the names of all known analog readers and/or writers.
::
my_board = Board.from_robot(robot=machine, name="my_board")
# Get the name of every Analog configured on the board.
names = await my_board.analog_names()
Returns:
List[str]: The list of names of all known analog readers/writers.
For more information, see `Board component <https://docs.viam.com/components/board/>`_.
"""
...

@abc.abstractmethod
async def digital_interrupt_names(self) -> List[str]:
"""
Get the names of all known digital interrupts.
::
my_board = Board.from_robot(robot=machine, name="my_board")
# Get the name of every DigitalInterrupt configured on the board.
names = await my_board.digital_interrupt_names()
Returns:
List[str]: The names of the digital interrupts.
For more information, see `Board component <https://docs.viam.com/components/board/>`_.
"""
...

@abc.abstractmethod
async def set_power_mode(
self, mode: PowerMode.ValueType, duration: Optional[timedelta] = None, *, timeout: Optional[float] = None, **kwargs
Expand Down
10 changes: 0 additions & 10 deletions src/viam/components/board/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,6 @@ async def digital_interrupt_by_name(self, name: str) -> Board.DigitalInterrupt:
async def gpio_pin_by_name(self, name: str) -> Board.GPIOPin:
return GPIOPinClient(name, self)

async def analog_names(self) -> List[str]:
if self._analog_names is None:
return []
return self._analog_names

async def digital_interrupt_names(self) -> List[str]:
if self._digital_interrupt_names is None:
return []
return self._digital_interrupt_names

async def do_command(
self,
command: Mapping[str, ValueTypes],
Expand Down
6 changes: 0 additions & 6 deletions tests/mocks/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,6 @@ async def gpio_pin_by_name(self, name: str) -> Board.GPIOPin:
except KeyError:
raise ResourceNotFoundError("Board.GPIOPin", name)

async def analog_names(self) -> List[str]:
return [key for key in self.analogs.keys()]

async def digital_interrupt_names(self) -> List[str]:
return [key for key in self.digital_interrupts.keys()]

async def get_geometries(self, *, extra: Optional[Dict[str, Any]] = None, timeout: Optional[float] = None) -> List[Geometry]:
self.extra = extra
self.timeout = timeout
Expand Down
28 changes: 0 additions & 28 deletions tests/test_board.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ async def test_gpio_pin_by_name(self, board: MockBoard):
pin = await board.gpio_pin_by_name("pin1")
assert pin.name == "pin1"

async def test_analog_names(self, board: MockBoard):
names = await board.analog_names()
assert names == ["analog1"]

async def test_digital_interrupt_names(self, board: MockBoard):
names = await board.digital_interrupt_names()
assert names == ["interrupt1"]

async def test_do(self, board: MockBoard):
command = {"command": "args"}
resp = await board.do_command(command)
Expand Down Expand Up @@ -357,26 +349,6 @@ async def test_gpio_pin_by_name(self, board: MockBoard, service: BoardRPCService
pin = await client.gpio_pin_by_name("pin1")
assert pin.name == "pin1"

async def test_analog_names(self, board: MockBoard, service: BoardRPCService):
async with ChannelFor([service]) as channel:
client = BoardClient(name=board.name, channel=channel)

reader = await client.analog_by_name("analog1")
assert reader.name == "analog1"

names = await client.analog_names()
assert names == ["analog1"]

async def test_digital_interrupt_names(self, board: MockBoard, service: BoardRPCService):
async with ChannelFor([service]) as channel:
client = BoardClient(name=board.name, channel=channel)

interrupt = await client.digital_interrupt_by_name("interrupt1")
assert interrupt.name == "interrupt1"

names = await client.digital_interrupt_names()
assert names == ["interrupt1"]

async def test_do(self, board: MockBoard, service: BoardRPCService):
async with ChannelFor([service]) as channel:
client = BoardClient(board.name, channel)
Expand Down

0 comments on commit 27e8730

Please sign in to comment.