MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_events

Function get_events

Lib/test/support/strace_helper.py:148–165  ·  view source on GitHub ↗
(code, strace_flags, prelude, cleanup)

Source from the content-addressed store, hash-verified

146
147
148def get_events(code, strace_flags, prelude, cleanup):
149 # NOTE: The flush is currently required to prevent the prints from getting
150 # buffered and done all at once at exit
151 prelude = textwrap.dedent(prelude)
152 code = textwrap.dedent(code)
153 cleanup = textwrap.dedent(cleanup)
154 to_run = f"""
155print("MARK prelude", flush=True)
156{prelude}
157print("MARK code", flush=True)
158{code}
159print("MARK cleanup", flush=True)
160{cleanup}
161print("MARK __shutdown", flush=True)
162 """
163 trace = strace_python(to_run, strace_flags)
164 all_sections = trace.sections()
165 return all_sections['code']
166
167
168def get_syscalls(code, strace_flags, prelude="", cleanup="",

Callers 1

get_syscallsFunction · 0.70

Calls 3

strace_pythonFunction · 0.85
dedentMethod · 0.80
sectionsMethod · 0.45

Tested by

no test coverage detected