Skip to content

Commit a624a76

Browse files
committed
Manual fixes
1 parent a7bc26a commit a624a76

File tree

6 files changed

+27
-24
lines changed

6 files changed

+27
-24
lines changed

docs/conf_common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
github_repo = "espressif/arduino-esp32"
1818

1919
# context used by sphinx_idf_theme
20-
html_context["github_user"] = "espressif"
21-
html_context["github_repo"] = "arduino-esp32"
20+
html_context["github_user"] = "espressif" # noqa: F405
21+
html_context["github_repo"] = "arduino-esp32" # noqa: F405
2222

2323
html_static_path = ["../_static"]
2424

2525
# Conditional content
2626

27-
extensions += [
27+
extensions += [ # noqa: F405
2828
"sphinx_copybutton",
2929
"sphinx_tabs.tabs",
3030
"esp_docs.esp_extensions.dummy_build_system",

libraries/ESP_SR/tools/gen_sr_commands.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
from g2p_en import G2p
33
import argparse
44

5-
# python3 gen_sr_commands.py "Turn on the light,Switch on the light;Turn off the light,Switch off the light,Go dark;Start fan;Stop fan;Volume down,Turn down;Mute sound;Next song;Pause playback"
5+
# python3 gen_sr_commands.py "Turn on the light,Switch on the light;Turn off the light,Switch off the light,Go dark;\
6+
# Start fan;Stop fan;Volume down,Turn down;Mute sound;Next song;Pause playback"
67
# enum {
78
# SR_CMD_TURN_ON_THE_LIGHT,
89
# SR_CMD_TURN_OFF_THE_LIGHT,

tests/periman/test_periman.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def test_periman(dut):
1818
while True:
1919
try:
2020
res = dut.expect(pattern, timeout=10)
21-
except:
22-
assert False, f"Could not detect end of test"
21+
except Exception as e: # noqa: F841
22+
assert False, "Could not detect end of test"
2323

2424
console_output = res.group(0).decode("utf-8")
2525
peripheral = console_output.split()[0]

tools/espota.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
# Modified since 2016-01-03 from Matthew O'Gorman (https://githumb.com/mogorman)
99
#
1010
# This script will push an OTA update to the ESP
11-
# use it like: python espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <Host_port> [-a password] -f <sketch.bin>
11+
# use it like:
12+
# python espota.py -i <ESP_IP_addr> -I <Host_IP_addr> -p <ESP_port> -P <Host_port> [-a password] -f <sketch.bin>
1213
# Or to upload SPIFFS image:
13-
# python espota.py -i <ESP_IP_address> -I <Host_IP_address> -p <ESP_port> -P <HOST_port> [-a password] -s -f <spiffs.bin>
14+
# python espota.py -i <ESP_IP_addr> -I <Host_IP_addr> -p <ESP_port> -P <HOST_port> [-a password] -s -f <spiffs.bin>
1415
#
1516
# Changes
1617
# 2015-09-18:
@@ -53,6 +54,7 @@
5354
# Constants
5455
PROGRESS_BAR_LENGTH = 60
5556

57+
5658
# update_progress(): Displays or updates a console progress bar
5759
def update_progress(progress):
5860
if PROGRESS:
@@ -79,7 +81,7 @@ def update_progress(progress):
7981
sys.stderr.flush()
8082

8183

82-
def serve(remote_addr, local_addr, remote_port, local_port, password, filename, command=FLASH):
84+
def serve(remote_addr, local_addr, remote_port, local_port, password, filename, command=FLASH): # noqa: C901
8385
# Create a TCP/IP socket
8486
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
8587
server_address = (local_addr, local_port)
@@ -107,8 +109,8 @@ def serve(remote_addr, local_addr, remote_port, local_port, password, filename,
107109
sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
108110
remote_address = (remote_addr, int(remote_port))
109111
try:
110-
sent = sock2.sendto(message.encode(), remote_address)
111-
except:
112+
sent = sock2.sendto(message.encode(), remote_address) # noqa: F841
113+
except: # noqa: E722
112114
sys.stderr.write("failed\n")
113115
sys.stderr.flush()
114116
sock2.close()
@@ -118,7 +120,7 @@ def serve(remote_addr, local_addr, remote_port, local_port, password, filename,
118120
try:
119121
data = sock2.recv(37).decode()
120122
break
121-
except:
123+
except: # noqa: E722
122124
sys.stderr.write(".")
123125
sys.stderr.flush()
124126
sock2.close()
@@ -142,7 +144,7 @@ def serve(remote_addr, local_addr, remote_port, local_port, password, filename,
142144
sock2.settimeout(10)
143145
try:
144146
data = sock2.recv(32).decode()
145-
except:
147+
except: # noqa: E722
146148
sys.stderr.write("FAIL\n")
147149
logging.error("No Answer to our Authentication")
148150
sock2.close()
@@ -166,7 +168,7 @@ def serve(remote_addr, local_addr, remote_port, local_port, password, filename,
166168
connection, client_address = sock.accept()
167169
sock.settimeout(None)
168170
connection.settimeout(None)
169-
except:
171+
except: # noqa: E722
170172
logging.error("No response from device")
171173
sock.close()
172174
return 1

tools/gen_esp32part.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def from_file(cls, f):
165165
return cls.from_csv(data), False
166166

167167
@classmethod
168-
def from_csv(cls, csv_contents):
168+
def from_csv(cls, csv_contents): # noqa: C901
169169
res = PartitionTable()
170170
lines = csv_contents.splitlines()
171171

@@ -203,7 +203,7 @@ def expand_vars(f):
203203
)
204204
else:
205205
raise InputError(
206-
"CSV Error at line %d: Partitions overlap. Partition sets offset 0x%x. Previous partition ends 0x%x"
206+
"CSV Error at line %d: Partitions overlap. Partition sets offset 0x%x. Previous partition ends 0x%x" # noqa: E501
207207
% (e.line_no, e.offset, last_end)
208208
)
209209
if e.offset is None:
@@ -246,14 +246,14 @@ def find_by_name(self, name):
246246
return p
247247
return None
248248

249-
def verify(self):
249+
def verify(self): # noqa: C901
250250
# verify each partition individually
251251
for p in self:
252252
p.verify()
253253

254254
# check on duplicate name
255255
names = [p.name for p in self]
256-
duplicates = set(n for n in names if names.count(n) > 1)
256+
duplicates = set(n for n in names if names.count(n) > 1) # noqa: C401
257257

258258
# print sorted duplicate partitions by name
259259
if len(duplicates) != 0:
@@ -282,7 +282,7 @@ def verify(self):
282282
for p in otadata_duplicates:
283283
critical("%s" % (p.to_csv()))
284284
raise InputError(
285-
'Found multiple otadata partitions. Only one partition can be defined with type="data"(1) and subtype="ota"(0).'
285+
'Found multiple otadata partitions. Only one partition can be defined with type="data"(1) and subtype="ota"(0).' # noqa: E501
286286
)
287287

288288
if len(otadata_duplicates) == 1 and otadata_duplicates[0].size != 0x2000:
@@ -318,7 +318,7 @@ def from_binary(cls, b):
318318
md5 = hashlib.md5()
319319
result = cls()
320320
for o in range(0, len(b), 32):
321-
data = b[o : o + 32]
321+
data = b[o:o + 32]
322322
if len(data) != 32:
323323
raise InputError("Partition table length must be a multiple of 32 bytes")
324324
if data == b"\xFF" * 32:
@@ -457,7 +457,7 @@ def parse_address(self, strval):
457457
return None # PartitionTable will fill in default
458458
return parse_int(strval)
459459

460-
def verify(self):
460+
def verify(self): # noqa: C901
461461
if self.type is None:
462462
raise ValidationError(self, "Type field is not set")
463463
if self.subtype is None:
@@ -574,7 +574,7 @@ def parse_int(v, keywords={}):
574574
raise InputError("Value '%s' is not valid. Known keywords: %s" % (v, ", ".join(keywords)))
575575

576576

577-
def main():
577+
def main(): # noqa: C901
578578
global quiet
579579
global md5sum
580580
global offset_part_table

tools/get.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from urllib.request import urlretrieve
2828
from urllib.request import urlopen
2929

30-
unicode = lambda s: str(s)
30+
unicode = lambda s: str(s) # noqa: E731
3131
else:
3232
# Not Python 3 - today, it is most likely to be Python 2
3333
from urllib import urlretrieve
@@ -185,7 +185,7 @@ def get_tool(tool):
185185
else:
186186
try:
187187
urlretrieve(url, local_path, report_progress)
188-
except:
188+
except: # noqa: E722
189189
download_file_with_progress(url, local_path)
190190
sys.stdout.write("\rDone \n")
191191
sys.stdout.flush()

0 commit comments

Comments
 (0)