I did this in order to better understand the AST transformation and try to express it more clearly in the code. I welcome your feedback - I know the global diff is terrible but it really goes step by step on each commit.
The only real changes are:
Not calling ast.fix_missing_locations more than once, at the end of the transformation (because doing otherwise seems to be unnecessary).
Verifying that hook "scopes" (that is, all and each) are provided. Currently, mamba doesn't do it, so writing with before.whatever results in trying to save a before_whatever hook to the example group, which fails. With these changes, that with statement would not be transformed.
This also adds tests for the particular transformations.
I did this in order to better understand the AST transformation and try to express it more clearly in the code. I welcome your feedback - I know the global diff is terrible but it really goes step by step on each commit.
The only real changes are:
ast.fix_missing_locations
more than once, at the end of the transformation (because doing otherwise seems to be unnecessary).all
andeach
) are provided. Currently, mamba doesn't do it, so writingwith before.whatever
results in trying to save abefore_whatever
hook to the example group, which fails. With these changes, thatwith
statement would not be transformed.This also adds tests for the particular transformations.