def parse_cmdline(entries):
    parameters = {}
    if len(entries) == 0:
        return parameters
    if entries[0] == "-f" and filename_extension in entries[1]:
        path, name = os.path.split(entries[1])
        name = name.replace(filename_extension, '')
        parameters = read_parameter_file(path, name)
        del entries[0:2]
    for entry in entries:
        parts = entry.split('=')
        assert len(parts) == 2, "Incorrect parameter formating for {0}. Use 'key=value'.".format(entry)
        key, value = tuple(parts)
        try:
            value = ast.literal_eval(value)
        except __HOLE__:
            if not (value == "ON" or value == "OFF"):
                raise ValueError, value
        parameters.update({key:value})
    return parameters
dataset/ETHPy150Open laforest/Octavo/Generator/Misc/parameters_misc.py/parse_cmdline