python-language-server icon indicating copy to clipboard operation
python-language-server copied to clipboard

Prefer explicit exports when generating imports

Open ThiefMaster opened this issue 5 years ago • 0 comments

For example, flask's __init__.py explicitly exports many common symbols. But when generating an import e.g. for url_for, it will import it from flask.helpers instead.

My suggestion would be to take symbols listed in __all__ into account and, in case this is not defined, take the shortest possible import based on which __init__.py imports a symbol (which in case of the example above would be from flask import url_for)

ThiefMaster avatar Jun 06 '20 19:06 ThiefMaster