space around more keywords (PY-7863)

This commit is contained in:
Dmitry Jemerov
2012-10-24 20:03:03 +02:00
parent d37c997e30
commit d6fa99f709
7 changed files with 18 additions and 4 deletions
@@ -109,7 +109,11 @@ public class PythonFormattingModelBuilder implements FormattingModelBuilderEx, C
}
// should be all keywords?
private static final TokenSet SINGLE_SPACE_KEYWORDS = TokenSet.create(IN_KEYWORD, AND_KEYWORD, OR_KEYWORD, IS_KEYWORD);
private static final TokenSet SINGLE_SPACE_KEYWORDS = TokenSet.create(IN_KEYWORD, AND_KEYWORD, OR_KEYWORD, IS_KEYWORD,
IF_KEYWORD, ELIF_KEYWORD, FOR_KEYWORD, RETURN_KEYWORD, RAISE_KEYWORD,
ASSERT_KEYWORD, CLASS_KEYWORD, DEF_KEYWORD, DEL_KEYWORD,
EXEC_KEYWORD, GLOBAL_KEYWORD, IMPORT_KEYWORD, LAMBDA_KEYWORD,
NOT_KEYWORD, WHILE_KEYWORD, YIELD_KEYWORD);
private static TokenSet allButLambda() {
final PythonLanguage pythonLanguage = PythonLanguage.getInstance();
@@ -0,0 +1,2 @@
def rc(s):
return s.translate('*****************************************************************TVGHEFCDIJMLKNOPQYSAUBWXRZ[\]^_`tvghefcdijmlknopqysaubwxrz*************************************************************************************************************************************')[::-1]
@@ -0,0 +1,4 @@
def rc(s):
return s.translate(
'*****************************************************************TVGHEFCDIJMLKNOPQYSAUBWXRZ[\]^_`tvghefcdijmlknopqysaubwxrz*************************************************************************************************************************************')[
::-1]
@@ -1,3 +1,3 @@
# "DeMorgan Law" "true"
if not(not a and not b):
if not (not a and not b):
pass
@@ -1,3 +1,3 @@
# "DeMorgan Law" "true"
if not(a and b):
if not (a and b):
pass
@@ -4,5 +4,5 @@ c = True
d = False
#before intention
if not(not(a and b and c) and not d):
if not (not (a and b and c) and not d):
print "before"
@@ -187,6 +187,10 @@ public class PyFormatterTest extends PyTestCase {
doTest();
}
public void testSpaceAfterReturn() {
doTest();
}
public void testPsiFormatting() { // IDEA-69724
String initial =
"def method_name(\n" +