Skip to content

Commit 62eb982

Browse files
authored
Correct exception specification
It's a happy coincidence that the documentation build caught this problem. 👍 The code to adapt to both `monotonic_ns` and `monotonic` is structured a bit differently than the LED animation library, which is not a problem. However, when monotonic_ns is not available, the line `time.monotonic_ns()` creates an AttributeError, so we need to catch that. Since there's no `import` inside this block, we do _NOT_ need to catch `ImportError`. At any rate, that's my quick analysis of what has occurred here. I did not do any testing. I think that if I'm correct it will fix the documentation building problem, as well as the functionality.
1 parent 650517d commit 62eb982

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

adafruit_debouncer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
time.monotonic_ns()
6969
TICKS_PER_SEC = 1_000_000_000
7070
MONOTONIC_TICKS = time.monotonic_ns
71-
except (ImportError, NotImplementedError):
71+
except (AttributeError, NotImplementedError):
7272
TICKS_PER_SEC = 1
7373
MONOTONIC_TICKS = time.monotonic
7474

0 commit comments

Comments
 (0)