def write( self, *objects: Any, style: str = None, sep: str = None, end: str = None, stderr: bool = False, force: bool = False, styled: bool = False, file: TextIO = None, ) -> None: import sys from dvc.progress import Tqdm sep = " " if sep is None else sep end = "\n" if end is None else end if not self._enabled and not force: return file = file or (sys.stderr if stderr else sys.stdout) with Tqdm.external_write_mode(file=file): # if we are inside pager context, send the output to rich's buffer if styled or self._paginate.get(): console = self.error_console if stderr else self.rich_console if styled: return console.print(*objects, sep=sep, end=end) return console.out(*objects, sep=sep, end=end, highlight=False) values = (self.formatter.format(obj, style) for obj in objects) return print(*values, sep=sep, end=end, file=file)
def write( self, *objects: Any, style: str = None, sep: str = None, end: str = None, stderr: bool = False, force: bool = False, styled: bool = False, file: TextIO = None, ) -> None: from dvc.progress import Tqdm sep = " " if sep is None else sep end = "\n" if end is None else end if not self._enabled and not force: return file = file or (sys.stderr if stderr else sys.stdout) with Tqdm.external_write_mode(file=file): if styled: console = self.error_console if stderr else self.rich_console return console.print(*objects, sep=sep, end=end) values = (self.formatter.format(obj, style=style) for obj in objects) return print(*values, sep=sep, end=end, file=file)