Skip to content

Commit 8934d7a

Browse files
committed
Fixes and linting
1 parent 6c13fd4 commit 8934d7a

7 files changed

Lines changed: 15 additions & 15 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
LIBRARY_VERSION=$(shell cat library/setup.py | grep version | awk -F"'" '{print $$2}')
2-
LIBRARY_NAME=$(shell cat library/setup.py | grep name | awk -F"'" '{print $$2}')
1+
LIBRARY_VERSION=$(shell cat library/setup.cfg | grep version | awk -F" = " '{print $$2}')
2+
LIBRARY_NAME=$(shell cat library/setup.cfg | grep name | awk -F" = " '{print $$2}')
33

44
.PHONY: usage install uninstall
55
usage:

examples/button.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
@fanshim.on_press()
2121
def press_handler():
2222
print("Pressed")
23-
was_held = False
2423

2524

2625
@fanshim.on_release()

examples/toggle.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
fanshim = FANShim()
1515

16+
1617
def update_led(state):
1718
if state:
1819
fanshim.set_light(0, 255, 0)
@@ -25,6 +26,7 @@ def release_handler(was_held):
2526
state = fanshim.toggle_fan()
2627
update_led(state)
2728

29+
2830
try:
2931
update_led(fanshim.get_fan())
3032
signal.pause()

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4-
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
3+
LIBRARY_VERSION=`cat library/setup.cfg | grep version | awk -F" = " '{print $2}'`
4+
LIBRARY_NAME=`cat library/setup.cfg | grep name | awk -F" = " '{print $2}'`
55

66
printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Installer\n\n"
77

library/fanshim/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
class FANShim():
1111
def __init__(self):
12-
self._pin_fancontrol = 18
12+
self._pin_fancontrol = 18
1313
self._pin_button = 17
1414
self._button_press_handler = None
1515
self._button_release_handler = None
1616
self._button_hold_handler = None
1717
self._t_poll = None
18-
18+
1919
atexit.register(self._cleanup)
2020

2121
GPIO.setwarnings(False)
@@ -42,7 +42,7 @@ def stop(self):
4242

4343
def on_press(self, handler=None):
4444
def attach_handler(handler):
45-
self._button_press_handler =handler
45+
self._button_press_handler = handler
4646

4747
if handler is not None:
4848
attach_handler(handler)
@@ -69,7 +69,7 @@ def attach_handler(handler):
6969

7070
def set_hold_time(self, hold_time):
7171
"""Set the button hold time in seconds.
72-
72+
7373
:param hold_time: Amount of time button must be held to trigger on_hold (in seconds)
7474
7575
"""
@@ -83,9 +83,9 @@ def toggle_fan(self):
8383

8484
def set_fan(self, fan_state):
8585
"""Set the fan on/off.
86-
86+
8787
:param fan_state: True/False for on/off
88-
88+
8989
"""
9090
GPIO.output(self._pin_fancontrol, True if fan_state else False)
9191
return True if fan_state else False
@@ -125,4 +125,3 @@ def _run(self):
125125
last = current
126126

127127
time.sleep(0.001)
128-

library/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ license = MIT
1313
# This includes the license file(s) in the wheel.
1414
# https://wheel.readthedocs.io/en/stable/user_guide.html#including-license-files-in-the-generated-wheel-file
1515
license_files = LICENSE.txt
16-
classifiers =
16+
classifiers =
1717
Development Status :: 4 - Beta
1818
Operating System :: POSIX :: Linux
1919
License :: OSI Approved :: MIT License

uninstall.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

3-
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4-
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
3+
LIBRARY_VERSION=`cat library/setup.cfg | grep version | awk -F" = " '{print $2}'`
4+
LIBRARY_NAME=`cat library/setup.cfg | grep name | awk -F" = " '{print $2}'`
55

66
printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Uninstaller\n\n"
77

0 commit comments

Comments
 (0)