Format a code string using Black. Parameters ---------- code_str: str The string containing Python/TVMScript code to format formatter: Optional[str] The formatter to use. Can specify `ruff`, `black`, or auto-select by passing `None`. Returns ----
(code_str: str, formatter: str | None = None)
| 162 | |
| 163 | |
| 164 | def _format(code_str: str, formatter: str | None = None) -> str: |
| 165 | """Format a code string using Black. |
| 166 | |
| 167 | Parameters |
| 168 | ---------- |
| 169 | code_str: str |
| 170 | |
| 171 | The string containing Python/TVMScript code to format |
| 172 | |
| 173 | formatter: Optional[str] |
| 174 | |
| 175 | The formatter to use. Can specify `ruff`, `black`, or |
| 176 | auto-select by passing `None`. |
| 177 | |
| 178 | Returns |
| 179 | ------- |
| 180 | formatted: str |
| 181 | |
| 182 | The formatted Python/TVMScript code |
| 183 | |
| 184 | """ |
| 185 | return _get_formatter(formatter)(code_str) |
| 186 | |
| 187 | |
| 188 | def _get_pygments_style( |
no test coverage detected
searching dependent graphs…