()
| 126 | return formatter |
| 127 | |
| 128 | def get_fallback_formatter(): |
| 129 | def formatter(code_str): |
| 130 | with warnings.catch_warnings(): |
| 131 | warnings.simplefilter("once", UserWarning) |
| 132 | ruff_install_cmd = sys.executable + " -m pip install ruff" |
| 133 | black_install_cmd = ( |
| 134 | sys.executable + ' -m pip install "black==22.3.0" --upgrade --user' |
| 135 | ) |
| 136 | warnings.warn( |
| 137 | f"Neither the 'ruff' formatter nor the 'black' formatter is available. " |
| 138 | f"To print formatted TVM script, please a formatter. \n" |
| 139 | f"To install ruff: {ruff_install_cmd}\n" |
| 140 | f"To install black: {black_install_cmd}", |
| 141 | category=UserWarning, |
| 142 | ) |
| 143 | return code_str |
| 144 | |
| 145 | return formatter |
| 146 | |
| 147 | # formatter = "black" |
| 148 | if formatter is None: |
no outgoing calls
no test coverage detected
searching dependent graphs…