MCPcopy
hub / github.com/pallets/click / should_strip_ansi

Function should_strip_ansi

src/click/_compat.py:499–510  ·  view source on GitHub ↗
(
    stream: t.IO[t.Any] | None = None, color: bool | None = None
)

Source from the content-addressed store, hash-verified

497
498
499def should_strip_ansi(
500 stream: t.IO[t.Any] | None = None, color: bool | None = None
501) -> bool:
502 if color is None:
503 if stream is None:
504 stream = sys.stdin
505 elif hasattr(stream, "color"):
506 # ._termui_impl.MaybeStripAnsi handles stripping ansi itself,
507 # so we don't need to strip it here
508 return False
509 return not isatty(stream) and not _is_jupyter_kernel_output(stream)
510 return not color
511
512
513# On Windows, wrap the output streams with colorama to support ANSI

Callers 2

echoFunction · 0.85
auto_wrap_for_ansiFunction · 0.85

Calls 2

isattyFunction · 0.85

Tested by

no test coverage detected