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