Commit graph

9 commits

Author SHA1 Message Date
Scott Shawcroft
e277540f7a
Switch to ruff like MicroPython 2025-02-05 11:09:15 -08:00
elpekenin
9b950a4035 use types.CodeType, as per jepler finding 2024-08-25 14:28:39 +02:00
elpekenin
0a37155f6e fix "code" hint 2024-08-24 03:59:46 +02:00
elpekenin
bc7a052cbb fix some doc-comments 2024-08-23 23:00:56 +02:00
Dan Halbert
3f4d9310ff CircuitPython files: replace STATIC with static 2024-05-20 11:02:17 -04:00
Dan Halbert
747b7619ea update headers of most CircuitPython-only files 2024-05-17 14:56:28 -04:00
bb847523c6
codeop: simplify slightly now that there's no problem with <input> qstr 2023-12-14 17:21:29 -06:00
998cb6929b
run pre-commit 2023-12-14 15:09:00 -06:00
9477574dfc
Add codeop.compile_command
This function in standard Python is a building block for custom REPLs:
```python
from codeop import compile_command

print("Repl in (Circuit-)Python")
ns = {}

PS1="<<< "
PS2=",,, "
command = ""
while True:
    line = input(PS2 if command else PS1)
    if command:
        command = command + "\n" + line
    else:
        command = line
    try:
        if (code := compile_command(command)):
            command = ""
            exec(code, ns)
    except Exception as e:
        command = ""
        print(e)
```
2023-12-14 09:23:23 -06:00