Mercurial > ift6266
view scripts/stacked_dae/utils.py @ 134:4981c729149c
Fixed various bugs in pipeline for Python 2.5 support
author | boulanni <nicolas_boulanger@hotmail.com> |
---|---|
date | Sat, 20 Feb 2010 02:09:09 -0500 |
parents | 5c79a2557f2f |
children | 7d8366fb90bf |
line wrap: on
line source
#!/usr/bin/python from jobman import DD def produit_croise_jobs(val_dict): job_list = [DD()] all_keys = val_dict.keys() for key in all_keys: possible_values = val_dict[key] new_job_list = [] for val in possible_values: for job in job_list: to_insert = job.copy() to_insert.update({key: val}) new_job_list.append(to_insert) job_list = new_job_list return job_list def test_produit_croise_jobs(): vals = {'a': [1,2], 'b': [3,4,5]} print produit_croise_jobs(vals)