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

Side by Side Diff: chrome/test/data/autofill/merge/tools/flatten.py

Issue 7892048: Autofill: Remove fax number completely. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix. Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import sys 5 import sys
6 6
7 def main(): 7 def main():
8 """Converts a vertical serialization into a compact, horizontal serialization. 8 """Converts a vertical serialization into a compact, horizontal serialization.
9 9
10 """ 10 """
11 11
12 COLUMNS = ['First name', 'Middle name', 'Last name', 'Email', 'Company name', 12 COLUMNS = ['First name', 'Middle name', 'Last name', 'Email', 'Company name',
13 'Address line 1', 'Address line 2', 'City', 'State', 'ZIP code', 13 'Address line 1', 'Address line 2', 'City', 'State', 'ZIP code',
14 'Country', 'Phone', 'Fax'] 14 'Country', 'Phone']
15 15
16 if len(sys.argv) != 2: 16 if len(sys.argv) != 2:
17 print "Usage: python flatten.py <path/to/serialized_profiles>" 17 print "Usage: python flatten.py <path/to/serialized_profiles>"
18 return 18 return
19 19
20 profiles = [COLUMNS] 20 profiles = [COLUMNS]
21 with open(sys.argv[1], 'r') as serialized_profiles: 21 with open(sys.argv[1], 'r') as serialized_profiles:
22 profile = [] 22 profile = []
23 previous_field_type = '' 23 previous_field_type = ''
24 for line in serialized_profiles: 24 for line in serialized_profiles:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 column_formats = ["{0:<" + str(width) + "}" for width in column_widths] 56 column_formats = ["{0:<" + str(width) + "}" for width in column_widths]
57 57
58 for profile in profiles: 58 for profile in profiles:
59 profile_format = zip(column_formats, profile) 59 profile_format = zip(column_formats, profile)
60 profile = [format_.format(value) for (format_, value) in profile_format] 60 profile = [format_.format(value) for (format_, value) in profile_format]
61 print " | ".join(profile) 61 print " | ".join(profile)
62 62
63 63
64 if __name__ == '__main__': 64 if __name__ == '__main__':
65 main() 65 main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698