Skip to content

Commit 9afb084

Browse files
Clean up minor warnings from LGTM.com (#7500)
* Clean up minor warnings from LGTM.com LGTM (Semmie) is a tool, bought by GitHub last year, that conducts basic linting tasks on code and HTML. Clean up the warnings identified in the latest report: https://lgtm.com/projects/g/esp8266/Arduino/?mode=list No functionality should change, however this may fix some issues with the perl utilities not exiting properly on a Ctrl-C from the command line. * Back out HTML changes and rerun boards.txt.py
1 parent a8e35a5 commit 9afb084

File tree

9 files changed

+36
-43
lines changed

9 files changed

+36
-43
lines changed

Diff for: doc/boards.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,6 @@ DOIT ESP-Mx DevKit (ESP8285)
476476
----------------------------
477477

478478
DOIT ESP-Mx DevKit - This is a development board by DOIT, with a DOIT ESP-Mx module (`datasheet <https://github.com/SmartArduino/SZDOITWiKi/wiki/ESP8285---ESP-M2>`__) using a ESP8285 Chip. With the DOIT ESP-Mx module, GPIO pins 9 and 10 are not available. The DOIT ESP-Mx DevKit board has a red power LED and a blue LED connected to GPIO16 and is active low to turn on. It uses a CH340C, USB to Serial converter chip.
479-
ESP8285 (`datasheet <http://www.espressif.com/sites/default/files/0a-esp8285_datasheet_en_v1.0_20160422.pdf>`__) is a multi-chip package which contains ESP8266 and 1MB flash.
480479

480+
ESP8285 (`datasheet <http://www.espressif.com/sites/default/files/0a-esp8285_datasheet_en_v1.0_20160422.pdf>`__) is a multi-chip package which contains ESP8266 and 1MB flash.
481481

Diff for: libraries/ESP8266WiFi/examples/BearSSL_CertStore/certs-from-mozilla.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python3
1+
#!/usr/bin/env python3
22

33
# This script pulls the list of Mozilla trusted certificate authorities
44
# from the web at the "mozurl" below, parses the file to grab the PEM
@@ -14,11 +14,11 @@
1414
from subprocess import Popen, PIPE, call
1515
try:
1616
from urllib.request import urlopen
17-
except:
17+
except Exception:
1818
from urllib2 import urlopen
1919
try:
2020
from StringIO import StringIO
21-
except:
21+
except Exception:
2222
from io import StringIO
2323

2424
# Mozilla's URL for the CSV file with included PEM certs
@@ -42,7 +42,7 @@
4242
# Try and make ./data, skip if present
4343
try:
4444
os.mkdir("data")
45-
except:
45+
except Exception:
4646
pass
4747

4848
derFiles = []

Diff for: package/upload_release.py

100644100755
-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
from github import Github
44
import argparse
5-
import collections
6-
import glob
7-
import json
8-
import mimetypes
9-
import os
105

116
parser = argparse.ArgumentParser(description='Upload a set of files to a new draft release')
127
parser.add_argument('--user', help="Github username", type=str, required=True)

Diff for: tools/boards.txt.py

+18-19
Original file line numberDiff line numberDiff line change
@@ -907,23 +907,23 @@
907907
'1M',
908908
],
909909
'desc': [
910-
'ESP8266 based devices from ITEAD: Sonoff SV, Sonoff TH, Sonoff Basic, '
910+
'ESP8266 based devices from ITEAD: Sonoff SV, Sonoff TH, Sonoff Basic, ' +
911911
'and Sonoff S20',
912912
'',
913-
'These are not development boards. The development process is '
914-
'inconvenient with these devices. When flashing firmware you will '
913+
'These are not development boards. The development process is ' +
914+
'inconvenient with these devices. When flashing firmware you will ' +
915915
'need a Serial Adapter to connect it to your computer.',
916916
'',
917-
' | Most of these devices, during normal operation, are connected to '
918-
'*wall power (AKA Mains Electricity)*. **NEVER** try to flash these '
919-
'devices when connected to *wall power*. **ALWAYS** have them '
920-
'disconnected from *wall power* when connecting them to your '
917+
' | Most of these devices, during normal operation, are connected to ' +
918+
'*wall power (AKA Mains Electricity)*. **NEVER** try to flash these ' +
919+
'devices when connected to *wall power*. **ALWAYS** have them ' +
920+
'disconnected from *wall power* when connecting them to your ' +
921921
'computer. Your life may depend on it!',
922922
'',
923-
'When flashing you will need to hold down the push button connected '
924-
'to the GPIO0 pin, while powering up with a safe 3.3 Volt source. Some USB '
925-
'Serial Adapters may supply enough power to handle flashing; '
926-
'however, it many may not supply enough power to handle the '
923+
'When flashing you will need to hold down the push button connected ' +
924+
'to the GPIO0 pin, while powering up with a safe 3.3 Volt source. Some USB ' +
925+
'Serial Adapters may supply enough power to handle flashing; ' +
926+
'however, it many may not supply enough power to handle the ' +
927927
'activities when the device reboots.',
928928
'',
929929
'More product details at the bottom of https://www.itead.cc/wiki/Product/'
@@ -943,15 +943,14 @@
943943
'1M',
944944
],
945945
'desc': [
946-
'DOIT ESP-Mx DevKit - This is a development board by DOIT, with a DOIT ESP-Mx module '
947-
'(`datasheet <https://github.com/SmartArduino/SZDOITWiKi/wiki/ESP8285---ESP-M2>`__) '
948-
'using a ESP8285 Chip. With the DOIT ESP-Mx module, GPIO pins 9 and 10 are not available. '
949-
'The DOIT ESP-Mx DevKit board has a red power LED and a blue LED connected to GPIO16 '
950-
'and is active low to turn on. It uses a CH340C, USB to Serial converter chip. '
951-
'',
952-
'ESP8285 (`datasheet <http://www.espressif.com/sites/default/files/0a-esp8285_datasheet_en_v1.0_20160422.pdf>`__) '
953-
'is a multi-chip package which contains ESP8266 and 1MB flash. ',
946+
'DOIT ESP-Mx DevKit - This is a development board by DOIT, with a DOIT ESP-Mx module ' +
947+
'(`datasheet <https://github.com/SmartArduino/SZDOITWiKi/wiki/ESP8285---ESP-M2>`__) ' +
948+
'using a ESP8285 Chip. With the DOIT ESP-Mx module, GPIO pins 9 and 10 are not available. ' +
949+
'The DOIT ESP-Mx DevKit board has a red power LED and a blue LED connected to GPIO16 ' +
950+
'and is active low to turn on. It uses a CH340C, USB to Serial converter chip. ',
954951
'',
952+
'ESP8285 (`datasheet <http://www.espressif.com/sites/default/files/0a-esp8285_datasheet_en_v1.0_20160422.pdf>`__) ' +
953+
'is a multi-chip package which contains ESP8266 and 1MB flash. '
955954
],
956955

