Skip to content

Commit 7322769

Browse files
author
Siyuan Feng
authored
[TVMScript] Disable black_format by default (#15706)
`Black` is a popular code formatter for Python. However, it is not suitable for TVM script. This PR tries to disable it by default.
1 parent ff45cfb commit 7322769

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

python/tvm/runtime/script_printer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ def script(
199199
def show(
200200
self,
201201
style: Optional[str] = None,
202-
black_format: bool = True,
202+
black_format: bool = False,
203203
*,
204204
name: Optional[str] = None,
205205
show_meta: bool = False,
@@ -227,7 +227,7 @@ def show(
227227
Pygmentize printing style, auto-detected if None. See
228228
`tvm.script.highlight.cprint` for more details.
229229
black_format: bool
230-
If true (default), use the formatter Black to format the TVMScript
230+
If true, use the formatter Black to format the TVMScript
231231
name : Optional[str] = None
232232
The name of the object
233233
show_meta : bool = False

python/tvm/script/highlight.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def cprint(
2727
printable: Union[Any, str],
2828
style: Optional[str] = None,
29-
black_format: bool = True,
29+
black_format: bool = False,
3030
) -> None:
3131
"""Print TVMScript string with Pygments highlight and Black auto-formatting.
3232
@@ -42,7 +42,7 @@ def cprint(
4242
4343
black_format: bool
4444
45-
If true (default), use the formatter Black to format the TVMScript
45+
If true, use the formatter Black to format the TVMScript
4646
4747
Notes
4848
-----

python/tvm/tir/schedule/schedule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def fork_seed(self) -> int:
268268
"""
269269
return _ffi_api.ScheduleForkSeed(self) # type: ignore # pylint: disable=no-member
270270

271-
def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
271+
def show(self, style: Optional[str] = None, black_format: bool = False) -> None:
272272
"""A sugar for print highlighted TVM script.
273273
274274
Parameters
@@ -280,7 +280,7 @@ def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
280280
281281
black_format: bool
282282
283-
If true (default), use the formatter Black to format the TVMScript
283+
If true, use the formatter Black to format the TVMScript
284284
"""
285285
mod = self.mod
286286
if mod is not None:

python/tvm/tir/schedule/trace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def apply_json_to_schedule(json_obj: JSON_TYPE, sch: "Schedule") -> None:
262262
"""
263263
_ffi_api.TraceApplyJSONToSchedule(json_obj, sch) # type: ignore # pylint: disable=no-member
264264

265-
def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
265+
def show(self, style: Optional[str] = None, black_format: bool = False) -> None:
266266
"""A sugar for print highlighted TVM script.
267267
268268
Parameters
@@ -274,7 +274,7 @@ def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
274274
275275
black_format: bool
276276
277-
If true (default), use the formatter Black to format the TVMScript
277+
If true, use the formatter Black to format the TVMScript
278278
"""
279279
from tvm.script.highlight import ( # pylint: disable=import-outside-toplevel
280280
cprint,

0 commit comments

Comments
 (0)