自动查找ipynb中的精确行以修复黑色的缩进错误

问题描述 投票:0回答:1
black ".\research\evaluation_detection.ipynb"

输出

error: cannot format research\evaluation_detection.ipynb: unindent does not match any outer indentation level (<tokenize>, line 11)

Oh no! 💥 💔 💥
1 file failed to reformat.

问题是我的文件有很多第 11 行的单元格;文件开头只有一层。 使用什么工具/脚本来解决此代码风格异常破坏能力提交。

python-3.x jupyter-lab pycodestyle
1个回答
0
投票
jupyter nbconvert --to script ".\research\evaluation_detection.ipynb"

提供更详细的错误日志,其中包含行

raise IndentationError(
  File "<tokenize>", line 11
    n_face = len(face_obj)
IndentationError: unindent does not match any outer indentation level

通过这一行我们可以编辑原始的 ipynb

© www.soinside.com 2019 - 2024. All rights reserved.