mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 15:28:28 +01:00
ui: import sys on write_json
This commit is contained in:
+6
-1
@@ -87,7 +87,7 @@ class Console:
|
||||
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)
|
||||
@@ -237,6 +237,11 @@ class Console:
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user