Bowler
Bowler copied to clipboard
Unable to chain remove_argument()
Using latest version from git as of today.
When trying to chain two remove_argument() functions I get the following error:
<snip>
File "/home/jlvillal/.local/lib/python3.7/site-packages/bowler-0.8.0-py3.7.egg/bowler/query.py", line 892, in remove_argument_transform
spec.explode()
File "/home/jlvillal/.local/lib/python3.7/site-packages/bowler-0.8.0-py3.7.egg/bowler/imr.py", line 240, in explode
self.capture["function_parameters"].replace(parameters)
File "/home/jlvillal/.local/lib/python3.7/site-packages/fissix/pytree.py", line 108, in replace
assert self.parent is not None, str(self)
AssertionError: ("P", 0, " --------------------")
As a note, I worked around the issue by running one pass removing one argument and updating the file. Then running another pass to remove the second argument.
Also, this program was very useful in some refactoring work I had to do 👍
If you have a more complete repro I can probably suggest other workarounds. Otherwise, doing it multiple phases would be my go-to.
@JohnVillalovos do you by chance have a more complete repro yet?
Actually, it would be nice to provide an example, my code is failing with this one:
raise ValueError("remove_argument requires passing original function")
Where can I specify it? Could you please provide the usage example? Thank you!
@azachar I'm pretty sure your issue is just docs:
Where can I specify it?
instead of a string name, you have to import it first. See example at
https://gist.github.com/thatch/bb61a25c470d24934f7d4cf35da40f51 https://gist.github.com/thatch/1a5799c8d323b6ed3bc1e2e3f5f2c1b1