Skip to content

Commit f0cde36

Browse files
Siyuan Fengjunrushao
authored andcommitted
[TVMScript] Disable black_format by default (apache#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 1213a57 commit f0cde36

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
@@ -261,7 +261,7 @@ def _relax_script(
261261
def show(
262262
self,
263263
style: Optional[str] = None,
264-
black_format: bool = True,
264+
black_format: bool = False,
265265
*,
266266
name: Optional[str] = None,
267267
show_meta: bool = False,
@@ -291,7 +291,7 @@ def show(
291291
Pygmentize printing style, auto-detected if None. See
292292
`tvm.script.highlight.cprint` for more details.
293293
black_format: bool
294-
If true (default), use the formatter Black to format the TVMScript
294+
If true, use the formatter Black to format the TVMScript
295295
name : Optional[str] = None
296296
The name of the object
297297
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)