Skip to content

Commit 24dacb7

Browse files
committed
Linted
1 parent 9f68708 commit 24dacb7

8 files changed

Lines changed: 14 additions & 23 deletions

File tree

CircuitPython_sdcardio_sdioio/benchmark/code.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import time
22
import os
33

4-
import mount_sd
54

65
# First, just write the file 'hello.txt' to the card
7-
with open("/sd/hello.txt", "w") as f: print("hello world", file=f)
6+
with open("/sd/hello.txt", "w") as f:
7+
print("hello world", file=f)
88

99
print()
1010
print("SD card I/O benchmarks")
@@ -16,7 +16,8 @@
1616
# time taken.
1717
for sz in 512, 4096:
1818
b = bytearray(sz)
19-
for i in range(sz): b[i] = 0xaa
19+
for i in range(sz):
20+
b[i] = 0xaa
2021
for n in (1, 16):
2122
with open("/sd/hello.bin", "wb") as f:
2223
t0 = time.monotonic_ns()

CircuitPython_sdcardio_sdioio/list_files/code.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import os
22

3-
import mount_sd
4-
53
def print_directory(path, tabs=0):
64
for file in os.listdir(path):
75
stats = os.stat(path + "/" + file)

CircuitPython_sdcardio_sdioio/log_temperature/code.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import board
44
import digitalio
55
import microcontroller
6-
import mount_sd
76

87
led = digitalio.DigitalInOut(board.D13)
98
led.direction = digitalio.Direction.OUTPUT

CircuitPython_sdcardio_sdioio/play_mp3s/code.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@
33

44
import board
55
import digitalio
6-
import mount_sd
76

87
# Updating the display can interfere with MP3 playback if it is not
98
# done carefully
109
try:
1110
board.DISPLAY.auto_refresh = False
12-
except:
11+
except: # pylint: disable=bare-except
1312
pass
1413

15-
from audiomp3 import MP3Decoder
14+
from audiomp3 import MP3Decoder # pylint: disable=wrong-import-position
1615

1716
try:
1817
from audioio import AudioOut

CircuitPython_sdcardio_sdioio/show_bitmaps/code.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
import board
55
import displayio
66

7-
import mount_sd
8-
97
display = board.DISPLAY
108

119
# The bmp files on the sd card will be shown in alphabetical order

Light_Paintstick_HalloWing/light_paintstick_cpx/code.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ def read_le(value):
8484

8585
class BMPError(Exception):
8686
"""Error handler for BMP-loading function"""
87-
pass
8887

8988
def load_bmp(filename):
9089
"""Load BMP file, return as list of column buffers"""
@@ -159,11 +158,11 @@ def load_bmp(filename):
159158

160159
except OSError as err:
161160
if err.args[0] == 28:
162-
raise OSError("OS Error 28 0.25")
163-
else:
164-
raise OSError("OS Error 0.5")
161+
raise OSError("OS Error 28 0.25") from err
162+
raise OSError("OS Error 0.5") from err
165163
except BMPError as err:
166-
print("Failed to parse BMP: " + err.args[0])
164+
raise BMPError("Failed to parse BMP: " + err.args[0]) from err
165+
167166

168167

169168
# Load BMP image, return 'columns' array:

Light_Paintstick_HalloWing/light_paintstick_hallowing/code.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def read_le(value):
5858

5959
class BMPError(Exception):
6060
"""Error handler for BMP-loading function"""
61-
pass
6261

6362
def load_bmp(filename):
6463
"""Load BMP file, return as list of column buffers"""
@@ -133,11 +132,10 @@ def load_bmp(filename):
133132

134133
except OSError as err:
135134
if err.args[0] == 28:
136-
raise OSError("OS Error 28 0.25")
137-
else:
138-
raise OSError("OS Error 0.5")
135+
raise OSError("OS Error 28 0.25") from err
136+
raise OSError("OS Error 0.5") from err
139137
except BMPError as err:
140-
print("Failed to parse BMP: " + err.args[0])
138+
raise BMPError("Failed to parse BMP: " + err.args[0]) from err
141139

142140

143141
# Load BMP image, return 'COLUMNS' array:

Nightlight/cpx_nightlight/code.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@
3737
# Indicate the nightlight is off.
3838
cp.red_led = True
3939
continue
40-
else:
41-
cp.red_led = False
40+
cp.red_led = False
4241

4342
# Decrease brightness.
4443
if cp.touch_A7:

0 commit comments

Comments
 (0)