hhatto / autopep8

A tool that automatically formats Python code to conform to the PEP 8 style guide.

Home Page:https://pypi.org/project/autopep8/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

tandav opened this issue · comments


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

  • Python version: python3.11
  • autopep8 version: 2.0.2
  • Platform: linux