You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And I'm working with a VisitorBasedCodemodCommand, as you can see here.
What I guess I should do... Is to iterate over all classes with a visitor, and save the information of the base classes of a class, and then do the normal match on the codemod itself. Assuming this is correct, where should this visitor live? In the __init__() on the codemod? Or...? If my assumption is wrong, what would be the right way to do this?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi there 👋
I'm looking to find the best design for my codemod.
The problem statement is: I need to replace the method
dict()
tomodel_dump()
on every class that is subclass ofBaseModel
.For example, the following code:
Needs to become:
And I'm working with a
VisitorBasedCodemodCommand
, as you can see here.What I guess I should do... Is to iterate over all classes with a visitor, and save the information of the base classes of a class, and then do the normal match on the codemod itself. Assuming this is correct, where should this visitor live? In the
__init__()
on the codemod? Or...? If my assumption is wrong, what would be the right way to do this?Beta Was this translation helpful? Give feedback.
All reactions