Skip to content

Commit

Permalink
Improve the virtual python repl
Browse files Browse the repository at this point in the history
  • Loading branch information
bill88t committed Sep 11, 2024
1 parent b7a9911 commit 2d7d60e
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions base/Beryllium/bin/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
dmtex("Staring Python shell")
term.write(
"CircuitPython "
+ be.based.system_vars["IMPLEMENTATION"]
+ be.based.system_vars["IMPLEMENTATION_RAW"]
+ " on Beryllium "
+ be.based.system_vars["VERSION"]
+ "\n"
+ "Board: "
+ "Board ID: "
+ be.based.system_vars["BOARD"]
+ "\n"
+ 'Type "help", "copyright", "credits" or "license" for more information.'
Expand All @@ -45,14 +45,19 @@
elif term.buf[0] == 3:
try:
if term.focus is 0 and term.buf[1].endswith("."):
exec(
'vr("ljdirtest", dir({}))'.format(
term.buf[1][: term.buf[1].rfind(".")]
vr("dirtest", None)
exec('vr("dirtest", dir(term.buf[1][: term.buf[1].rfind(".")]))')
if not vr("dirtest"):
exec(
'vr("dirtest", dir(term.buf[1][term.buf[1].find(" "): term.buf[1].rfind(".")]))'
)
)
if len(vr("ljdirtest")):
if not vr("dirtest"):
exec(
'vr("dirtest", dir(term.buf[1][term.buf[1].find(";"): term.buf[1].rfind(".")]))'
)
if vr("dirtest"):
term.write()
for pv[get_pid()]["i"] in vr("ljdirtest"):
for pv[get_pid()]["i"] in vr("dirtest"):
if not vr("i").startswith("_"):
term.nwrite(vr("i") + " ")
term.write()
Expand Down Expand Up @@ -176,6 +181,7 @@
elif term.buf[0] == 2:
term.write("\nKeyboardInterrupt")
term.buf[1] = ""
term.trigger_dict["prefix"] = ">>> "
pv[get_pid()]["mass"].clear()
term.focus = 0
elif term.buf[0] == 4:
Expand Down

0 comments on commit 2d7d60e

Please sign in to comment.