Skip to content

Commit

Permalink
ui: import sys on write_json
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Sep 29, 2021
1 parent fed9f08 commit 3f5f983
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dvc/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def write_json(
data: Any,
indent: int = 2,
) -> None:
if sys.stdout.isatty():
if self.isatty():
from rich.json import JSON

j = JSON.from_data(data, indent=indent)
Expand Down Expand Up @@ -237,6 +237,11 @@ def table(
def status(self, status: str, **kwargs: Any) -> "Status":
return self.error_console.status(status, **kwargs)

def isatty(self) -> bool:
import sys

return sys.stdout.isatty()


ui = Console()

Expand Down

0 comments on commit 3f5f983

Please sign in to comment.