virtual/lib/python3.9/site-packages/click/utils.py
def echo(message=None, file=None, nl=True, err=False, color=None):
    """Prints a message plus a newline to the given file or stdout.  On
    first sight, this looks like the print function, but it has improved
    support for handling Unicode and binary data that does not fail no
    matter how badly configured the system is.

    Primarily it means that you can print binary data as well as Unicode
    data on both 2.x and 3.x to the given file in the most appropriate way
    possible.  This is a very carefree function as in that it will try its
    best to not fail.

    In addition to that, if `colorama`_ is installed, the echo function will
    also support clever handling of ANSI codes.  Essentially it will then
    do the following:

    -   add transparent handling of ANSI color codes on Windows.
    -   hide ANSI codes automatically if the destination file is not a
        terminal.

    .. _colorama: http://pypi.python.org/pypi/colorama

    .. versionchanged:: 2.0
       Starting with version 2.0 of Click, the echo function will work
       with colorama if it's installed.

    .. versionadded:: 3.0
       The `err` parameter was added.

    .. versionchanged:: 4.0
       Added the `color` flag.

    :param message: the message to print
    :param file: the file to write to (defaults to ``stdout``)
    :param err: if set to true the file defaults to ``stderr`` instead of
                ``stdout``.  This is faster and easier than calling
                :func:`get_text_stderr` yourself.
    :param nl: if set to `True` (the default) a newline is printed afterwards.
    :param color: controls if the terminal supports ANSI colors or not.  The
                  default is autodetection.
    """
    if file is None:
        if err:
            file = _default_text_stderr()
        else:
            file = _default_text_stdout()

    # Convert non bytes/text into the native string type.
    if message is not None and not isinstance(message, echo_native_types):
        message = text_type(message)

    if nl:
        message = message or u''
        if isinstance(message, text_type):
            message += u'\n'
        else:
            message += b'\n'

    # If there is a message, and we're in Python 3, and the value looks
    # like bytes, we manually need to find the binary stream and write the
    # message in there.  This is done separately so that most stream
    # types will work as you would expect.  Eg: you can write to StringIO
    # for other cases.
    if message and not PY2 and is_bytes(message):
        binary_file = _find_binary_writer(file)
        if binary_file is not None:
            file.flush()
            binary_file.write(message)
            binary_file.flush()
            return

    # ANSI-style support.  If there is no message or we are dealing with
    # bytes nothing is happening.  If we are connected to a file we want
    # to strip colors.  If we are on windows we either wrap the stream
    # to strip the color or we use the colorama support to translate the
    # ansi codes to API calls.
    if message and not is_bytes(message):
        color = resolve_color_default(color)
        if should_strip_ansi(file, color):
            message = strip_ansi(message)
        elif WIN:
            if auto_wrap_for_ansi is not None:
                file = auto_wrap_for_ansi(file)
            elif not color:
                message = strip_ansi(message)

    if message:
        file.write(message)
    file.flush()
Prints a message plus a newline to the given file or stdout.  On
    first sight, this looks like the print function, but it has improved
    support for handling Unicode and binary data that does not fail no
    matter how badly configured the system is.

    Primarily it means that you can print binary data as well as Unicode
    data on both 2.x and 3.x to the given file in the most appropriate way
    possible.  This is a very carefree function as in that it will try its
    best to not fail.

    In addition to that, if `colorama`_ is installed, the echo function will
    also support clever handling of ANSI codes.  Essentially it will then
    do the following:

    -   add transparent handling of ANSI color codes on Windows.
    -   hide ANSI codes automatically if the destination file is not a
        terminal.

    .. _colorama: http://pypi.python.org/pypi/colorama

    .. versionchanged:: 2.0
       Starting with version 2.0 of Click, the echo function will work
       with colorama if it's installed.

    .. versionadded:: 3.0
       The `err` parameter was added.

    .. versionchanged:: 4.0
       Added the `color` flag.

    :param message: the message to print
    :param file: the file to write to (defaults to ``stdout``)
    :param err: if set to true the file defaults to ``stderr`` instead of
                ``stdout``.  This is faster and easier than calling
                :func:`get_text_stderr` yourself.
    :param nl: if set to `True` (the default) a newline is printed afterwards.
    :param color: controls if the terminal supports ANSI colors or not.  The
                  default is autodetection.
    
Prints a message plus a newline to the given file or stdout.  On
first sight, this looks like the print function, but it has improved
support for handling Unicode and binary data that does not fail no
matter how badly configured the system is.

Primarily it means that you can print binary data as well as Unicode
data on both 2.x and 3.x to the given file in the most appropriate way
possible.  This is a very carefree function as in that it will try its
best to not fail.

In addition to that, if `colorama`_ is installed, the echo function will
also support clever handling of ANSI codes.  Essentially it will then
do the following.

add transparent handling of ANSI color codes on Windows.
hide ANSI codes automatically if the destination file is not a
terminal.



: 2.0
Starting with version 2.0 of Click, the echo function will work
with colorama if it's installed.

: 3.0
The `err` parameter was added.

