PY-28496, PY-27660 Remove unnecessary Normal Indent which violates PEP8 codestyle rules in multiline call chains

GitOrigin-RevId: 77e738367c33673c5c5f4b46472c3a49a5f64142
This commit is contained in:
Daniil Kalinin
2022-05-12 13:46:52 +00:00
committed by intellij-monorepo-bot
parent de3ab61998
commit ded2dafba4
8 changed files with 51 additions and 1 deletions
@@ -400,7 +400,7 @@ public class PyBlock implements ASTBlock {
}
else if (parentType == PyElementTypes.REFERENCE_EXPRESSION) {
if (child != myNode.getFirstChildNode()) {
childIndent = Indent.getNormalIndent();
childIndent = Indent.getNoneIndent();
if (hasLineBreaksBeforeInSameParent(child, 1)) {
if (isInControlStatement()) {
childIndent = Indent.getContinuationIndent();
@@ -0,0 +1,9 @@
def get_queryset(self):
return (
super().get_queryset()
.filter(user=self.request.user)
.prefetch_related(
'lines__oscar_line',
'lines__oscar_line__product'
)
)
@@ -0,0 +1,9 @@
def get_queryset(self):
return (
super().get_queryset()
.filter(user=self.request.user)
.prefetch_related(
'lines__oscar_line',
'lines__oscar_line__product'
)
)
@@ -0,0 +1,5 @@
c = ["line"
.casefold()
.capitalize()
.encode()
]
@@ -0,0 +1,5 @@
c = ["line"
.casefold()
.capitalize()
.encode()
]
@@ -0,0 +1,4 @@
def func():
return x.foo() \
.bar() \
.baz()
@@ -0,0 +1,4 @@
def func():
return x.foo() \
.bar() \
.baz()
@@ -1239,4 +1239,18 @@ public class PyFormatterTest extends PyTestCase {
getCodeStyleSettings().setRightMargin(PythonLanguage.getInstance(), 20);
doTest();
}
// PY-28496
public void testHangingIndentsInMultilineCallChainInParenthesis() {
doTest();
}
// PY-27660
public void testHangingIndentsInMultilineCallChainInSquareBrackets() {
doTest();
}
public void testMultiLineCallChainSplitByBackslashes() {
doTest();
}
}