PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/out.py

"""
Output Module
=============

.. versionadded:: 2018.3.0

Execution module that processes JSON serializable data
and returns string having the format as processed by the outputters.

Although this does not bring much value on the CLI, it turns very handy
in applications that require human readable data rather than Python objects.

For example, inside a Jinja template:

.. code-block:: jinja

    {{ salt.out.string_format(complex_object, out='highstate') }}
"""

import logging

# Import salt modules
import salt.output

log = logging.getLogger(__name__)


__virtualname__ = "out"
__proxyenabled__ = ["*"]


def __virtual__():
    return __virtualname__


def out_format(data, out="nested", opts=None, **kwargs):
    """
    Return the formatted outputter string for the Python object.

    data
        The JSON serializable object.

    out: ``nested``
        The name of the output to use to transform the data. Default: ``nested``.

    opts
        Dictionary of configuration options. Default: ``__opts__``.

    kwargs
        Arguments to sent to the outputter module.

    CLI Example:

    .. code-block:: bash

        salt '*' out.out_format "{'key': 'value'}"
    """
    if not opts:
        opts = __opts__
    return salt.output.out_format(data, out, opts=opts, **kwargs)


def string_format(data, out="nested", opts=None, **kwargs):
    """
    Return the outputter formatted string, removing the ANSI escape sequences.

    data
        The JSON serializable object.

    out: ``nested``
        The name of the output to use to transform the data. Default: ``nested``.

    opts
        Dictionary of configuration options. Default: ``__opts__``.

    kwargs
        Arguments to sent to the outputter module.

    CLI Example:

    .. code-block:: bash

        salt '*' out.string_format "{'key': 'value'}" out=table
    """
    if not opts:
        opts = __opts__
    return salt.output.string_format(data, out, opts=opts, **kwargs)


def html_format(data, out="nested", opts=None, **kwargs):
    """
    Return the formatted string as HTML.

    data
        The JSON serializable object.

    out: ``nested``
        The name of the output to use to transform the data. Default: ``nested``.

    opts
        Dictionary of configuration options. Default: ``__opts__``.

    kwargs
        Arguments to sent to the outputter module.

    CLI Example:

    .. code-block:: bash

        salt '*' out.html_format "{'key': 'value'}" out=yaml
    """
    if not opts:
        opts = __opts__
    return salt.output.html_format(data, out, opts=opts, **kwargs)