3

我有一个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

4

0 回答 0