Get the source code of a Python function.
(self, func: callable)
| 576 | return "\n".join(result_lines) |
| 577 | |
| 578 | def _get_function_source(self, func: callable) -> str | None: |
| 579 | """Get the source code of a Python function.""" |
| 580 | try: |
| 581 | source = inspect.getsource(func) |
| 582 | return source |
| 583 | except (OSError, TypeError): |
| 584 | # If we can't get the source, return None |
| 585 | return None |
| 586 | |
| 587 | def _format_python_function(self, _func_name: str, func_source: str, indent: int) -> str: |
| 588 | """Format a Python function with proper indentation for TVMScript.""" |
no outgoing calls
no test coverage detected