Skip to content

Commit 22b147e

Browse files
committed
aiorepl: Replace f-string with str.format.
f-strings aren't enabled on all builds (e.g. low-flash ESP8266). This work was funded through GitHub Sponsors. Signed-off-by: Jim Mussared <[email protected]>
1 parent 7128d42 commit 22b147e

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

micropython/aiorepl/aiorepl.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,21 @@ async def execute(code, g, s):
2626
if "await " in code:
2727
# Execute the code snippet in an async context.
2828
if m := _RE_IMPORT.match(code) or _RE_FROM_IMPORT.match(code):
29-
code = f"global {m.group(3) or m.group(1)}\n {code}"
29+
code = "global {}\n {}".format(m.group(3) or m.group(1), code)
3030
elif m := _RE_GLOBAL.match(code):
31-
code = f"global {m.group(1)}\n {code}"
31+
code = "global {}\n {}".format(m.group(1), code)
3232
elif not _RE_ASSIGN.search(code):
33-
code = f"return {code}"
33+
code = "return {}".format(code)
3434

35-
code = f"""
35+
code = """
3636
import uasyncio as asyncio
3737
async def __code():
38-
{code}
38+
{}
3939
4040
__exec_task = asyncio.create_task(__code())
41-
"""
41+
""".format(
42+
code
43+
)
4244

4345
async def kbd_intr_task(exec_task, s):
4446
while True:
@@ -81,7 +83,7 @@ async def kbd_intr_task(exec_task, s):
8183
micropython.kbd_intr(-1)
8284

8385
except Exception as err:
84-
print(f"{type(err).__name__}: {err}")
86+
print("{}: {}".format(type(err).__name__, err))
8587

8688

8789
# REPL task. Invoke this with an optional mutable globals dict.

0 commit comments

Comments
 (0)