Automatically find the precise line in ipynb to fix indentation error for black

14 Views Asked by At
black ".\research\evaluation_detection.ipynb"

outputs

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.

The problem is that my file has lots of cells with line 11; there is only one level at the start of the file. What tool/script to use to resolve this codestyle exception breaking ability to commit.

1

There are 1 best solutions below

0
MosQuan On
jupyter nbconvert --to script ".\research\evaluation_detection.ipynb"

gives more detailed error log that consists line

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

by this line we can edit the original ipynb