summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/mpremote/mpremote/commands.py8
-rw-r--r--tools/mpremote/mpremote/main.py2
-rw-r--r--tools/mpremote/mpremote/repl.py2
-rwxr-xr-xtools/mpy_ld.py22
4 files changed, 17 insertions, 17 deletions
diff --git a/tools/mpremote/mpremote/commands.py b/tools/mpremote/mpremote/commands.py
index 428600baf..4974c71e2 100644
--- a/tools/mpremote/mpremote/commands.py
+++ b/tools/mpremote/mpremote/commands.py
@@ -309,7 +309,7 @@ def do_filesystem_recursive_rm(state, path, args):
os.path.join(r_cwd, path) if not os.path.isabs(path) else path
)
if isinstance(state.transport, SerialTransport) and abs_path.startswith(
- f'{SerialTransport.fs_hook_mount}/'
+ f"{SerialTransport.fs_hook_mount}/"
):
raise CommandError(
f"rm -r not permitted on {SerialTransport.fs_hook_mount} directory"
@@ -335,11 +335,11 @@ def do_filesystem_recursive_rm(state, path, args):
def human_size(size, decimals=1):
- for unit in ['B', 'K', 'M', 'G', 'T']:
- if size < 1024.0 or unit == 'T':
+ for unit in ["B", "K", "M", "G", "T"]:
+ if size < 1024.0 or unit == "T":
break
size /= 1024.0
- return f"{size:.{decimals}f}{unit}" if unit != 'B' else f"{int(size)}"
+ return f"{size:.{decimals}f}{unit}" if unit != "B" else f"{int(size)}"
def do_filesystem_tree(state, path, args):
diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py
index 0441857fa..0aec1efad 100644
--- a/tools/mpremote/mpremote/main.py
+++ b/tools/mpremote/mpremote/main.py
@@ -598,7 +598,7 @@ def main():
cmd == "fs"
and len(command_args) >= 1
and command_args[0] in ("ls", "tree")
- and sum(1 for a in command_args if not a.startswith('-')) == 1
+ and sum(1 for a in command_args if not a.startswith("-")) == 1
):
command_args.append("")
diff --git a/tools/mpremote/mpremote/repl.py b/tools/mpremote/mpremote/repl.py
index 4fda04a2e..ad7e83ea8 100644
--- a/tools/mpremote/mpremote/repl.py
+++ b/tools/mpremote/mpremote/repl.py
@@ -110,7 +110,7 @@ def _is_disconnect_exception(exception):
False otherwise.
"""
if isinstance(exception, OSError):
- if hasattr(exception, 'args') and len(exception.args) > 0:
+ if hasattr(exception, "args") and len(exception.args) > 0:
# IO error, device disappeared
if exception.args[0] == 5:
return True
diff --git a/tools/mpy_ld.py b/tools/mpy_ld.py
index a600ec12c..af8450a84 100755
--- a/tools/mpy_ld.py
+++ b/tools/mpy_ld.py
@@ -1521,31 +1521,31 @@ def parse_linkerscript(source):
symbols = {}
LINE_REGEX = re.compile(
- r'^(?P<weak>PROVIDE\()?' # optional weak marker start
- r'(?P<symbol>[a-zA-Z_]\w*)' # symbol name
- r'=0x(?P<address>[\da-fA-F]{1,8})*' # symbol address
- r'(?(weak)\));$', # optional weak marker end and line terminator
+ r"^(?P<weak>PROVIDE\()?" # optional weak marker start
+ r"(?P<symbol>[a-zA-Z_]\w*)" # symbol name
+ r"=0x(?P<address>[\da-fA-F]{1,8})*" # symbol address
+ r"(?(weak)\));$", # optional weak marker end and line terminator
re.ASCII,
)
inside_comment = False
for line in (line.strip() for line in source.readlines()):
- if line.startswith('/*') and not inside_comment:
- if not line.endswith('*/'):
+ if line.startswith("/*") and not inside_comment:
+ if not line.endswith("*/"):
inside_comment = True
continue
if inside_comment:
- if line.endswith('*/'):
+ if line.endswith("*/"):
inside_comment = False
continue
- if line.startswith('//'):
+ if line.startswith("//"):
continue
- match = LINE_REGEX.match(''.join(line.split()))
+ match = LINE_REGEX.match("".join(line.split()))
if not match:
continue
tokens = match.groupdict()
- symbol = tokens['symbol']
- address = int(tokens['address'], 16)
+ symbol = tokens["symbol"]
+ address = int(tokens["address"], 16)
if symbol in symbols:
raise ValueError(f"Symbol {symbol} already defined")
symbols[symbol] = address