MCPcopy Create free account
hub / github.com/pywebio/PyWebIO / playground

Function playground

demos/doc_demo.py:33–42  ·  view source on GitHub ↗
(code)

Source from the content-addressed store, hash-verified

31
32
33def 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
45def gen_snippets(code):

Callers

nothing calls this directly

Calls 1

run_jsFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…