browniebroke / django-codemod

A tool to automatically fix Django deprecations.

Home Page:https://django-codemod.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify import checking with LibCST's FullyQualifiedNameProvider

browniebroke opened this issue · comments

Is your feature request related to a problem? Please describe.

LibCST 0.3.18 added a FullyQualifiedNameProvider which seems like it could help us simplify our checks for imported symbols:

https://libcst.readthedocs.io/en/latest/metadata.html#libcst.metadata.FullyQualifiedNameProvider

Describe the solution you'd like

https://github.com/browniebroke/django-codemod/blob/main/django_codemod/visitors/base.py

Especially, the code from BaseRenameTransformer.leave_ImportFrom seems like a good candidate.