Mercurial > ift6266
comparison scripts/stacked_dae/utils.py @ 131:5c79a2557f2f
Un peu de ménage dans code pour stacked DAE, splitté en fichiers dans un nouveau sous-répertoire.
author | savardf |
---|---|
date | Fri, 19 Feb 2010 08:43:10 -0500 |
parents | |
children | 7d8366fb90bf |
comparison
equal
deleted
inserted
replaced
130:38929c29b602 | 131:5c79a2557f2f |
---|---|
1 #!/usr/bin/python | |
2 | |
3 from jobman import DD | |
4 | |
5 def produit_croise_jobs(val_dict): | |
6 job_list = [DD()] | |
7 all_keys = val_dict.keys() | |
8 | |
9 for key in all_keys: | |
10 possible_values = val_dict[key] | |
11 new_job_list = [] | |
12 for val in possible_values: | |
13 for job in job_list: | |
14 to_insert = job.copy() | |
15 to_insert.update({key: val}) | |
16 new_job_list.append(to_insert) | |
17 job_list = new_job_list | |
18 | |
19 return job_list | |
20 | |
21 def test_produit_croise_jobs(): | |
22 vals = {'a': [1,2], 'b': [3,4,5]} | |
23 print produit_croise_jobs(vals) | |
24 | |
25 |