diff --git a/python/src/com/jetbrains/python/formatter/PyBlock.java b/python/src/com/jetbrains/python/formatter/PyBlock.java index 55d6eaad1261..9269c742eff3 100644 --- a/python/src/com/jetbrains/python/formatter/PyBlock.java +++ b/python/src/com/jetbrains/python/formatter/PyBlock.java @@ -323,13 +323,8 @@ public class PyBlock implements ASTBlock { if (childType == PyTokenTypes.RPAR) { childIndent = Indent.getNoneIndent(); } - else { - if (parentType == PyElementTypes.PARAMETER_LIST || argumentMayHaveSameIndentAsFollowingStatementList()) { - childIndent = Indent.getContinuationIndent(); - } - else { - childIndent = Indent.getNormalIndent(); - } + else if (childType != PyTokenTypes.LPAR){ + childIndent = Indent.getContinuationIndent(); } } else if (parentType == PyElementTypes.SUBSCRIPTION_EXPRESSION) { @@ -426,16 +421,6 @@ public class PyBlock implements ASTBlock { return node.getPsi() instanceof PySequenceExpression && ((PySequenceExpression)node.getPsi()).isEmpty(); } - private boolean argumentMayHaveSameIndentAsFollowingStatementList() { - // This check is supposed to prevent PEP8's error: Continuation line with the same indent as next logical line - final PsiElement header = getControlStatementHeader(myNode); - if (header instanceof PyStatementListContainer) { - final PyStatementList statementList = ((PyStatementListContainer)header).getStatementList(); - return PyUtil.onSameLine(header, myNode.getPsi()) && !PyUtil.onSameLine(header, statementList); - } - return false; - } - // Check https://www.python.org/dev/peps/pep-0008/#indentation private static boolean hasHangingIndent(@NotNull PsiElement elem) { if (elem instanceof PyCallExpression) { diff --git a/python/testData/formatter/continuationIndentIsNotUsedForNestedFunctionCallsInWithStatement_after.py b/python/testData/formatter/continuationIndentIsNotUsedForNestedFunctionCallsInWithStatement_after.py index c867a3f0451a..9a4e5063b2ab 100644 --- a/python/testData/formatter/continuationIndentIsNotUsedForNestedFunctionCallsInWithStatement_after.py +++ b/python/testData/formatter/continuationIndentIsNotUsedForNestedFunctionCallsInWithStatement_after.py @@ -1,4 +1,4 @@ with raises_assertion( has_string('Missing download_urls: {}, {}'.format( - self.other_download_url, self.another_download_url))): + self.other_download_url, self.another_download_url))): fixture.assert_detail_page_yields_expected() diff --git a/python/testData/formatter/hangingIndentInNamedArgumentValue_after.py b/python/testData/formatter/hangingIndentInNamedArgumentValue_after.py index 4585528e01cd..1102984b4b98 100644 --- a/python/testData/formatter/hangingIndentInNamedArgumentValue_after.py +++ b/python/testData/formatter/hangingIndentInNamedArgumentValue_after.py @@ -1,3 +1,3 @@ funcWithLongName(x=[ ], - y=42) + y=42) diff --git a/python/testData/formatter/noAlignForMethodArguments_after.py b/python/testData/formatter/noAlignForMethodArguments_after.py index 5682f4ca4f45..740f638adf4c 100644 --- a/python/testData/formatter/noAlignForMethodArguments_after.py +++ b/python/testData/formatter/noAlignForMethodArguments_after.py @@ -2,4 +2,4 @@ def long_method_name(bar, baz): pass long_method_name("long string one", - "long string two") + "long string two") diff --git a/python/testData/formatter/noWrapBeforeParen_after.py b/python/testData/formatter/noWrapBeforeParen_after.py index 5ab3054984db..003f387c408c 100644 --- a/python/testData/formatter/noWrapBeforeParen_after.py +++ b/python/testData/formatter/noWrapBeforeParen_after.py @@ -4,4 +4,4 @@ def foo(): if comments: for comment in comments: record += ' \n' + ca + '=' + quoteattr(comment[ca]) + ' ' for ca in comment) + '/>\n' diff --git a/python/testData/formatter/setLiteralInArgList_after.py b/python/testData/formatter/setLiteralInArgList_after.py index 9c2f75d6dca6..48bec3381227 100644 --- a/python/testData/formatter/setLiteralInArgList_after.py +++ b/python/testData/formatter/setLiteralInArgList_after.py @@ -1,3 +1,3 @@ self.assertEqual( - {"000000000000", "111111111111"}, - foo['bar']['baz']) + {"000000000000", "111111111111"}, + foo['bar']['baz']) diff --git a/python/testData/refactoring/introduceVariable/functionCallWithCommentNotInlined.after.py b/python/testData/refactoring/introduceVariable/functionCallWithCommentNotInlined.after.py index 3140c9b2ab96..f73d8462c0c9 100644 --- a/python/testData/refactoring/introduceVariable/functionCallWithCommentNotInlined.after.py +++ b/python/testData/refactoring/introduceVariable/functionCallWithCommentNotInlined.after.py @@ -1,8 +1,8 @@ import subprocess as sp a = sp.check_output( - args=['python', '-c', 'print("Spam")'], - # read errors too - stderr=sp.STDOUT + args=['python', '-c', 'print("Spam")'], + # read errors too + stderr=sp.STDOUT ) print(a) \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyIndentTest.java b/python/testSrc/com/jetbrains/python/PyIndentTest.java index 0164e14fc5ce..d6c09b817227 100644 --- a/python/testSrc/com/jetbrains/python/PyIndentTest.java +++ b/python/testSrc/com/jetbrains/python/PyIndentTest.java @@ -16,7 +16,6 @@ package com.jetbrains.python; import com.intellij.openapi.actionSystem.IdeActions; -import com.intellij.openapi.command.CommandProcessor; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.jetbrains.python.fixtures.PyTestCase; @@ -200,7 +199,7 @@ public class PyIndentTest extends PyTestCase { public void testEnterInNonEmptyArgList() { // PY-1947 doTest("Task(params=1)", "Task(\n" + - " params=1)"); + " params=1)"); } public void testEnterInNonClosedArgList() { // PY-4863