Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1100)

Side by Side Diff: gm/rebaseline_server/utils.py

Issue 270413002: rebaseline_server JSON: pass category values as values, not keys (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698