-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
digital_inout.py: add exceptions when ipol register is absent #60
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! Please test for the attribute instead of catching an exception. That way the code is clearer and doesn't capture any other unexpected exceptions.
adafruit_mcp230xx/digital_inout.py
Outdated
try: | ||
if _get_bit(self._mcp.ipol, self._pin): | ||
return True | ||
return False | ||
except AttributeError: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Proactively testing for the attribute is clearer than catching the error.
try: | |
if _get_bit(self._mcp.ipol, self._pin): | |
return True | |
return False | |
except AttributeError: | |
return False | |
if hasattr(self._mcp, "ipol") and _get_bit(self._mcp.ipol, self._pin): | |
return True | |
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Thanks for having me! |
Do you mind rolling out a new release? |
There is a new release now. It takes a few moments to get uploaded to pypi and the release page. It should get added to the bundle overnight tonight and be available in there after that. |
Thanks! |
Updating https://github.com/adafruit/Adafruit_CircuitPython_MCP230xx to 2.5.15 from 2.5.14: > Merge pull request adafruit/Adafruit_CircuitPython_MCP230xx#60 from regicidalplutophage/patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_VEML7700 to 2.0.2 from 2.0.1: > Merge pull request adafruit/Adafruit_CircuitPython_VEML7700#31 from adafruit/anecdata-patch-1 Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA: > Updated download stats for the libraries
Fixes #59