MCPcopy Create free account
hub / github.com/unslothai/unsloth / _step

Function _step

studio/install_python_stack.py:1602–1634  ·  view source on GitHub ↗

Print a single step line in the column format.

(
    label: str,
    value: str,
    color_fn = None,
)

Source from the content-addressed store, hash-verified

1600
1601
1602def _step(
1603 label: str,
1604 value: str,
1605 color_fn = None,
1606) -> None:
1607 """Print a single step line in the column format."""
1608 global _PROGRESS_LINE_ACTIVE
1609 if color_fn is None:
1610 color_fn = _green
1611 padded = label[:_COL]
1612 plain_prefix_width = _INDENT + _COL
1613 prefix = f"{' ' * _INDENT}{_dim(padded)}{' ' * (_COL - len(padded))}"
1614 wrap_width = max(
1615 24,
1616 shutil.get_terminal_size((100, 20)).columns - plain_prefix_width,
1617 )
1618 lines = textwrap.wrap(
1619 value,
1620 width = wrap_width,
1621 break_long_words = False,
1622 break_on_hyphens = False,
1623 ) or [""]
1624 if _PROGRESS_LINE_ACTIVE and not VERBOSE:
1625 try:
1626 sys.stdout.write("\n")
1627 sys.stdout.flush()
1628 except OSError:
1629 pass
1630 _PROGRESS_LINE_ACTIVE = False
1631 _safe_print(f"{prefix}{color_fn(lines[0])}")
1632 continuation_prefix = " " * plain_prefix_width
1633 for line in lines[1:]:
1634 _safe_print(f"{continuation_prefix}{color_fn(line)}")
1635
1636
1637def _progress(label: str) -> None:

Callers 6

runFunction · 0.85
_ensure_flash_attnFunction · 0.85
pip_install_tryFunction · 0.85
patch_package_fileFunction · 0.85
install_python_stackFunction · 0.85

Calls 4

_dimFunction · 0.85
_safe_printFunction · 0.70
writeMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…