pycodestyle
pycodestyle copied to clipboard
E131 applies inconsistently with nested calls
I often use an indentation format like this for long method chains with something like SQLAlchemy, which seems to be acceptable according to my reading of PEP8 and doesn't raise any errors when pycodestyle is run:
rows = db.engine.execute(
table.select()
.where(table.c.column1 == 'something')
.where(table.c.column2.is_(None))
.order_by(table.c.column3)
.limit(5)
)
However, if the name of the variable being assigned to is a particular length, E131 - continuation line unaligned for hanging indent is raised:
aaaaaaaa = db.engine.execute(
table.select()
.where(table.c.column1 == 'something') # E131
.where(table.c.column2.is_(None)) # E131
.order_by(table.c.column3) # E131
.limit(5) # E131
)
It seems to be related to having the = operator aligned with the indented lines? Adding just a single character to the left side of the assignment will remove the E131.
aaaaaaaab = db.engine.execute(
table.select()
.where(table.c.column1 == 'something')
.where(table.c.column2.is_(None))
.order_by(table.c.column3)
.limit(5)
)
Is this an issue in pycodestyle, or do I just not understand what's going on here?
$ pycodestyle --version
2.6.0