Skip to content

Commit

Permalink
[TVMScript] Disable black_format by default (apache#15706)
Browse files Browse the repository at this point in the history
`Black` is a popular code formatter for Python. However, it is not
suitable for TVM script. This PR tries to disable it by default.
  • Loading branch information
Hzfengsy authored and junrushao committed Sep 10, 2023
1 parent 1213a57 commit f0cde36
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions python/tvm/runtime/script_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def _relax_script(
def show(
self,
style: Optional[str] = None,
black_format: bool = True,
black_format: bool = False,
*,
name: Optional[str] = None,
show_meta: bool = False,
Expand Down Expand Up @@ -291,7 +291,7 @@ def show(
Pygmentize printing style, auto-detected if None. See
`tvm.script.highlight.cprint` for more details.
black_format: bool
If true (default), use the formatter Black to format the TVMScript
If true, use the formatter Black to format the TVMScript
name : Optional[str] = None
The name of the object
show_meta : bool = False
Expand Down
4 changes: 2 additions & 2 deletions python/tvm/script/highlight.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
def cprint(
printable: Union[Any, str],
style: Optional[str] = None,
black_format: bool = True,
black_format: bool = False,
) -> None:
"""Print TVMScript string with Pygments highlight and Black auto-formatting.
Expand All @@ -42,7 +42,7 @@ def cprint(
black_format: bool
If true (default), use the formatter Black to format the TVMScript
If true, use the formatter Black to format the TVMScript
Notes
-----
Expand Down
4 changes: 2 additions & 2 deletions python/tvm/tir/schedule/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def fork_seed(self) -> int:
"""
return _ffi_api.ScheduleForkSeed(self) # type: ignore # pylint: disable=no-member

def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
def show(self, style: Optional[str] = None, black_format: bool = False) -> None:
"""A sugar for print highlighted TVM script.
Parameters
Expand All @@ -280,7 +280,7 @@ def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
black_format: bool
If true (default), use the formatter Black to format the TVMScript
If true, use the formatter Black to format the TVMScript
"""
mod = self.mod
if mod is not None:
Expand Down
4 changes: 2 additions & 2 deletions python/tvm/tir/schedule/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def apply_json_to_schedule(json_obj: JSON_TYPE, sch: "Schedule") -> None:
"""
_ffi_api.TraceApplyJSONToSchedule(json_obj, sch) # type: ignore # pylint: disable=no-member

def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
def show(self, style: Optional[str] = None, black_format: bool = False) -> None:
"""A sugar for print highlighted TVM script.
Parameters
Expand All @@ -274,7 +274,7 @@ def show(self, style: Optional[str] = None, black_format: bool = True) -> None:
black_format: bool
If true (default), use the formatter Black to format the TVMScript
If true, use the formatter Black to format the TVMScript
"""
from tvm.script.highlight import ( # pylint: disable=import-outside-toplevel
cprint,
Expand Down

0 comments on commit f0cde36

Please sign in to comment.