: 4.0
Added the `color` flag.
Prints a message plus a newline to the given file or stdout . On first sight this looks like the print function but it has improved support for handling Unicode and binary data that does not fail no matter how badly configured the system is . Primarily it means that you can print binary data as well as Unicode data on both 2 . x and 3 . x to the given file in the most appropriate way possible . This is a very carefree function as in that it will try its best to not fail . In addition to that if ` colorama ` _ is installed the echo function will also support clever handling of ANSI codes . Essentially it will then do the following . add transparent handling of ANSI color codes on Windows . hide ANSI codes automatically if the destination file is not a terminal . : 2 . 0 Starting with version 2 . 0 of Click the echo function will work with colorama if it ' s installed . : 3 . 0 The ` err ` parameter was added . : 4 . 0 Added the ` color ` flag .
def echo(message=None, file=None, nl=True, err=False, color=None):
    if file is None:
        if err:
            file = _default_text_stderr()
        else:
            file = _default_text_stdout()
    if message is not None and not isinstance(message, echo_native_types):
        message = text_type(message)
    if nl:
        message = message or u''
        if isinstance(message, text_type):
            message += u'\n'
        else:
            message += b'\n'
    if message and not PY2 and is_bytes(message):
        binary_file = _find_binary_writer(file)
        if binary_file is not None:
            file.flush()
            binary_file.write(message)
            binary_file.flush()
            return
    if message and not is_bytes(message):
        color = resolve_color_default(color)
        if should_strip_ansi(file, color):
            message = strip_ansi(message)
        elif WIN:
            if auto_wrap_for_ansi is not None:
                file = auto_wrap_for_ansi(file)
            elif not color:
                message = strip_ansi(message)
    if message:
        file.write(message)
    file.flush()
def echo ( message = None , file = None , nl = True , err = False , color = None ) : if file is None : if err : file = _default_text_stderr ( ) else : file = _default_text_stdout ( ) if message is not None and not isinstance ( message , echo_native_types ) : message = text_type ( message ) if nl : message = message or u'' if isinstance ( message , text_type ) : message += u'\n' else : message += b'\n' if message and not PY2 and is_bytes ( message ) : binary_file = _find_binary_writer ( file ) if binary_file is not None : file . flush ( ) binary_file . write ( message ) binary_file . flush ( ) return if message and not is_bytes ( message ) : color = resolve_color_default ( color ) if should_strip_ansi ( file , color ) : message = strip_ansi ( message ) elif WIN : if auto_wrap_for_ansi is not None : file = auto_wrap_for_ansi ( file ) elif not color : message = strip_ansi ( message ) if message : file . write ( message ) file . flush ( )
Prints a message plus a newline to the given file or stdout.
Prints a message plus a newline to the given file or stdout .
"""Prints a message plus a newline to the given file or stdout.  On
    first sight, this looks like the print function, but it has improved
    support for handling Unicode and binary data that does not fail no
    matter how badly configured the system is.

    Primarily it means that you can print binary data as well as Unicode
    data on both 2.x and 3.x to the given file in the most appropriate way
    possible.  This is a very carefree function as in that it will try its
    best to not fail.

    In addition to that, if `colorama`_ is installed, the echo function will
    also support clever handling of ANSI codes.  Essentially it will then
    do the following:

    -   add transparent handling of ANSI color codes on Windows.
    -   hide ANSI codes automatically if the destination file is not a
        terminal.

    .. _colorama: http://pypi.python.org/pypi/colorama

    .. versionchanged:: 2.0
       Starting with version 2.0 of Click, the echo function will work
       with colorama if it's installed.

    .. versionadded:: 3.0
       The `err` parameter was added.

    .. versionchanged:: 4.0
       Added the `color` flag.

    :param message: the message to print
    :param file: the file to write to (defaults to ``stdout``)
    :param err: if set to true the file defaults to ``stderr`` instead of
                ``stdout``.  This is faster and easier than calling
                :func:`get_text_stderr` yourself.
    :param nl: if set to `True` (the default) a newline is printed afterwards.
    :param color: controls if the terminal supports ANSI colors or not.  The
                  default is autodetection.
    """ # Convert non bytes/text into the native string type. # If there is a message, and we're in Python 3, and the value looks # like bytes, we manually need to find the binary stream and write the # message in there.  This is done separately so that most stream # types will work as you would expect.  Eg: you can write to StringIO # for other cases. # ANSI-style support.  If there is no message or we are dealing with # bytes nothing is happening.  If we are connected to a file we want # to strip colors.  If we are on windows we either wrap the stream # to strip the color or we use the colorama support to translate the # ansi codes to API calls.
message
the message to print
the message to print
file
None
``stdout``)
nl
if set to `True` (the default) a newline is printed afterwards.
if set to ` True ` ( the default ) a newline is printed afterwards .
err
if set to true the file defaults to ``stderr`` instead of
``stdout``.  This is faster and easier than calling
:func:`get_text_stderr` yourself.
if set to true the file defaults to ` ` stderr ` ` instead of ` ` stdout ` ` . This is faster and easier than calling : func : ` get_text_stderr ` yourself .
``stderr`` instead of
``stdout``.  This is faster and easier than calling
:func:`get_text_stderr` yourself
color
controls if the terminal supports ANSI colors or not.  The
default is autodetection.
controls if the terminal supports ANSI colors or not . The default is autodetection .