asottile / pyupgrade

A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

rewrite as-import as regular import if name is equal

spaceone opened this issue · comments

pyupgrade rewrites:

-from six.moves import cPickle as pickle
+import pickle as pickle

expected:

-from six.moves import cPickle as pickle
+import pickle

annoyingly this probably can't be automated because mypy treats import A as A and from A import B as B specially