Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to chain remove_argument() #126

Open
JohnVillalovos opened this issue May 7, 2020 · 5 comments
Open

Unable to chain remove_argument() #126

JohnVillalovos opened this issue May 7, 2020 · 5 comments

Comments

@JohnVillalovos
Copy link

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, " --------------------")
@JohnVillalovos
Copy link
Author

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 👍

@thatch
Copy link
Contributor

thatch commented May 25, 2020

If you have a more complete repro I can probably suggest other workarounds. Otherwise, doing it multiple phases would be my go-to.

@thatch
Copy link
Contributor

thatch commented Aug 11, 2020

@JohnVillalovos do you by chance have a more complete repro yet?

@azachar
Copy link

azachar commented Mar 25, 2021

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!

@thatch
Copy link
Contributor

thatch commented Apr 1, 2021

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants