MCPcopy
hub / github.com/treeverse/dvc / write

Method write

dvc/ui/__init__.py:178–219  ·  view source on GitHub ↗
(
        self,
        *objects: Any,
        style: Optional[str] = None,
        sep: Optional[str] = None,
        end: Optional[str] = None,
        stderr: bool = False,
        force: bool = False,
        styled: bool = False,
        file: Optional[TextIO] = None,
    )

Source from the content-addressed store, hash-verified

176 )
177
178 def write(
179 self,
180 *objects: Any,
181 style: Optional[str] = None,
182 sep: Optional[str] = None,
183 end: Optional[str] = None,
184 stderr: bool = False,
185 force: bool = False,
186 styled: bool = False,
187 file: Optional[TextIO] = None,
188 ) -> None:
189 import sys
190
191 from dvc.progress import Tqdm
192
193 sep = " " if sep is None else sep
194 end = "\n" if end is None else end
195 if not self._enabled and not force:
196 return None
197
198 file = file or (sys.stderr if stderr else sys.stdout)
199 with Tqdm.external_write_mode(file=file):
200 # if we are inside pager context, send the output to rich's buffer
201 if styled or self._paginate.get():
202 if styled:
203 return self.rich_print(*objects, sep=sep, end=end, stderr=stderr)
204 return self.rich_print(
205 sep.join(str(_object) for _object in objects),
206 style=None,
207 highlight=False,
208 emoji=False,
209 markup=False,
210 no_wrap=True,
211 overflow="ignore",
212 crop=False,
213 sep=sep,
214 end=end,
215 stderr=stderr,
216 )
217
218 values = (self.formatter.format(obj, style) for obj in objects)
219 return print(*values, sep=sep, end=end, file=file)
220
221 @property
222 def rich_text(self) -> "type[RichText]":

Callers 15

successMethod · 0.95
error_writeMethod · 0.95
write_jsonMethod · 0.95
promptMethod · 0.95
test_writeFunction · 0.95
_save_configMethod · 0.80
emitMethod · 0.80
renderMethod · 0.80
initFunction · 0.80
migrate_2_to_3Function · 0.80
_dumpFunction · 0.80

Calls 4

rich_printMethod · 0.95
joinMethod · 0.80
getMethod · 0.45
formatMethod · 0.45