PyCharm Code Folding/Outlining Generates Wrong Boundaries

Finally!! I figured out how to remove the invalid folding regions. If you place your cursor on the line that starts an invalid folding block (line 106 in my first example), then right click anywhere in that line and select Folding -> Fold Selection / Remove Region and that will delete the incorrect folding annotation!

I still have no clue why they are generated in the first place, but at least this is a decent "fix".

Tags:

Python

Pycharm