Skip to content

TEXT_VIEW

The TEXT_VIEW node creates a text visualization for a given TextBlob DataContainer type.Inputs ------ default : TextBlob | Boolean The DataContainer to be visualized in text formatParams:prettify : BooleanWhether to prettify the displayed text (defaults to True)Returns:out : TextBlobThe DataContainer containing text data
Python Code
import pprint
from flojoy import flojoy, TextBlob, Boolean


@flojoy
def TEXT_VIEW(default: TextBlob | Boolean, prettify: bool = False) -> TextBlob:
    """The TEXT_VIEW node creates a text visualization for a given TextBlob DataContainer type.

    Inputs
    ------
    default : TextBlob | Boolean
        The DataContainer to be visualized in text format

    Parameters
    ----------
    prettify : Boolean
        Whether to prettify the displayed text (defaults to True)

    Returns
    -------
    TextBlob
        The DataContainer containing text data
    """

    match default:
        case TextBlob():
            s = default.text_blob

            if prettify:
                s = pprint.pformat(default.text_blob)

            return TextBlob(s)
        case Boolean():
            if default.b:
                return TextBlob("True")

            return TextBlob("False")

Find this Flojoy Block on GitHub

Example

Having problems with this example app? Join our Discord community and we will help you out!
React Flow mini map

This example shows the function of the TEXT_VIEW node. It print TEXT_BLOB data type such as from the TEXT node.