OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 argparse | 5 import argparse |
6 import lib2to3.refactor | 6 import lib2to3.refactor |
7 | 7 |
8 from webkitpy.common.system.systemhost import SystemHost | 8 from webkitpy.common.system.system_host import SystemHost |
9 from webkitpy.thirdparty import autopep8 | 9 from webkitpy.thirdparty import autopep8 |
10 | 10 |
11 | 11 |
12 def parse_args(args=None): | 12 def parse_args(args=None): |
13 parser = argparse.ArgumentParser() | 13 parser = argparse.ArgumentParser() |
14 parser.add_argument('--chromium', action='store_const', dest='style', const=
'chromium', default='blink', | 14 parser.add_argument('--chromium', action='store_const', dest='style', const=
'chromium', default='blink', |
15 help="Format according to Chromium's Python coding style
s instead of Blink's.") | 15 help="Format according to Chromium's Python coding style
s instead of Blink's.") |
16 parser.add_argument('--no-backups', action='store_false', default=True, dest
='backup', | 16 parser.add_argument('--no-backups', action='store_false', default=True, dest
='backup', |
17 help='Do not back up files before overwriting them.') | 17 help='Do not back up files before overwriting them.') |
18 parser.add_argument('-j', '--jobs', metavar='n', type=int, default=0, | 18 parser.add_argument('-j', '--jobs', metavar='n', type=int, default=0, |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 101 |
102 if autopep8_options: | 102 if autopep8_options: |
103 tmp_str = autopep8.fix_code(tmp_str, autopep8_options) | 103 tmp_str = autopep8.fix_code(tmp_str, autopep8_options) |
104 | 104 |
105 if fixers: | 105 if fixers: |
106 tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers, | 106 tool = lib2to3.refactor.RefactoringTool(fixer_names=fixers, |
107 explicit=fixers) | 107 explicit=fixers) |
108 tmp_str = unicode(tool.refactor_string(tmp_str, name=name)) | 108 tmp_str = unicode(tool.refactor_string(tmp_str, name=name)) |
109 | 109 |
110 return tmp_str | 110 return tmp_str |
OLD | NEW |