diff --git a/python/src/com/jetbrains/python/PyBundle.properties b/python/src/com/jetbrains/python/PyBundle.properties index 2060bdeb2944..f7d2a8834a2f 100644 --- a/python/src/com/jetbrains/python/PyBundle.properties +++ b/python/src/com/jetbrains/python/PyBundle.properties @@ -127,7 +127,6 @@ INTN.join.if.text=Join two if's INTN.convert.dict.constructor.to.dict.literal=Convert dict constructor to dict literal form INTN.convert.dict.literal.to.dict.constructor=Convert dict literal to dict constructor -INTN.convert.dict=Convert dict back and forth between literal dict and dict(**kwargs) INTN.quoted.string=Convert between single-quoted and double-quoted strings INTN.quoted.string.single.to.double=Convert single-quoted string to double-quoted string diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java index 6e606ef572c9..61bdc7e032eb 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictConstructorToLiteralFormIntention.java @@ -14,13 +14,20 @@ import org.jetbrains.annotations.NotNull; /** * User: catherine + * Intention to convert dict constructor to dict literal expression with only explicit keyword arguments + * For instance, + * dict() -> {} + * dict(a=3, b=5) -> {'a': 3, 'b': 5} + * dict(foo) -> no transformation + * dict(**foo) -> no transformation */ public class PyDictConstructorToLiteralFormIntention extends BaseIntentionAction { @NotNull public String getFamilyName() { - return PyBundle.message("INTN.convert.dict"); + return PyBundle.message("INTN.convert.dict.constructor.to.dict.literal"); } + @NotNull public String getText() { return PyBundle.message("INTN.convert.dict.constructor.to.dict.literal"); } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java index e3940b688574..2937526ae471 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyDictLiteralFormToConstructorIntention.java @@ -8,19 +8,24 @@ import com.intellij.psi.util.PsiTreeUtil; import com.intellij.util.IncorrectOperationException; import com.jetbrains.python.PyBundle; import com.jetbrains.python.psi.*; -import com.jetbrains.python.psi.types.PyType; -import com.jetbrains.python.psi.types.TypeEvalContext; import org.jetbrains.annotations.NotNull; /** * User: catherine + * + * Intention to convert dict literal expression to dict constructor if the keys are all string constants on a literal dict. + * For instance, + * {} -> dict + * {'a': 3, 'b': 5} -> dict(a=3, b=5) + * {a: 3, b: 5} -> no transformation */ public class PyDictLiteralFormToConstructorIntention extends BaseIntentionAction { @NotNull public String getFamilyName() { - return PyBundle.message("INTN.convert.dict"); + return PyBundle.message("INTN.convert.dict.literal.to.dict.constructor"); } + @NotNull public String getText() { return PyBundle.message("INTN.convert.dict.literal.to.dict.constructor"); } diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyJoinIfIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyJoinIfIntention.java index 3a5615b0d62d..545c84d98621 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyJoinIfIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyJoinIfIntention.java @@ -13,6 +13,14 @@ import org.jetbrains.annotations.Nullable; /** * User: catherine + * Intention to merge the if clauses in the case of nested ifs where only the inner if contains code (the outer if only contains the inner one) + * For instance, + * if a: + * if b: + * # stuff here + * into + * if a and b: + * #stuff here */ public class PyJoinIfIntention extends BaseIntentionAction { @NotNull diff --git a/python/src/com/jetbrains/python/codeInsight/intentions/PyQuotedStringIntention.java b/python/src/com/jetbrains/python/codeInsight/intentions/PyQuotedStringIntention.java index 8c67574df525..cd3abda76f3b 100644 --- a/python/src/com/jetbrains/python/codeInsight/intentions/PyQuotedStringIntention.java +++ b/python/src/com/jetbrains/python/codeInsight/intentions/PyQuotedStringIntention.java @@ -20,6 +20,7 @@ import java.util.List; /** * User: catherine + * Intention to convert between single-quoted and double-quoted strings */ public class PyQuotedStringIntention extends BaseIntentionAction {