Skip to content

Commit 481d615

Browse files
committed
black
1 parent 3de8835 commit 481d615

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

adafruit_debouncer.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
# Find out whether the current CircuitPython supports time.monotonic_ns(),
6666
# which doesn't have the accuracy limitation.
67-
if hasattr(time, 'monotonic_ns'):
67+
if hasattr(time, "monotonic_ns"):
6868
TICKS_PER_SEC = 1_000_000_000
6969
MONOTONIC_TICKS = time.monotonic_ns
7070
else:
@@ -129,7 +129,6 @@ def interval(self):
129129
"""The debounce delay, in seconds"""
130130
return self._interval_ticks / TICKS_PER_SEC
131131

132-
133132
@interval.setter
134133
def interval(self, new_interval_s):
135134
self._interval_ticks = new_interval_s * TICKS_PER_SEC

tests/tests.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
def _true():
1616
return True
17+
18+
1719
def _false():
1820
return False
1921

@@ -53,17 +55,20 @@ def test_back_and_forth():
5355
assertEqual(db.fell, False)
5456
assertEqual(db.rose, False)
5557
time.sleep(0.02)
56-
assert 0.019 < db.current_duration <= 1, \
58+
assert 0.019 < db.current_duration <= 1, (
5759
"Unit error? sleep .02 -> duration %d" % db.current_duration
60+
)
5861
db.update()
5962
assertEqual(db.value, False)
6063
assertEqual(db.rose, False)
6164
assertEqual(db.fell, True)
6265

63-
assert 0 < db.current_duration <= 0.1, \
66+
assert 0 < db.current_duration <= 0.1, (
6467
"Unit error? time to run asserts %d" % db.current_duration
65-
assert 0 < db.last_duration < 0.1, \
68+
)
69+
assert 0 < db.last_duration < 0.1, (
6670
"Unit error? Last dur should be ~.02, is %d" % db.last_duration
71+
)
6772

6873

6974
def test_interval_is_the_same():
@@ -115,7 +120,7 @@ def run():
115120
passes = 0
116121
fails = 0
117122
for name, test in locals().items():
118-
if name.startswith('test_') and callable(test):
123+
if name.startswith("test_") and callable(test):
119124
try:
120125
print()
121126
print(name)
@@ -129,16 +134,18 @@ def run():
129134

130135
print(passes, "passed,", fails, "failed")
131136
if passes and not fails:
132-
print(r"""
137+
print(
138+
r"""
133139
________
134140
< YATTA! >
135141
--------
136142
\ ^__^
137143
\ (oo)\_______
138144
(__)\ )\/\
139145
||----w |
140-
|| ||""")
146+
|| ||"""
147+
)
141148

142149

143-
if __name__ == '__main__':
150+
if __name__ == "__main__":
144151
run()

0 commit comments

Comments
 (0)