WIP: allow libcst_transform to work piecewise instead of all-or-nothing #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is meant to help explore a solution for #12. To simplify testing, it restricts running of passes to only
replace_bodies_with_ellipsis
ininitial_cut
. It attempts to makelibcst_transform
work with partial replacements instead of in a all-or-nothing fashion.The code it's able to reduce is some variation of:
It can be run against the following Python version which, on Linux, aborts with the code above:
For that, a interestingness test looks like:
But it might be easier to just substitute the
is_interesting
function for the equivalent oflambda x: b"Profiler" in x
.The code as-is is known to be broken, since it's not able to generate each substitution and record a reduction from it. But it shows the idea might work if implemented correctly, something along the lines of:
As-is, the code is able to reduce the example above to: