Open GliderGeek opened 4 years ago
looking at it further i can imagine i have to write my own modify
callback?
is there an example for a custom modify
callback implementation?
def change_module_source(matched_element, captured_elements, filename):
# perform rename
q = Query('script.py').select_module('module1').select_function('foo').modify(callback=change_module_source)
first of all thanks for this nice tool.
i was wondering if bowler could be used to handle a moved function/class? maybe if it is not easily done using the current implemented helper functions, but the callbacks make it very flexible and would probably enable a custom implementation i would say?
an example is the following i would like to move the function
foo
frommodule1
tomodule2
:script which should be changed:
The following query correctly rename the
foo
import, but will also change thebar
import:I would like to somehow select the
foo
function, then return to the module and perform the rename. To illustrate what i would like to achieve (probably not the way to go):