Commit Graph

1 Commits

Author SHA1 Message Date
Mikhail Golubev
3ba2747c51 PY-36374 When suggesting imports, don't shadow package aliases with namesake definitions
Previously, we suggested variants for these well-known aliases only if no
other symbols were found. In particular, having "np" name defined in the
sources of pandas prevented "import numpy as np" from being offered.

ImportCandidateHolder had to be refactored a bit to keep the name of
the corresponding symbol itself, because it used to be taken from the parent
AutoImportQuickFix, which now only holds the name of the reference, and, thus,
"numpy" ended up being imported as "import np as np".

Also, such imports are now suggested higher in the list than the rest.

GitOrigin-RevId: 75bed654431e81e6df40f1400ee4b02a4ab0dcca
2021-01-07 17:25:28 +00:00