957956
})

Diff for: tools/elf2bin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_segment_size_addr(elf, segment, path):
5757
def read_segment(elf, segment, path):
5858
fd, tmpfile = tempfile.mkstemp()
5959
os.close(fd)
60-
p = subprocess.check_call([path + "/xtensa-lx106-elf-objcopy", '-O', 'binary', '--only-section=' + segment, elf, tmpfile], stdout=subprocess.PIPE)
60+
subprocess.check_call([path + "/xtensa-lx106-elf-objcopy", '-O', 'binary', '--only-section=' + segment, elf, tmpfile], stdout=subprocess.PIPE)
6161
with open(tmpfile, "rb") as f:
6262
raw = f.read()
6363
os.remove(tmpfile)
@@ -85,7 +85,7 @@ def write_bin(out, args, elf, segments, to_addr):
8585
try:
8686
for data in raw:
8787
checksum = checksum ^ ord(data)
88-
except:
88+
except Exception:
8989
for data in raw:
9090
checksum = checksum ^ data
9191
total_size += 1

Diff for: tools/espota.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
7777
try:
7878
sock.bind(server_address)
7979
sock.listen(1)
80-
except:
80+
except Exception:
8181
logging.error("Listen Failed")
8282
return 1
8383

@@ -100,11 +100,11 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
100100
logging.info('Sending invitation to: %s', remoteAddr)
101101
sock2 = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
102102
remote_address = (remoteAddr, int(remotePort))
103-
sent = sock2.sendto(message.encode(), remote_address)
103+
sock2.sendto(message.encode(), remote_address)
104104
sock2.settimeout(10)
105105
try:
106106
data = sock2.recv(128).decode()
107-
except:
107+
except Exception:
108108
logging.error('No Answer')
109109
sock2.close()
110110
return 1
@@ -123,7 +123,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
123123
sock2.settimeout(10)
124124
try:
125125
data = sock2.recv(32).decode()
126-
except:
126+
except Exception:
127127
sys.stderr.write('FAIL\n')
128128
logging.error('No Answer to our Authentication')
129129
sock2.close()
@@ -147,7 +147,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
147147
connection, client_address = sock.accept()
148148
sock.settimeout(None)
149149
connection.settimeout(None)
150-
except:
150+
except Exception:
151151
logging.error('No response from device')
152152
sock.close()
153153
return 1
@@ -173,7 +173,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
173173
if connection.recv(32).decode().find('O') >= 0:
174174
# connection will receive only digits or 'OK'
175175
received_ok = True
176-
except:
176+
except Exception:
177177
sys.stderr.write('\n')
178178
logging.error('Error Uploading')
179179
connection.close()
@@ -207,7 +207,7 @@ def serve(remoteAddr, localAddr, remotePort, localPort, password, filename, comm
207207
if received_ok:
208208
return 0
209209
return 1
210-
except:
210+
except Exception:
211211
logging.error('No Result!')
212212
connection.close()
213213
f.close()

Diff for: tools/makecorever.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def git(*args):
3232
try:
3333
git_ver = git("rev-parse", "--short=8", "HEAD")
3434
git_desc = git("describe", "--tags")
35-
except:
35+
except Exception:
3636
pass
3737

3838
text = "#define ARDUINO_ESP8266_GIT_VER 0x{}\n".format(git_ver)
@@ -43,7 +43,7 @@ def git(*args):
4343
old_text = inp.read()
4444
if old_text == text:
4545
return
46-
except:
46+
except Exception:
4747
pass
4848

4949
with open(path, "w") as out:
@@ -73,7 +73,7 @@ def git(*args):
7373
include_dir = os.path.join(args.build_path, args.include_dir)
7474
try:
7575
os.makedirs(include_dir)
76-
except:
76+
except Exception:
7777
pass
7878

7979
generate(

Diff for: tools/signing.py

-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def main():
7878
f.write(val)
7979
return 0
8080
elif args.mode == "sign":
81-
val = ""
8281
if not os.path.isfile(args.privatekey):
8382
return
8483
try:

Diff for: tools/upload.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
sys.path.insert(0, toolspath + "/pyserial") # Add pyserial dir to search path
1717
sys.path.insert(0, toolspath + "/esptool") # Add esptool dir to search path
1818
import esptool # If this fails, we can't continue and will bomb below
19-
except:
19+
except Exception:
2020
sys.stderr.write("pyserial or esptool directories not found next to this upload.py tool.\n")
2121
sys.exit(1)
2222

0 commit comments

Comments
 (0)