adafruit / Adafruit_CircuitPython_PN532

CircuitPython driver for the PN532 NFC/RFID Breakout and PN532 NFC/RFID Shield
MIT License
91 stars 47 forks source link

Change get_firmware_version() function to a property #30

Closed FoamyGuy closed 4 years ago

FoamyGuy commented 4 years ago

This makes the change referenced in issue #7

FoamyGuy commented 4 years ago

PyLint believes the property access in __init__() seem to have no effect because the result is ignored. I think perhaps it's used to force it to raise the exception if it failed to detect the PN532. For now I am going to add # disable=pointless-statement but if there is a better way this should be handled let me know and I can take care of it.

FoamyGuy commented 4 years ago

If this gets merged there are some code snippets in this learn guide section that would need to get updated to use the new property instead of get_firmware_version() I've updated all of the examples in the repo but I'm not sure if that is going to change the snippets.

caternuson commented 4 years ago

I wonder if just assigning the return to something would make it happy?

_ = self.firmware_version

and if it gripes about that, then:

ic, ver, rev, support = self.firmware_version
FoamyGuy commented 4 years ago

I will give that a try this evening.

FoamyGuy commented 4 years ago

Ah, thank you. That got it. I tested the change just in case and all is well.