`runner.sh` Parses Some Files Incorrectly
Describe the bug
The runner.sh script parses out the output from jupytext into something for feeding into pep8. sed is used in places to pick parts out, however for some weirdly formatting Python this will introduce syntax errors. For example, the following will not be interpreted correctly:
if epoch % 10 == 0:
print(
"Train: reconstruction: %.4f; generator: %.4f; discriminator: %.4f; perceptual: %.4f; kld: %.4f"
% (
epoch_recon_losses[-1],
epoch_gen_losses[-1],
epoch_disc_losses[-1],
epoch_perc_losses[-1],
epoch_kld_losses[-1],
)
)
The solution is to reformulate the code to avoid these sorts of issues. This example here isn't very attractive code anyway so a refactor to break the contents into multiple lines which are read properly wouldn't hurt anyhow. There will be other cases potentially that are well-formed code but still introduce parsing issues.
This is a minor issue I haven't had time to work on a solution for other than to refactor code, a solution to using jupytext and sed better should be investigated later.
To Reproduce This can be seen as a problem in PR #1794 currently though a fix is being worked on.
Expected behavior Script shouldn't introduce issues
The issue for a user is that the script output describes syntax errors that aren't found in the original notebook, and references a line number of the generated script file and not where the issue is in the notebook.
I think this sed command sed 's/\(^\s*\)%/\1pass # %/' is misinterpreting % ( when it tries to remove line magics.