OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/python | |
2 | |
3 """ | |
4 Copyright 2014 Google Inc. | |
5 | |
6 Use of this source code is governed by a BSD-style license that can be | |
7 found in the LICENSE file. | |
borenet
2014/05/08 12:40:18
I've been copy/pasting the same header, which read
epoger
2014/05/08 15:04:35
The most recent directive I have on what the copyr
| |
8 | |
9 Misc utilities for use throughout rebaseline_server code. | |
10 """ | |
11 | |
12 def unzip_dict(input_dict): | |
13 """Splits a dictionary into two lists (keys and values), such that the indexes | |
14 within the lists can be used to connect key and value. | |
borenet
2014/05/08 12:40:18
It seems like this should be a built-in function.
epoger
2014/05/08 15:04:35
Right, no guarantee of consistent ordering. Also
| |
15 | |
16 For this input: | |
17 {K3:V3, K1:V1, K2:V2} | |
18 | |
19 It would return: | |
20 [K1,K2,K3], [V1,V2,V3] | |
21 """ | |
22 keys = [] | |
23 values = [] | |
24 for key in sorted(input_dict.keys()): | |
25 value = input_dict[key] | |
26 keys.append(key) | |
27 values.append(value) | |
28 return keys, values | |
OLD | NEW |