summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChristian Clauss <cclauss@me.com>2023-03-08 16:17:54 +0100
committerDamien George <damien@micropython.org>2023-03-10 13:32:24 +1100
commit4376c969f6f185ffe34041d1914246f74beded9d (patch)
tree5373fee35b70f34f3c52d8bc632bf8cbbe720b1f /tools
parentf3a596db7dffa97c507bc80b78d8160c5eae276d (diff)
all: Fix Python comparison to None and True, and use "not in".
These are basic PEP8 recommendations.
Diffstat (limited to 'tools')
-rw-r--r--tools/mpremote/mpremote/commands.py4
-rw-r--r--tools/uf2conv.py10
2 files changed, 7 insertions, 7 deletions
diff --git a/tools/mpremote/mpremote/commands.py b/tools/mpremote/mpremote/commands.py
index d05a27d9f..fe0283ce6 100644
--- a/tools/mpremote/mpremote/commands.py
+++ b/tools/mpremote/mpremote/commands.py
@@ -122,9 +122,9 @@ def do_filesystem(state, args):
if command == "cat":
# Don't be verbose by default when using cat, so output can be
# redirected to something.
- verbose = args.verbose == True
+ verbose = args.verbose is True
else:
- verbose = args.verbose != False
+ verbose = args.verbose is not False
if command == "cp" and args.recursive:
if paths[-1] != ":":
diff --git a/tools/uf2conv.py b/tools/uf2conv.py
index d3b1d9a26..ef3e48144 100644
--- a/tools/uf2conv.py
+++ b/tools/uf2conv.py
@@ -85,9 +85,9 @@ def convert_from_uf2(buf):
if datalen > 476:
assert False, "Invalid UF2 data size at " + ptr
newaddr = hd[3]
- if (hd[2] & 0x2000) and (currfamilyid == None):
+ if (hd[2] & 0x2000) and (currfamilyid is None):
currfamilyid = hd[7]
- if curraddr == None or ((hd[2] & 0x2000) and hd[7] != currfamilyid):
+ if curraddr is None or ((hd[2] & 0x2000) and hd[7] != currfamilyid):
currfamilyid = hd[7]
curraddr = newaddr
if familyid == 0x0 or familyid == hd[7]:
@@ -111,7 +111,7 @@ def convert_from_uf2(buf):
families_found[hd[7]] = newaddr
else:
families_found[hd[7]] = newaddr
- if prev_flag == None:
+ if prev_flag is None:
prev_flag = hd[2]
if prev_flag != hd[2]:
all_flags_same = False
@@ -234,7 +234,7 @@ def convert_from_hex_to_uf2(buf):
break
elif tp == 0:
addr = upper + ((rec[1] << 8) | rec[2])
- if appstartaddr == None:
+ if appstartaddr is None:
appstartaddr = addr
i = 4
while i < len(rec) - 1:
@@ -419,7 +419,7 @@ def main():
)
if args.convert or ext != "uf2":
drives = []
- if args.output == None:
+ if args.output is None:
args.output = "flash." + ext
else:
drives = get_drives()