I’ve committed the first bit of a rewrite for fix_imports and fix_imports2. Short description: the plan is to use the 2to3 pattern matcher instead of a custom hack to improve speed, correctness, and simplicity.
Long description:
fix_imports2 literally scans the tree before anything happens, collecting relevant NAME leaves into a dict mapping top-level modules (e.g., urllib) to them.
fix_imports is another great example of bad code if anyone was looking for one.
I haven’t had the large chunk of time that it would take to do a rewrite until now. Hoping I can get it done by the end of Thanksgiving break, though that’s a little optimistic.