Skip to content

Commit 38b7a3b

Browse files
mpos.apps: add globals introspect
1 parent 2962911 commit 38b7a3b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • internal_filesystem/lib/mpos

internal_filesystem/lib/mpos/apps.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ def execute_script(script_source, is_file, cwd=None):
4040
try:
4141
compiled_script = compile(script_source, compile_name, 'exec')
4242
exec(compiled_script, script_globals)
43+
# Introspect globals
44+
classes = {k: v for k, v in script_globals.items() if isinstance(v, type)}
45+
functions = {k: v for k, v in script_globals.items() if callable(v) and not isinstance(v, type)}
46+
variables = {k: v for k, v in script_globals.items() if not callable(v)}
47+
print("Classes:", classes.keys())
48+
print("Functions:", functions.keys())
49+
print("Variables:", variables.keys())
4350
except Exception as e:
4451
print(f"Thread {thread_id}: exception during execution:")
4552
# Print stack trace with exception type, value, and traceback

0 commit comments

Comments
 (0)