import json


def parseListFile(listfname:str):
    """Parses the list file
        The list file could be either line list of validators' names OR
        a file with a json array. starts with '['

    Arguments:
        listfname {str} -- [description]
    
    Returns:
        list of validator names
    """
    with open(listfname,'r') as f:
        fcont=f.read()
    fcont=fcont.strip()
    
    if fcont.startswith('['):
        # it's json array
        return json.loads(fcont)
    else:
        # it should be a line list
        flines=fcont.split('\n')
        for l in flines:
            if l.strip().startswith('#'):
                # it's commented out
                flines.remove(l)
        return flines