File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -205,7 +205,27 @@ def main(args=None):
205205 print ("Use --help to show usage." , file = sys .stderr )
206206 return 2
207207
208- unwanted_fixes = set (fixer_pkg + ".fix_" + fix for fix in options .nofix )
208+ unwanted_fixes = set ()
209+ for fix in options .nofix :
210+ if ".fix_" in fix :
211+ unwanted_fixes .add (fix )
212+ else :
213+ # Infer the full module name for the fixer.
214+ # First ensure that no names clash (e.g.
215+ # lib2to3.fixes.fix_blah and libfuturize.fixes.fix_blah):
216+ found = [f for f in avail_fixes
217+ if f .endswith ('fix_{0}' .format (fix ))]
218+ if len (found ) > 1 :
219+ print ("Ambiguous fixer name. Choose a fully qualified "
220+ "module name instead from these:\n " +
221+ "\n " .join (" " + myf for myf in found ),
222+ file = sys .stderr )
223+ return 2
224+ elif len (found ) == 0 :
225+ print ("Unknown fixer. Use --list-fixes or -l for a list." ,
226+ file = sys .stderr )
227+ return 2
228+ unwanted_fixes .add (found [0 ])
209229
210230 extra_fixes = set ()
211231 if options .all_imports :
You can’t perform that action at this time.
0 commit comments