Project-MONAI / Project-MONAI/tutorials
`runner.sh` Parses Some Files Incorrectly
Nessuno ha ancora preso questa issue.
- Lingua principale
- Jupyter Notebook
- Stelle
- 2.5k
- Fork
- 803
- Merge medio
- 6g 22h
- PR unite (30g)
- 3
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia ispezionando runner.sh e il relativo percorso di estrazione con jupytext e sed, quindi confronta il comportamento descritto in PR #1794. Il lavoro è completato quando lo script preserva Python ben formato durante l’estrazione del contenuto per pep8 senza introdurre errori di sintassi, incluso l’esempio multilinea mostrato qui.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- jupyter-notebook, python, shell
- Ambito
- tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 30/100