| OLD | NEW | 
|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python | 
| 2 | 2 | 
| 3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. | 
| 4 # | 4 # | 
| 5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be | 
| 6 # found in the LICENSE file. | 6 # found in the LICENSE file. | 
| 7 | 7 | 
| 8 from __future__ import print_function | 8 from __future__ import print_function | 
| 9 from _benchresult import BenchResult | 9 from _benchresult import BenchResult | 
| 10 from argparse import ArgumentParser | 10 from argparse import ArgumentParser | 
| 11 from datetime import datetime | 11 from datetime import datetime | 
| 12 import collections | 12 import collections | 
| 13 import operator | 13 import operator | 
| 14 import os | 14 import os | 
| 15 import sys | 15 import sys | 
| 16 import tempfile | 16 import tempfile | 
| 17 import urllib | 17 import urllib | 
| 18 import urlparse | 18 import urlparse | 
| 19 import webbrowser | 19 import webbrowser | 
| 20 | 20 | 
| 21 __argparse = ArgumentParser(description=''' | 21 __argparse = ArgumentParser(description=""" | 
| 22 | 22 | 
| 23 Parses output files from skpbench.py into csv. | 23 Parses output files from skpbench.py into csv. | 
| 24 | 24 | 
| 25 This script can also be used to generate a Google sheet: | 25 This script can also be used to generate a Google sheet: | 
| 26 | 26 | 
| 27 (1) Install the "Office Editing for Docs, Sheets & Slides" Chrome extension: | 27 (1) Install the "Office Editing for Docs, Sheets & Slides" Chrome extension: | 
| 28     https://chrome.google.com/webstore/detail/office-editing-for-docs-s/gbkeegba
     iigmenfmjfclcdgdpimamgkj | 28     https://chrome.google.com/webstore/detail/office-editing-for-docs-s/gbkeegba
     iigmenfmjfclcdgdpimamgkj | 
| 29 | 29 | 
| 30 (2) Designate Chrome os-wide as the default application for opening .csv files. | 30 (2) Designate Chrome os-wide as the default application for opening .csv files. | 
| 31 | 31 | 
| 32 (3) Run parseskpbench.py with the --open flag. | 32 (3) Run parseskpbench.py with the --open flag. | 
| 33 | 33 | 
| 34 ''') | 34 """) | 
| 35 | 35 | 
| 36 __argparse.add_argument('-r', '--result', | 36 __argparse.add_argument('-r', '--result', | 
| 37     choices=['median', 'accum', 'max', 'min'], default='median', | 37     choices=['median', 'accum', 'max', 'min'], default='median', | 
| 38     help="result to use for cell values") | 38     help="result to use for cell values") | 
| 39 __argparse.add_argument('-f', '--force', | 39 __argparse.add_argument('-f', '--force', | 
| 40     action='store_true', help='silently ignore warnings') | 40     action='store_true', help='silently ignore warnings') | 
| 41 __argparse.add_argument('-o', '--open', | 41 __argparse.add_argument('-o', '--open', | 
| 42     action='store_true', | 42     action='store_true', | 
| 43     help="generate a temp file and open it (theoretically in a web browser)") | 43     help="generate a temp file and open it (theoretically in a web browser)") | 
| 44 __argparse.add_argument('-n', '--name', | 44 __argparse.add_argument('-n', '--name', | 
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 146     pathname = os.path.join(dirname, basename) | 146     pathname = os.path.join(dirname, basename) | 
| 147     with open(pathname, mode='w') as tmpfile: | 147     with open(pathname, mode='w') as tmpfile: | 
| 148       parser.print_csv(outfile=tmpfile) | 148       parser.print_csv(outfile=tmpfile) | 
| 149     fileuri = urlparse.urljoin('file:', urllib.pathname2url(pathname)) | 149     fileuri = urlparse.urljoin('file:', urllib.pathname2url(pathname)) | 
| 150     print('opening %s' % fileuri) | 150     print('opening %s' % fileuri) | 
| 151     webbrowser.open(fileuri) | 151     webbrowser.open(fileuri) | 
| 152 | 152 | 
| 153 | 153 | 
| 154 if __name__ == '__main__': | 154 if __name__ == '__main__': | 
| 155   main() | 155   main() | 
| OLD | NEW | 
|---|