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

indentation breaks for multiple statements separated by semicolons in class __init__ oneliner #680

Open tandav opened 1 year ago

tandav commented 1 year ago

Python Code

This is working python code:

class K:
    def __init__(self, x, *args, **kwargs): self.x = x; self.args = args; self.kwargs = kwargs

after running autopep8 it becomes:

class K:
    def __init__(self, x, *args, **
                 kwargs): self.x = x
    self.args = args
    self.kwargs = kwargs

Indentation is broken: "self" is not defined, "args" is not defined, "kwargs" is not defined.
Expected output should be something like this:

class K:
    def __init__(self, x, *args, **
                 kwargs): 
        self.x = x
        self.args = args
        self.kwargs = kwargs

Command Line and Configuration

Command Line

$ autopep8 --in-place main.py

Your Environment