|
38 | 38 |
|
39 | 39 | exclude_dirs = ['state', 'user-projects', 'doc-src',
|
40 | 40 | 'MiG-certificates', 'seafile']
|
| 41 | + |
| 42 | +# Tweak applied fixers. Details about them can be found at: |
| 43 | +# https://docs.python.org/2/library/2to3.html |
41 | 44 | # The import fix breaks our relative imports so disable for now
|
42 | 45 | disable_import_fix = True
|
| 46 | +# Whether to enable additional pythonic style and comma whitespace fixes |
| 47 | +enable_idioms = True |
| 48 | +enable_comma_whitespace = True |
43 | 49 |
|
44 | 50 | if __name__ == '__main__':
|
45 | 51 | if len(sys.argv) < 2:
|
|
54 | 60 | print('Modernizing python code in %s' % target)
|
55 | 61 | print('--- ignoring all %s dirs ---' % ', '.join(exclude_dirs))
|
56 | 62 | mime_helper = mimetypes.MimeTypes()
|
57 |
| - modernize_base = ['python-modernize', '-n', '-w'] |
| 63 | + modernize_base = ['python-modernize', '-n', '-w', '-f', 'default'] |
| 64 | + if enable_idioms: |
| 65 | + modernize_base += ['-f', 'idioms'] |
| 66 | + if enable_comma_whitespace: |
| 67 | + modernize_base += ['-f', 'ws_comma'] |
58 | 68 | if disable_import_fix:
|
59 | 69 | modernize_base += ['-x', 'import']
|
| 70 | + |
60 | 71 | # NOTE: fix import lines broken by modernize and leave Copyright line alone
|
61 | 72 | sed_rules = ['s/from .shared/from shared/g',
|
62 | 73 | 's/from . import /import /g']
|
|
0 commit comments