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)
| 53 | } |
| 54 | |
| 55 | def _try_compile(source, name): |
| 56 | """Attempts to compile the given source, first as an expression and |
| 57 | then as a statement if the first approach fails. |
| 58 | |
| 59 | Utility function to accept strings in functions that otherwise |
| 60 | expect code objects |
| 61 | """ |
| 62 | try: |
| 63 | c = compile(source, name, 'eval') |
| 64 | except SyntaxError: |
| 65 | c = compile(source, name, 'exec') |
| 66 | return c |
| 67 | |
| 68 | def dis(x=None, *, file=None, depth=None, show_caches=False, adaptive=False): |
| 69 | """Disassemble classes, methods, functions, and other compiled objects. |
no test coverage detected