all: Go back to using default ruff quote style.
Commit dc2fcfcc55 seems to have accidentally
changed the ruff quote style to "preserve", instead of keeping it at the
default which is "double".
Put it back to the default and update relevant .py files with this rule.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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("")
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user