mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-17295 In the quickfix use "if param is None" check instead of "if not param"
This commit is contained in:
@@ -64,7 +64,8 @@ public class PyDefaultArgumentQuickFix implements LocalQuickFix {
|
||||
final PyNamedParameter newParam = generator.createParameter(defName, PyNames.NONE, null, languageLevel);
|
||||
param.replace(newParam);
|
||||
|
||||
final String conditionalText = "if not " + defName + ":\n\t" + defName + " = " + defaultValue.getText() + "\n";
|
||||
final String conditionalText = "if " + defName + " is None:" +
|
||||
"\n\t" + defName + " = " + defaultValue.getText();
|
||||
final PyIfStatement conditionalAssignment = generator.createFromText(languageLevel, PyIfStatement.class, conditionalText);
|
||||
PyUtil.addElementToStatementList(conditionalAssignment, function.getStatementList(), true);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
def func(x, # comment
|
||||
mutable=None):
|
||||
"""Docstring."""
|
||||
if not mutable:
|
||||
if mutable is None:
|
||||
mutable = []
|
||||
print(mutable)
|
||||
@@ -1,3 +1,3 @@
|
||||
def bar(args=None):
|
||||
if not args:
|
||||
if args is None:
|
||||
args = []
|
||||
@@ -1,3 +1,3 @@
|
||||
def foo(args=None):
|
||||
if not args:
|
||||
if args is None:
|
||||
args = []
|
||||
Reference in New Issue
Block a user