Skip to content

Commit baf13c2

Browse files
committed
Blacked etc
1 parent cebc9bf commit baf13c2

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

.pylintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[MESSAGES CONTROL]
2+
disable=bad-continuation,invalid-name,unnecessary-pass,protected-access,fixme,broad-except,no-absolute-import,global-statement,C,R
3+

asyncgpio/gpio.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ class Line:
7575

7676
_line = None
7777
_direction = None
78+
_default = None
7879
_flags = None
7980
_ev_flags = None
8081
_state = _FREE
8182

83+
_type = None
84+
8285
def __init__(self, chip, offset, consumer=sys.argv[0][:-3]):
8386
self._chip = chip
8487
self._offset = offset
@@ -230,7 +233,9 @@ def consumer(self):
230233
return None
231234
return gpio.ffi.string(n).decode("utf-8")
232235

233-
def monitor(self, type=gpio.REQUEST_EVENT_RISING_EDGE, flags=0):
236+
def monitor(
237+
self, type=gpio.REQUEST_EVENT_RISING_EDGE, flags=0
238+
): # pylint: disable=redefined-builtin
234239
"""
235240
Monitor events.
236241
@@ -261,10 +266,10 @@ def _update(self):
261266
def __iter__(self):
262267
raise RuntimeError("You need to use 'async for', not 'for'")
263268

264-
def __aenter__(self):
269+
async def __aenter__(self):
265270
raise RuntimeError("You need to use 'with', not 'async with'")
266271

267-
def __aexit__(self):
272+
async def __aexit__(self, *_):
268273
raise RuntimeError("You need to use 'with', not 'async with'")
269274

270275
def __aiter__(self):

asyncgpio/test.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ class GpioWatcher:
9191
This class polls `/sys/kernel/debug/gpio` (can be overridden).
9292
"""
9393

94+
tg = None # for .run
95+
9496
def __init__(
9597
self,
9698
interval: float = 0.2,
@@ -103,7 +105,7 @@ def __init__(
103105
# self.names = {}
104106
self.sysfs_path = sysfs_path
105107
self.debugfs_path = debugfs_path
106-
gpio_dir = os.path.join(sysfs_path, "class", "gpio")
108+
# gpio_dir = os.path.join(sysfs_path, "class", "gpio")
107109

108110
# for d in os.listdir(gpio_dir):
109111
# try:
@@ -154,24 +156,24 @@ async def check_pins(self):
154156
chip = None
155157
base = None
156158

157-
for l in self.gpio:
158-
l = l.strip()
159-
if not l:
159+
for line in self.gpio:
160+
line = line.strip()
161+
if not line:
160162
chip = None
161163
continue
162164
if chip is None:
163-
r = _r_chip.match(l)
165+
r = _r_chip.match(line)
164166
if not r:
165-
raise ValueError(l)
167+
raise ValueError(line)
166168
chip = r.group("name")
167169
if not chip:
168170
chip = r.group("chip")
169171
base = int(r.group("base"))
170172
else:
171-
r = _r_pin.match(l)
173+
r = _r_pin.match(line)
172174
if not r:
173175
breakpoint()
174-
raise ValueError(l)
176+
raise ValueError(line)
175177
pin = int(r.group("pin")) - base
176178
out = r.group("dir") == "out"
177179
val = r.group("val") == "hi"

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
license="MIT -or- Apache License 2.0",
1414
packages=find_packages(),
1515
setup_requires=["setuptools_scm"],
16-
install_requires=["trio >= 0.15", "cffi", "async-generator",],
17-
keywords=["gpio",],
16+
install_requires=["trio >= 0.15", "cffi", "async-generator"],
17+
keywords=["gpio"],
1818
python_requires=">=3.6",
1919
classifiers=[
2020
"License :: OSI Approved :: MIT License",

0 commit comments

Comments
 (0)