(code)
| 31 | |
| 32 | |
| 33 | def playground(code): |
| 34 | pre_import = PRE_IMPORT |
| 35 | battery_apis = pywebio_battery.__all__ |
| 36 | if 'pywebio_battery import' not in code and any(api in code for api in battery_apis): |
| 37 | pre_import += 'from pywebio_battery import *\n' |
| 38 | |
| 39 | code = f"{pre_import}\n{code}" |
| 40 | encode = base64.b64encode(code.encode('utf8')).decode('utf8') |
| 41 | url = f"{playground_host}/#{encode}" |
| 42 | run_js('window.open(url)', url=url) |
| 43 | |
| 44 | |
| 45 | def gen_snippets(code): |
nothing calls this directly
no test coverage detected
searching dependent graphs…