Repository: streamlit/streamlit
File: lib/streamlit/elements/lib/layout_utils.py (Python)

Code before:
    elif gap is None:
        return GapSize.NONE

    raise StreamlitInvalidColumnGapError(gap=gap, element_type=element_type)


def validate_horizontal_alignment(horizontal_alignment: HorizontalAlignment) -> None:
    valid_horizontal_alignments = ["left", "center", "right", "distribute"]
    if horizontal_alignment not in valid_horizontal_alignments:
        raise StreamlitInvalidHorizontalAlignmentError(
            horizontal_alignment, "st.container"
        )


def validate_vertical_alignment(vertical_alignment: VerticalAlignment) -> None:
    valid_vertical_alignments = ["top", "center", "bottom", "distribute"]
    if vertical_alignment not in valid_vertical_alignments:
        raise StreamlitInvalidVerticalAlignmentError(vertical_alignment, "st.container")


def validate_text_alignment(text_alignment: TextAlignment) -> None:
    """Validate the text_alignment parameter.

    Parameters
    ----------
    text_alignment : Any
        The text alignment value to validate.

    Raises
    ------
    StreamlitInvalidTextAlignmentError
        If the text_alignment value is invalid.
    """
    valid_alignments = ["left", "center", "right", "justify"]
    if text_alignment not in valid_alignments:
        raise StreamlitInvalidTextAlignmentError(text_alignment)


map_to_flex_terminology = {
    "left": "start",
    "center": "center",
    "right": "end",
    "top": "start",
    "bottom": "end",
    "distribute": "space_between",
}


def get_justify(
    alignment: HorizontalAlignment | VerticalAlignment,
) -> Block.FlexContainer.Justify.ValueType:

Review comment (suggestion):
**question:** Is `Any` the correct type here? I would have expected `TextAlignment` given the function signature.

Code after:
    elif gap is None:
        return GapSize.NONE

    raise StreamlitInvalidColumnGapError(gap=gap, element_type=element_type)


def validate_horizontal_alignment(horizontal_alignment: HorizontalAlignment) -> None:
    valid_horizontal_alignments = ["left", "center", "right", "distribute"]
    if horizontal_alignment not in valid_horizontal_alignments:
        raise StreamlitInvalidHorizontalAlignmentError(
            horizontal_alignment, "st.container"
        )


def validate_vertical_alignment(vertical_alignment: VerticalAlignment) -> None:
    valid_vertical_alignments = ["top", "center", "bottom", "distribute"]
    if vertical_alignment not in valid_vertical_alignments:
        raise StreamlitInvalidVerticalAlignmentError(vertical_alignment, "st.container")


def validate_text_alignment(text_alignment: TextAlignment) -> None:
    """Validate the text_alignment parameter.

    Parameters
    ----------
    text_alignment : TextAlignment
        The text alignment value to validate.

    Raises
    ------
    StreamlitInvalidTextAlignmentError
        If the text_alignment value is invalid.
    """
    valid_alignments = ["left", "center", "right", "justify"]
    if text_alignment not in valid_alignments:
        raise StreamlitInvalidTextAlignmentError(text_alignment)


map_to_flex_terminology = {
    "left": "start",
    "center": "center",
    "right": "end",
    "top": "start",
    "bottom": "end",
    "distribute": "space_between",
}


def get_justify(
    alignment: HorizontalAlignment | VerticalAlignment,
) -> Block.FlexContainer.Justify.ValueType: