import logging


def _check_hhparams(paramlist):
    """Return a list with the validated HHBLITS input arguments.

    :param paramlist: User-provided list of HHBLITS arguments.
    :type paramlist: list of str
    :raises ValueError: Arguments are not valid.
    :return: Complete and checked list of HHBLITS parameters
    :rtype: list of (int, float, str)
    """
    if (paramlist == 'dmp' or paramlist == [3, 0.001, 'inf', 50, 99] or
            paramlist == ['3', '0.001', 'inf', '50', '99']):
        outparams = ['3', '0.001', 'inf', '50', '99']
    elif (paramlist == 'hhblits' or paramlist == [2, 0.001, 1000, 0, 90] or
          paramlist == ['2', '0.001', '1000', '0', '90']):
        outparams = ['2', '0.001', '1000', '0', '90']
    else:
        try:
            int(float(paramlist[0]))
            float(paramlist[1])
            if paramlist[2] != 'inf':
                int(float(paramlist[2]))
            float(paramlist[4])
            float(paramlist[5])
        except Exception:
            logging.critical('One or more of HHblits arguments given are not valid')
            raise ValueError

        outparams=[str(int(float(paramlist[0]))), str(float(paramlist[1])),
            paramlist[2], str(float(paramlist[4])), str(float(paramlist[5]))]
        if paramlist[2] != 'inf':
            outparams = str(int(float(paramlist[2])))

    return outparams