Skip to content

Commit

Permalink
mcp23016.py - Change assert to if in get_pin()
Browse files Browse the repository at this point in the history
Removed assert stmt and added if stmt returning a
ValueError if pin number is out of bounds.
  • Loading branch information
SAK917 committed Feb 11, 2021
1 parent 6977a1a commit 44471b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion adafruit_mcp230xx/mcp23016.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ def get_pin(self, pin):
"""Convenience function to create an instance of the DigitalInOut class
pointing at the specified pin of this MCP23016 device.
"""
assert 0 <= pin <= 15
if not 0 <= pin <= 15:
raise ValueError("Pin number must be 0-15.")
return DigitalInOut(pin, self)

def clear_inta(self):
Expand Down

0 comments on commit 44471b7

Please sign in to comment.