Skip to content

Commit 4ae6035

Browse files
committed
more tweaks for applied fixers
git-svn-id: svn+ssh://svn.code.sf.net/p/migrid/code/trunk@4869 b75ad72c-e7d7-11dd-a971-7dbc132099af
1 parent bad625d commit 4ae6035

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

modernizeall.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@
3838

3939
exclude_dirs = ['state', 'user-projects', 'doc-src',
4040
'MiG-certificates', 'seafile']
41+
42+
# Tweak applied fixers. Details about them can be found at:
43+
# https://docs.python.org/2/library/2to3.html
4144
# The import fix breaks our relative imports so disable for now
4245
disable_import_fix = True
46+
# Whether to enable additional pythonic style and comma whitespace fixes
47+
enable_idioms = True
48+
enable_comma_whitespace = True
4349

4450
if __name__ == '__main__':
4551
if len(sys.argv) < 2:
@@ -54,9 +60,14 @@
5460
print('Modernizing python code in %s' % target)
5561
print('--- ignoring all %s dirs ---' % ', '.join(exclude_dirs))
5662
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']
5868
if disable_import_fix:
5969
modernize_base += ['-x', 'import']
70+
6071
# NOTE: fix import lines broken by modernize and leave Copyright line alone
6172
sed_rules = ['s/from .shared/from shared/g',
6273
's/from . import /import /g']

0 commit comments

Comments
 (0)