import re


def parse_univariate_file(filename):
    """
    Parse a file containing several univariate samples.

    Input:
    - the file name of a file containing 2 * k lines of this form:
      - line 2 * i: "mu = xxx, sigma = yyy"
      - line 2 * i + 1: zzz samples

    Output:
    - a Python list containing k elements:
      - each element is of the form (mu, sigma, data):
        - mu = expected center of a Gaussian
        - sigma = expected standard deviation of a Gaussian
        - data = samples from a distribution to test against the Gaussian
                 parametrized by (mu, sigma)
    """
    # Initialize the output as the empty list
    data_list = []
    # Open the file
    with open(filename) as f:
        while True:
            line1 = f.readline()
            line2 = f.readline()
            if not line2:
                break  # EOF
            # Parsing mu and sigma
            (_, mu, sigma, _) = re.split("mu = |, sigma = |\n", line1)
            mu = float(mu)
            sigma = float(sigma)
            # Parsing the samples z
            data = re.split(", |,\n", line2)
            data = [int(elt) for elt in data[:-1]]
            # Add the triple (mu, sigma, data) to the output
            data_list += [(mu, sigma, data)]
    return data_list