We're planning to take a library-wide sweep through these separately. For now, I'm following the existing patterns, but it is on the backlog.
– original
I've used ast-grep spells like this in the past (YMMV, just found these in my shell history):
ast-grep run --pattern 'assert $A' --rewrite 'if not ($A): raise AssertionError("$A")' -l python -i src
ast-grep run --pattern 'assert $$$A, $B' --rewrite 'if not ($A): raise AssertionError($B)' -l python -i src
I've used
ast-grep
spells like this in the past (YMMV, just found these in my shell history):