Skip to content

Conversation

@regicidalplutophage
Copy link
Contributor

Fixes #59

Copy link
Member

@tannewt tannewt left a 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.

Comment on lines 151 to 156
try:
if _get_bit(self._mcp.ipol, self._pin):
return True
return False
except AttributeError:
return False
Copy link
Member

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.

Suggested change
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

Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt tannewt merged commit 06dd5c6 into adafruit:main Oct 8, 2024
1 check passed
@regicidalplutophage
Copy link
Contributor Author

Thanks for having me!

@regicidalplutophage
Copy link
Contributor Author

Do you mind rolling out a new release?

@FoamyGuy
Copy link
Contributor

FoamyGuy commented Oct 8, 2024

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.

@regicidalplutophage
Copy link
Contributor Author

Thanks!

adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Oct 9, 2024
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AttributeError: object has no attribute 'ipol'

3 participants