hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.
https://pypi.org/project/autopep8/
MIT License
4.54k stars 291 forks source link

'Staircase' formatting #751

Open robertHowlett opened 1 month ago

robertHowlett commented 1 month ago

Python Code

def some_func():
    foo = (
        [
            [
                1, 2, 3], [
                1, 2, 3], [
                    1, 2, 3], [
                        1, 2, 3], [
                            1, 2, 3], [
                                1, 2, 3], [
                                    1, 2, 3], [
                                        1, 2, 3], [
                                            1, 2, 3], [
                                                1, 2, 3], [
                                                    1, 2, 3], [
                                                        1, 2, 3], [
                                                            1, 2, 3], [
                                                                1, 2, 3], [
                                                                    1, 2, 3], [
                                                                        1, 2, 3], [
                                                                            1, 2, 3], [
                                                                                1, 2, 3], [
                                                                                    1, 2, 3], [
                                                                                        1, 2, 3], [
                                                                                            1, 2, 3], [
                                                                                                1, 2, 3], [
                                                                                                    1, 2, 3], [
                                                                                                        1, 2, 3], [
                                                                                                            1, 2, 3], [
                                                                                                                1, 2, 3], [
                                                                                                                    1, 2, 3], [
                                                                                                                        1, 2, 3], [
                                                                                                                            1, 2, 3], [
                                                                                                                                1, 2, 3], [
                                                                                                                                    1, 2, 3], [
                                                                                                                                        1, 2, 3], [
                                                                                                                                            1, 2, 3], [
                                                                                                                                                1, 2, 3], [
                                                                                                                                                    1, 2, 3], [
                                                                                                                                                        1, 2, 3], [
                                                                                                                                                            1, 2, 3], [
                                                                                                                                                                1, 2, 3], [
                                                                                                                                                                    1, 2, 3], [
                                                                                                                                                                        1, 2, 3], [
                                                                                                                                                                            1, 2, 3], [
                                                                                                                                                                                1, 2, 3], [
                                                                                                                                                                                    1, 2, 3], [
                                                                                                                                                                                        1, 2, 3], [
                                                                                                                                                                                            1, 2, 3], [
                                                                                                                                                                                                1, 2, 3], [
                                                                                                                                                                                                    1, 2, 3], [
                                                                                                                                                                                                        1, 2, 3]])

When I run autopep8, it seems to think that this is correct formatting. I expect the indent of every row to be the same, and for each row of the data to begin with an open square bracket.

Command Line and Configuration

No file configuration

Command Line

$ autopep8 --diff --max-line-length=120 path/to/file.py

Your Environment