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

Support renames when parent module is imported

browniebroke opened this issue · comments

Currently the simple renaming from BaseSimpleFuncRenameTransformer doesn't detect when the parent module is imported, and we call the function with the module as prefix. It would be nice to add support for that. An example might speak better, so here is one with force_text (although other subclasses of BaseSimpleFuncRenameTransformer have the same problem).

Example input

from django.utils import encoding

encoding.force_text(something)

Expected output

from django.utils import encoding

encoding.force_str(something)