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

Function _try_compile

Lib/dis.py:72–83  ·  view source on GitHub ↗

Attempts to compile the given source, first as an expression and then as a statement if the first approach fails. Utility function to accept strings in functions that otherwise expect code objects

(source, name)

Source from the content-addressed store, hash-verified

70}
71
72def _try_compile(source, name):
73 """Attempts to compile the given source, first as an expression and
74 then as a statement if the first approach fails.
75
76 Utility function to accept strings in functions that otherwise
77 expect code objects
78 """
79 try:
80 return compile(source, name, 'eval')
81 except SyntaxError:
82 pass
83 return compile(source, name, 'exec')
84
85def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False,
86 show_offsets=False, show_positions=False):

Callers 2

_get_code_objectFunction · 0.85
_disassemble_strFunction · 0.85

Calls 1

compileFunction · 0.70

Tested by

no test coverage detected