autopep8无法修复任何缩进

时间:2018-09-01 04:44:51

标签: python autopep8

我有一个文件test.py,其中包含以下代码

class MyClass():
y = 2
def my_func(self):
x = 2
return(x)

运行pycodestyle test.py时我会得到

test.py:2:1: E112 expected an indented block
test.py:2:1: E305 expected 2 blank lines after class or function definition, found 0
test.py:3:1: E302 expected 2 blank lines, found 0
test.py:4:1: E112 expected an indented block
test.py:4:1: E305 expected 2 blank lines after class or function definition, found 0

但是运行autopep8 test.py不能解决任何缩进问题。它返回

class MyClass():


y = 2


def my_func(self):


x = 2
return(x)

我希望它会返回

class MyClass():

    y = 2

    def my_func(self):
        x = 2
        return(x)

我期望autopep8太多吗?

0 个答案:

没有答案