Skip to content

Commit 488e990

Browse files
committed
address pylint errors again
1 parent 2f7bc2c commit 488e990

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

examples/ov5640_jpeg_kaluga1_3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
display = adafruit_ili9341.ILI9341(display_bus, width=320, height=240, rotation=90)
3939

4040
try:
41-
with open("/boot_out.txt", "a") as f:
41+
with open("/boot_out.txt", "ab") as f:
4242
pass
4343
except OSError as e:
4444
print(e)
@@ -48,7 +48,7 @@
4848
'\nboard while holding the "mode" button'
4949
"\n\nThis message is also shown after the board takes a picture and auto-restarts"
5050
)
51-
raise SystemExit
51+
raise SystemExit from e
5252

5353
bus = busio.I2C(scl=board.CAMERA_SIOC, sda=board.CAMERA_SIOD)
5454
cam = adafruit_ov5640.OV5640(
@@ -78,7 +78,7 @@
7878
print("Wrote to CIRCUITPY/cam.jpg")
7979
print("Resetting so computer sees new content of CIRCUITPY")
8080
time.sleep(0.5)
81-
microcontroller.reset()
81+
microcontroller.reset() # pylint: disable=no-member
8282

8383
except OSError as e:
8484
print(e)

examples/ov5640_sdcard_kaluga_1_3.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ def exists(filename):
7575
try:
7676
os.stat(filename)
7777
return True
78-
except OSError as e:
78+
except OSError as _:
7979
return False
8080

8181

8282
_image_counter = 0
8383

8484

8585
def open_next_image():
86-
global _image_counter
86+
global _image_counter # pylint: disable=global-statement
8787
while True:
8888
filename = f"/sd/img{_image_counter:04d}.jpg"
8989
_image_counter += 1
@@ -101,15 +101,16 @@ def open_next_image():
101101
while True:
102102
pixel[0] = 0x0000FF
103103
pixel.write()
104-
a_voltage = a.value * a.reference_voltage / 65535
104+
a_voltage = a.value * a.reference_voltage / 65535 # pylint: disable=no-member
105105
record_pressed = abs(a_voltage - V_RECORD) < 0.05
106106
if record_pressed:
107107
pixel[0] = 0xFF0000
108108
pixel.write()
109109
time.sleep(0.01)
110110
jpeg = cam.capture(b)
111111
print(
112-
f"Captured {len(jpeg)} bytes of jpeg data (had allocated {cam.capture_buffer_size} bytes"
112+
f"Captured {len(jpeg)} bytes of jpeg data"
113+
f" (had allocated {cam.capture_buffer_size} bytes"
113114
)
114115
print(f"Resolution {cam.width}x{cam.height}")
115116
try:
@@ -123,5 +124,7 @@ def open_next_image():
123124
except OSError as e:
124125
print(e)
125126
while record_pressed:
126-
a_voltage = a.value * a.reference_voltage / 65535
127+
a_voltage = (
128+
a.value * a.reference_voltage / 65535
129+
) # pylint: disable=no-member
127130
record_pressed = abs(a_voltage - V_RECORD) < 0.05

0 commit comments

Comments
 (0)