import re


def _parse_list_of_antpols(input_str):
    """
    Parse a text string as a list of antpols.

    Note
    ----
    This function assumes polarizations are only x or y.

    Parameters
    ----------
    input_str : str
        The input string to be processed.

    Returns
    -------
    li : list
        The parsed list of antpols.
    """
    # use regex to extract entries
    # assumes list entries are antpols
    list_regex = r"(\([0-9]*?, \'[xyne]\'\))"
    entries = re.findall(list_regex, input_str)

    # initialize output
    li = []
    for entry in entries:
        ant, pol = entry[1:-1].split(",")
        pol = pol[-2]
        li.append(tuple((int(ant), str(pol))))

    return li