Move other Python inspections to python-psi-impl

GitOrigin-RevId: 71e300329addb702f3f603f58174f3f16e688ad6
This commit is contained in:
Dmitry Trofimov
2020-03-30 15:02:49 +00:00
committed by intellij-monorepo-bot
parent 92f7df525e
commit d799d9d4d7
203 changed files with 1567 additions and 1367 deletions
@@ -37,6 +37,10 @@
<extensionPoint name="inspectionToolProvider" interface="com.intellij.codeInspection.InspectionToolProvider" dynamic="true"/>
<extensionPoint name="codeInspection.InspectionExtension" interface="com.intellij.codeInspection.lang.InspectionExtensionsFactory" dynamic="true"/>
<extensionPoint name="inspectionsReportConverter" interface="com.intellij.codeInspection.InspectionsReportConverter" dynamic="true"/>
<extensionPoint name="lang.inspectionSuppressor" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.codeInspection.InspectionSuppressor"/>
</extensionPoint>
</extensionPoints>
<extensions defaultExtensionNs="com.intellij">
<projectService serviceImplementation="com.intellij.psi.search.scope.packageSet.NamedScopeManager"/>
@@ -93,10 +93,6 @@
<with attribute="implementationClass" implements="com.intellij.lang.Commenter"/>
</extensionPoint>
<extensionPoint name="lang.inspectionSuppressor" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.codeInspection.InspectionSuppressor"/>
</extensionPoint>
<extensionPoint name="lang.braceMatcher" beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass" implements="com.intellij.lang.PairedBraceMatcher"/>
</extensionPoint>
+2 -1
View File
@@ -14,5 +14,6 @@
<orderEntry type="library" name="kotlin-stdlib-jdk8" level="project" />
<orderEntry type="library" name="XStream" level="project" />
<orderEntry type="module" module-name="intellij.platform.util.ui" />
<orderEntry type="module" module-name="intellij.python.psi" />
</component>
</module>
</module>
@@ -3,42 +3,11 @@ QFIX.optimize.imports=Optimize imports
QFIX.add.import.add.import=Add "''{0}''"
QFIX.add.parameter.self=Add parameter ''{0}''
QFIX.add.super=Add super class call
QFIX.add.property=Add property for the field
QFIX.use.property=Use property for the field
QFIX.make.public=Make public
QFIX.convert.to.new.style=Convert to New-style class
QFIX.change.base.class=Change base class
QFIX.create.property=Create property
QFIX.add.encoding=Add encoding declaration
QFIX.NAME.parameters=Parameters of functions and methods
QFIX.NAME.add.method.$0.to.class.$1=Add method {0}() to class {1}
QFIX.failed.to.add.method=<br/>Failed to add a method!<br/><br/>
QFIX.NAME.add.function.$0.to.module.$1=Create function {0}() in module {1}
QFIX.failed.to.add.function=<br/>Failed to add a function!<br/><br/>
QFIX.action.failed=Action failed
QFIX.remove.trailing.semicolon=Remove trailing semicolon
QFIX.list.creation=Replace list creation
QFIX.classic.class.transform=Inherit from object
QFIX.add.global=Add global statement
QFIX.statement.effect=Replace with function call
QFIX.statement.effect.move.docstring=Move docstring to the proper place
QFIX.statement.effect.introduce.variable=Introduce variable
@@ -52,63 +21,20 @@ QFIX.unresolved.reference.add.param=Create parameter for reference
QFIX.unresolved.reference.create.function=Create function
QFIX.NAME.unresolved.reference.create.function=Create function ''{0}''
QFIX.introduce.variable=Introduce variable for statement
# RemoveUnnecessaryBackslashQuickFix
QFIX.remove.unnecessary.backslash=Remove unnecessary backslash in expression
# ConvertDocstringQuickFix
QFIX.convert.single.quoted.docstring=Convert docstring to the triple double-quoted string form
#UnresolvedRefTrueFalseQuickFix
QFIX.unresolved.reference.replace.$0=Replace with {0}
# ReplaceFunctionWithSetLiteralQuickFix
QFIX.replace.function.set.with.literal=Replace function call with set literal
#RemoveDecoratorQuickFix
QFIX.remove.decorator=Remove decorator
#PyRenameUnresolvedRefQuickFix
QFIX.rename.unresolved.reference=Rename reference
#PyMakeMethodStaticQuickFix
QFIX.NAME.make.static=Make method static
#PyMakeFunctionFromMethodQuickFix
QFIX.NAME.make.function=Make function from method
#PyMakeFunctionReturnTypeQuickFix
QFIX.NAME.make.$0.return.$1=Make ''{0}'' return ''{1}''
#PyImplementMethodsQuickFix
QFIX.NAME.implement.methods=Implement abstract methods
QFIX.NAME.remove.assignment=Remove assignment
QFIX.NAME.update.parameters=Update parameters
QFIX.NAME.add.specifier=Add format specifier character
QFIX.NAME.add.exception.base=Add Exception base class
QFIX.NAME.change.signature=Change signature
QFIX.change.signature.of=Change signature of {0}
QFIX.NAME.remove.argument=Remove argument
QFIX.NAME.rename.argument=Rename argument
QFIX.NAME.rename.element=Rename element
QFIX.NAME.wrap.in.exception=Wrap with Exception call
QFIX.NAME.make.list=Replace tuple with list
#PyRemoveUnderscoresInNumericLiteralsQuickFix
QFIX.NAME.remove.underscores.in.numeric=Remove underscores in numeric literals
# InstallAndImportQuickFix
QFIX.install.and.import.package=Install and import package
QFIX.NAME.install.and.import.package=Install and import package ''{0}''
@@ -119,7 +45,6 @@ QFIX.ignore.unresolved.reference.0=Ignore unresolved reference ''{0}''
QFIX.mark.all.unresolved.attributes.of.0.as.ignored=Mark all unresolved attributes of ''{0}'' as ignored
QFIX.fill.paragraph=Fill paragraph
QFIX.add.qualifier=Add qualifier
QFIX.rename.parameter=Rename parameter
QFIX.create.class=Create class
QFIX.create.class.0=Create class ''{0}''
QFIX.create.class.in.module=Create class ''{0}'' in module {1}
@@ -127,61 +52,16 @@ QFIX.remove.trailing.blank.lines=Remove trailing blank lines
QFIX.generating.skeletons.for.binary.module=Generating skeletons for binary module
QFIX.generate.binary.stubs=Generate binary stubs
QFIX.replace.with.true.or.false=Replace with True or False
QFIX.add.method.to.class=Add method to class
QFIX.reformat.file=Reformat file
QFIX.bold.html.text=<b>{0}</b>
QFIX.replace.with.type.name=Replace with type name
QFIX.remove.function.annotations=Remove function annotations
QFIX.replace.with.target.name=Replace with target name
QFIX.remove.generic.parameters=Remove generic parameter(s)
QFIX.replace.with.square.brackets=Replace with square brackets
QFIX.surround.with.square.brackets=Surround with square brackets
QFIX.remove.square.brackets=Remove square brackets
# Intentions: INTN
INTN.Family.convert.import.unqualify=Convert 'import module' to 'from module import'
INTN.Family.convert.import.qualify=Convert 'from module import' to 'import module'
INTN.Family.toggle.import.alias=Toggle import alias
INTN.Family.convert.except.part=Convert except part to supported form
INTN.Family.convert.set.literal=Convert set literal two supported forms
INTN.Family.convert.builtin=Convert builtin module import
INTN.Family.convert.dict.comp.expression=Convert dictionary comprehension expression
INTN.Family.convert.string=Convert single-quoted string to double-quoted
INTN.convert.to.from.$0.import.$1=Convert to ''from {0} import {1}''
INTN.convert.to.import.$0=Convert to ''import {0}''
INTN.alias.for.$0.dialog.title=Alias for ''{0}'':
INTN.add.alias.for.import.$0=Add alias to ''{0}''
INTN.remove.alias.for.import.$0=Remove alias ''{0}''
INTN.Family.migration.to.python3=Migration to Python 3
INTN.convert.except.to=Convert 'except exceptClass, Target' to 'except exceptClass as Target'
INTN.convert.set.literal.to=Convert set literal to 'set' method call
INTN.convert.builtin.import=Convert builtin module import to supported form
INTN.convert.dict.comp.to=Convert dictionary comprehension to 'dict' method call
INTN.replace.noteq.operator=Replace not equal operator
INTN.remove.leading.$0=Remove leading {0}
INTN.remove.leading.prefix=Remove prefix
INTN.remove.trailing.suffix=Remove trailing suffix
INTN.replace.list.comprehensions=Convert list comprehensions to supported form
INTN.replace.list.comprehensions.with.for=Convert list comprehensions to for loop
INTN.replace.octal.numeric.literal=Convert octal numeric literal to supported form
INTN.replace.raise.statement=Convert raise statement to supported form
INTN.replace.backquote.expression=Replace backquote expression
INTN.replace.method=Replace method which is not supported in current Python version
INTN.split.if=Split if
@@ -299,261 +179,8 @@ unwrap.elif=Unwrap elif...
remove.else=Remove else...
remove.elif=Remove elif...
### Inspections: INSP ###
INSP.GROUP.python=Python
INSP.GROUP.mako=Mako
# PyArgumentListInspection
INSP.NAME.incorrect.call.arguments=Incorrect call arguments
INSP.cannot.appear.past.keyword.arg=Cannot appear past keyword arguments or *arg or **kwarg
INSP.unexpected.arg=Unexpected argument
INSP.unexpected.arg(s)=Unexpected argument(s)
INSP.parameter.$0.unfilled=Parameter ''{0}'' unfilled
INSP.parameter(s).unfilled=Parameter(s) unfilled
INSP.possible.callees=Possible callees
INSP.func.$0.lacks.first.arg=Function ''{0}'' lacks a positional argument
INSP.expected.dict.got.$0=Expected a dictionary, got {0}
INSP.expected.iter.got.$0=Expected an iterable, got {0}
INSP.more.args.that.pos.params=Multiple values resolve to one positional parameter
INSP.multiple.values.resolve.to.positional.$0=Multiple values resolve to positional parameter ''{0}''
INSP.cannot.analyze=This argument list cannot be analyzed
# PyMethodParametersInspection
INSP.NAME.problematic.first.parameter=Methods having troubles with first parameter
INSP.must.have.first.parameter=Method must have a first parameter, usually called ''{0}''
INSP.probably.mistyped.self=Did not you mean 'self'?
INSP.usually.named.self=Usually first parameter of a method is named 'self'
INSP.usually.named.$0=Usually first parameter of such methods is named ''{0}''
INSP.first.param.must.not.be.tuple=First parameter of a non-static method must not be a tuple
# PyNestedDecoratorsInspection
INSP.NAME.nested.decorators=Problematic nesting of decorators
INSP.decorator.receives.unexpected.builtin=This decorator will not receive a callable it may expect; the built-in decorator returns a special object
# PyRedeclarationInspection
INSP.NAME.redeclaration=Redeclared names without usage
INSP.redeclared.name=Redeclared ''{0}'' defined above without usage
# PyUnresolvedReferencesInspection
INSP.try.except.import.error=''{0}'' in try block with ''except ImportError'' should also be defined in except block
INSP.unused.import.statement=Unused import statement <code>#ref</code>
# PyInterpreterInspection
INSP.NAME.invalid.interpreter=Invalid interpreter configured
# ReturnValueFromInitInspection
INSP.NAME.init.return=__init__ method that returns a value
INSP.cant.return.value.from.init=Cannot return a value from __init__
# PyUnreachableCodeInspection
INSP.NAME.unreachable.code=Unreachable code
INSP.unreachable.code=This code is unreachable
# PyMethodFirstArgAssignmentInspection
INSP.NAME.first.arg.assign=Reassignment of method's first argument
INSP.first.arg.$0.assigned=Method''s parameter ''{0}'' reassigned
# PyStringFormatInspection
INSP.NAME.str.format=Errors in string formatting operations
INSP.format.requires.no.mapping=Format doesn't require a mapping
INSP.key.$0.has.no.arg=Key ''{0}'' has no corresponding argument
INSP.unexpected.type.$0=Unexpected type {0}
INSP.too.few.keys=Too few mapping keys
INSP.no.format.specifier.char=Format specifier character missing
INSP.format.requires.mapping=Format requires a mapping
INSP.too.many.args.for.fmt.string=Too many arguments for format string
INSP.too.few.args.for.fmt.string=Too few arguments for format string
INSP.incompatible.options=The format options in chunk "{0}" are incompatible
INSP.unused.mapping = Mapping key "{0}" is unused
INSP.unsupported.format.character=Unsupported format character ''{0}''
INSP.manual.to.auto.field.numbering=Cannot switch from manual field specification to automatic field numbering
INSP.auto.to.manual.field.numbering=Cannot switch from automatic field numbering to manual field specification
# PyMethodOverridingInspection
INSP.NAME.method.over=Method signature does not match signature of overridden method
INSP.signature.mismatch=Signature of method ''{0}'' does not match signature of base method in class ''{1}''
# PyInitNewSignatureInspection
INSP.NAME.new.init.signature=Incompatible signatures of __new__ and __init__
INSP.new.incompatible.to.init=Signature is not compatible to __init__
INSP.init.incompatible.to.new=Signature is not compatible to __new__
# PyTrailingSemicolonInspection
INSP.NAME.trailing.semicolon=Trailing semicolon in statement
# PyUnboundLocalVariableInspection
INSP.NAME.unbound=Unbound local variable
INSP.unbound.local.variable=Local variable ''{0}'' might be referenced before assignment
INSP.unbound.nonlocal.variable=Nonlocal variable ''{0}'' must be bound in an outer function scope
INSP.unbound.name.undefined=Name ''{0}'' can be undefined
INSP.unbound.function.too.large=Function ''{0}'' is too large to analyse
# PyListCreationInspection
INSP.NAME.list.creation=List creation could be rewritten by list literal
# PyTupleAssignmentBalanceInspection
INSP.NAME.incorrect.assignment=Tuple assignment balance is incorrect
# PyClassicStyleClassInspection
INSP.NAME.classic.class.usage=Classic style class usage
INSP.classic.class.usage.old.style.class=Old-style class
INSP.classic.class.usage.old.style.class.ancestors=Old-style class, because all classes from whom it inherits are old-style
# PyExceptionInheritance
INSP.NAME.exception.not.inherit=Exception doesn't inherit from standard ''Exception'' class
# PyDefaultArgumentInspection
INSP.NAME.default.argument=Default argument is mutable
# PyDocstringTypesInspection
INSP.NAME.docstring.types=Type in docstring doesn't match inferred type
# PyStatementEffectInspection
INSP.NAME.statement.effect=Statement has no effect
INSP.NAME.statement.message=Statement seems to have no effect
# PyStringExceptionInspection
INSP.NAME.raising.string.exception=Raising a string exception
# PySuperArgumentsInspection
INSP.NAME.wrong.super.arguments=Wrong arguments to call super
INSP.$0.is.not.superclass.of.$1=''{0}'' is not an instance or a subclass of ''{1}''
# PynonAsciiCharInspection
INSP.NAME.non.ascii=File contains non-ASCII character
# PyMandatoryEncodingInspection
INSP.NAME.mandatory.encoding=No encoding specified for file
# PyTupleItemAssignmentInspection
INSP.NAME.tuple.item.assignment=Tuple item assignment
INSP.tuples.never.assign.items=Tuples don't support item assignment
# PyPropertyAccessInspection
INSP.NAME.property.access=Access to properties
INSP.property.$0.cant.be.set=Property ''{0}'' cannot be set
INSP.property.$0.cant.be.read=Property ''{0}'' cannot be read
INSP.property.$0.cant.be.deleted=Property ''{0}'' cannot be deleted
# PyPropertyDefinitionInspection
INSP.NAME.property.definition=Property definitions
INSP.doc.param.should.be.str=The doc parameter should be a string
INSP.strange.arg.want.callable=Strange argument; a callable is expected
INSP.func.property.name.mismatch=Names of function and decorator don't match; property accessor is not created
INSP.getter.return.smth=Getter should return or yield something
INSP.setter.should.not.return=Setter should not return a value
INSP.deleter.should.not.return=Deleter should not return a value
INSP.getter.signature.advice=Getter signature should be (self)
INSP.setter.signature.advice=Setter signature should be (self, value)
INSP.deleter.signature.advice=Deleter signature should be (self)
INSP.accessor.first.param.is.$0=First parameter of an accessor is usually called ''{0}''
# PyProtectedMemberInspection
INSP.protected.member.$0.access=Access to a protected member {0} of a class
INSP.protected.member.$0.access.module=Access to a protected member {0} of a module
# PyOldStyleClassesInspection
INSP.NAME.oldstyle.class=Old-style class contains new-style class features
INSP.oldstyle.class.slots=Old-style class contains __slots__ definition
INSP.oldstyle.class.getattribute=Old-style class contains __getattribute__ definition
INSP.oldstyle.class.super=Old-style class contains call for super method
# PyCompatibilityInspection
INSP.NAME.compatibility=Code compatibility inspection
# PyUnnecessaryBackslashInspection
INSP.NAME.unnecessary.backslash=Unnecessary backslash
# PySingleQuotedDocstringInspection
INSP.NAME.single.quoted.docstring=Single quoted docstring
INSP.message.single.quoted.docstring=Triple double-quoted strings should be used for docstrings.
# PyMissingConstructorInspection
INSP.NAME.missing.super.constructor=Missed call to __init__ of super class
INSP.missing.super.constructor.message=Call to __init__ of super class is missed
# PySetFunctionToLiteralInspection
INSP.NAME.set.function.to.literal=Function call can be replaced with set literal
# PyDecoratorInspection
INSP.NAME.decorator.outside.class=Class specific decorator on method outside class
# PyPackageRequirementsInspection
INSP.NAME.requirements=Package requirements
# PyMethodMayBeStaticInspection
INSP.NAME.method.may.be.static=Method may be static
INSP.method.may.be.static=Method <code>#ref</code> may be 'static'
# PyClassHasNoInitInspection
INSP.NAME.class.has.no.init=Class has no __init__ method
INSP.class.has.no.init=Class has no __init__ method
INSP.parent.$0.has.no.init=Parent ''{0}'' has no __init__ method
#PyNoneFunctionAssignmentInspection
INSP.NAME.none.function.assignment=Assigning function call that doesn't return anything (None)
INSP.none.function.assignment=Function ''{0}'' doesn''t return anything
# PyTestParametrizedInspection
INSP.NAME.pytest-parametrized=Checks that functions decorated by pytest parametrize have correct arguments
# PyHighlightingAnnotator
INSP.python.trailing.suffix.not.support=Python does not support a trailing ''{0}''
INSP.compatibility.this.syntax.available.only.since.py3=This syntax available only since py3
INSP.compatibility.check.for.compatibility.with.python.versions=Check for compatibility with python versions:
INSP.docstring.types.fix.docstring=Fix docstring
INSP.docstring.types.change.type=Change {0} type from {1} to {2}
INSP.interpreter.configure.python.interpreter=Configure Python interpreter
INSP.interpreter.interpreter.settings=Interpreter settings
INSP.interpreter.use.interpreter=Use {0}
INSP.interpreter.use.suggested.interpreter=Use suggested interpreter
INSP.mandatory.encoding.encoding.comment.format=Encoding comment format:
INSP.mandatory.encoding.select.default.encoding=Select default encoding:
INSP.mandatory.encoding.no.encoding.specified.for.file=No encoding specified for file
INSP.method.parameters.metaclass.method.first.argument.name=Metaclass method first argument name
INSP.missing.type.hints.add.type.hints=Add type hints
INSP.missing.type.hints.add.type.hints.for=Add type hints for ''{0}''
INSP.missing.type.hints.only.when.types.are.known.collected.from.run.time.or.inferred=Only when types are known(collected from run-time or inferred)
form.debugger.save.call.signatures=Save call signatures
INSP.package.requirements.requirements.have.been.ignored=Requirements have been ignored
INSP.package.requirements.requirement.has.been.ignored=''{0}'' has been ignored
INSP.package.requirements.add.import=Add import
INSP.package.requirements.administrator.privileges.required=Administrator Privileges Required
INSP.package.requirements.administrator.privileges.required.description=\
Installing packages into ''{0}'' requires administrator privileges.\n\n\
Configure a per-project virtual environment as your project interpreter\n\
to avoid installing packages to a protected area of the file system.
INSP.package.requirements.administrator.privileges.required.button.configure=Configure
INSP.package.requirements.administrator.privileges.required.button.install.anyway=Install Anyway
INSP.pep8.ignore.base.class=Ignore base class
INSP.pep8.ignore.method.names.for.descendants.of.class=Ignore method names for descendants of class
INSP.protected.member.ignore.annotations=Ignore annotations
INSP.protected.member.ignore.test.functions=Ignore test functions
INSP.shadowing.builtins.ignore.shadowed.built.in.name=Ignore shadowed built-in name
INSP.stub.packages.compatibility.ignore=Ignore ''{0}'' compatibility
INSP.arguments.not.declared.but.provided.by.decorator=Following arguments are not declared but provided by decorator: {0}
INSP.abstract.class=Class must implement all abstract methods
INSP.assigning.function.call.that.doesnt.return.anything=Assigning function call that doesn't return anything
INSP.deprecated.function.class.or.module=Deprecated function, class or module
INSP.mandatory.encoding=No encoding specified for file
INSP.missing.type.hints=Missing type hinting for function definition
INSP.overloads.in.regular.python.files=Overloads in regular Python files
INSP.pep8.coding.style.violation=PEP 8 coding style violation
INSP.protected.member=Access to a protected member of a class or a module
INSP.protocol.definition.and.usages=Protocol definition and usages
INSP.shadowing.names=Shadowing names from outer scopes
INSP.stub.packages.compatibility=Stub packages compatibility inspection
INSP.stub.packages=Stub packages advertiser
INSP.type.checker=Type checker
INSP.type.hints=Type hints definitions and usages
INSP.typed.dict=TypedDict definition and usages
# Refactoring
refactoring.will.not.be.accessible=Member, you are trying to move depends on ''{0}'' which will not be accessible after this refactoring
refactoring.error.file.exists=File "{0}" already exists
@@ -1390,8 +1017,6 @@ looking.for.system.interpreter=Looking for a system-wide interpreter
looking.for.shared.conda.environment=Looking for a shared Conda environment
current.interpreter=Current Interpreter: {0}
python.facet.name=Python
enable.in.python.3=Enable in Python 3+
ignore.overridden.functions=Ignore overridden functions
choose.packages.to.install=Choose packages to install:
manage.python.packages=Manage Python Packages
interpreter=Interpreter:
@@ -115,6 +115,8 @@
<lang.ast.factory language="Python" implementationClass="com.jetbrains.python.psi.impl.PythonASTFactory"/>
<lang.inspectionSuppressor language="Python" implementationClass="com.jetbrains.python.inspections.PyInspectionsSuppressor"/>
<localInspection language="Python" shortName="PyUnusedLocalInspection" suppressId="PyUnusedLocal" bundle="messages.PyPsiBundle" key="INSP.NAME.unused" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.unusedLocal.PyUnusedLocalInspection"/>
<localInspection language="Python" shortName="PyRedundantParenthesesInspection" suppressId="PyRedundantParentheses" bundle="messages.PyPsiBundle" key="INSP.NAME.redundant.parentheses" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyRedundantParenthesesInspection"/>
<localInspection language="Python" shortName="PySimplifyBooleanCheckInspection" suppressId="PySimplifyBooleanCheck" bundle="messages.PyPsiBundle" key="INSP.NAME.check.can.be.simplified" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PySimplifyBooleanCheckInspection"/>
@@ -141,6 +143,55 @@
<localInspection language="Python" shortName="PyIncorrectDocstringInspection" suppressId="PyIncorrectDocstring" bundle="messages.PyPsiBundle" key="INSP.NAME.incorrect.docstring" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyIncorrectDocstringInspection"/>
<localInspection language="Python" shortName="PyMissingOrEmptyDocstringInspection" suppressId="PyMissingOrEmptyDocstring" bundle="messages.PyPsiBundle" key="INSP.NAME.missing.or.empty.docstring" groupKey="INSP.GROUP.python" enabledByDefault="false" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyMissingOrEmptyDocstringInspection"/>
<localInspection language="Python" shortName="PyNamedTupleInspection" suppressId="PyNamedTuple" bundle="messages.PyPsiBundle" key="INSP.named.tuple" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyNamedTupleInspection"/>
<localInspection language="Python" shortName="PyArgumentListInspection" suppressId="PyArgumentList" bundle="messages.PyPsiBundle" key="INSP.NAME.incorrect.call.arguments" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyArgumentListInspection"/>
<localInspection language="Python" shortName="PyRedeclarationInspection" suppressId="PyRedeclaration" bundle="messages.PyPsiBundle" key="INSP.NAME.redeclaration" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyRedeclarationInspection"/>
<localInspection language="Python" shortName="PyUnresolvedReferencesInspection" suppressId="PyUnresolvedReferences" bundle="messages.PyPsiBundle" key="INSP.NAME.unresolved.refs" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.unresolvedReference.PyUnresolvedReferencesInspection"/>
<localInspection language="Python" shortName="PyMethodParametersInspection" suppressId="PyMethodParameters" bundle="messages.PyPsiBundle" key="INSP.NAME.problematic.first.parameter" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyMethodParametersInspection"/>
<localInspection language="Python" shortName="PyUnreachableCodeInspection" suppressId="PyUnreachableCode" bundle="messages.PyPsiBundle" key="INSP.NAME.unreachable.code" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyUnreachableCodeInspection"/>
<localInspection language="Python" shortName="PyMethodFirstArgAssignmentInspection" suppressId="PyMethodFirstArgAssignment" bundle="messages.PyPsiBundle" key="INSP.NAME.first.arg.assign" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyMethodFirstArgAssignmentInspection"/>
<localInspection language="Python" shortName="PyStringFormatInspection" suppressId="PyStringFormat" bundle="messages.PyPsiBundle" key="INSP.NAME.str.format" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyStringFormatInspection"/>
<localInspection language="Python" shortName="PyMethodOverridingInspection" suppressId="PyMethodOverriding" bundle="messages.PyPsiBundle" key="INSP.NAME.method.over" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyMethodOverridingInspection"/>
<localInspection language="Python" shortName="PyInitNewSignatureInspection" suppressId="PyInitNewSignature" bundle="messages.PyPsiBundle" key="INSP.NAME.new.init.signature" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyInitNewSignatureInspection"/>
<localInspection language="Python" shortName="PyTrailingSemicolonInspection" suppressId="PyTrailingSemicolon" bundle="messages.PyPsiBundle" key="INSP.NAME.trailing.semicolon" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTrailingSemicolonInspection"/>
<localInspection language="Python" shortName="PyReturnFromInitInspection" suppressId="PyReturnFromInit" bundle="messages.PyPsiBundle" key="INSP.NAME.init.return" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyReturnFromInitInspection"/>
<localInspection language="Python" shortName="PyTupleAssignmentBalanceInspection" suppressId="PyTupleAssignmentBalance" bundle="messages.PyPsiBundle" key="INSP.NAME.incorrect.assignment" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTupleAssignmentBalanceInspection"/>
<localInspection language="Python" shortName="PyClassicStyleClassInspection" suppressId="PyClassicStyleClass" bundle="messages.PyPsiBundle" key="INSP.NAME.classic.class.usage" groupKey="INSP.GROUP.python" enabledByDefault="false" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyClassicStyleClassInspection"/>
<localInspection language="Python" shortName="PyExceptionInheritInspection" suppressId="PyExceptionInherit" bundle="messages.PyPsiBundle" key="INSP.NAME.exception.not.inherit" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyExceptionInheritInspection"/>
<localInspection language="Python" shortName="PyUnboundLocalVariableInspection" suppressId="PyUnboundLocalVariable" bundle="messages.PyPsiBundle" key="INSP.NAME.unbound" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyUnboundLocalVariableInspection"/>
<localInspection language="Python" shortName="PyStatementEffectInspection" suppressId="PyStatementEffect" bundle="messages.PyPsiBundle" key="INSP.NAME.statement.effect" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyStatementEffectInspection"/>
<localInspection language="Python" shortName="PyStringExceptionInspection" suppressId="PyStringException" bundle="messages.PyPsiBundle" key="INSP.NAME.raising.string.exception" groupKey="INSP.GROUP.python" enabledByDefault="true" level="ERROR" implementationClass="com.jetbrains.python.inspections.PyStringExceptionInspection"/>
<localInspection language="Python" shortName="PySuperArgumentsInspection" suppressId="PySuperArguments" bundle="messages.PyPsiBundle" key="INSP.NAME.wrong.super.arguments" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PySuperArgumentsInspection"/>
<localInspection language="Python" shortName="PyNonAsciiCharInspection" suppressId="PyNonAsciiChar" bundle="messages.PyPsiBundle" key="INSP.NAME.non.ascii" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyNonAsciiCharInspection"/>
<localInspection language="Python" shortName="PyTupleItemAssignmentInspection" suppressId="PyTupleItemAssignment" bundle="messages.PyPsiBundle" key="INSP.NAME.tuple.item.assignment" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTupleItemAssignmentInspection"/>
<localInspection language="Python" shortName="PyPropertyAccessInspection" suppressId="PyPropertyAccess" bundle="messages.PyPsiBundle" key="INSP.NAME.property.access" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyPropertyAccessInspection"/>
<localInspection language="Python" shortName="PyPropertyDefinitionInspection" suppressId="PyPropertyDefinition" bundle="messages.PyPsiBundle" key="INSP.NAME.property.definition" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyPropertyDefinitionInspection"/>
<localInspection language="Python" shortName="PyNestedDecoratorsInspection" suppressId="PyNestedDecorators" bundle="messages.PyPsiBundle" key="INSP.NAME.nested.decorators" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyNestedDecoratorsInspection"/>
<localInspection language="Python" shortName="PyOldStyleClassesInspection" suppressId="PyOldStyleClasses" bundle="messages.PyPsiBundle" key="INSP.NAME.oldstyle.class" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyOldStyleClassesInspection"/>
<localInspection language="Python" shortName="PyCompatibilityInspection" suppressId="PyCompatibility" bundle="messages.PyPsiBundle" key="INSP.NAME.compatibility" groupKey="INSP.GROUP.python" enabledByDefault="false" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyCompatibilityInspection"/>
<localInspection language="Python" shortName="PyListCreationInspection" suppressId="PyListCreation" bundle="messages.PyPsiBundle" key="INSP.NAME.list.creation" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyListCreationInspection"/>
<localInspection language="Python" shortName="PyUnnecessaryBackslashInspection" suppressId="PyUnnecessaryBackslash" bundle="messages.PyPsiBundle" key="INSP.NAME.unnecessary.backslash" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyUnnecessaryBackslashInspection"/>
<localInspection language="Python" shortName="PySingleQuotedDocstringInspection" suppressId="PySingleQuotedDocstring" bundle="messages.PyPsiBundle" key="INSP.NAME.single.quoted.docstring" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PySingleQuotedDocstringInspection"/>
<localInspection language="Python" shortName="PyMissingConstructorInspection" suppressId="PyMissingConstructor" bundle="messages.PyPsiBundle" key="INSP.NAME.missing.super.constructor" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyMissingConstructorInspection"/>
<localInspection language="Python" shortName="PySetFunctionToLiteralInspection" suppressId="PySetFunctionToLiteral" bundle="messages.PyPsiBundle" key="INSP.NAME.set.function.to.literal" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PySetFunctionToLiteralInspection"/>
<localInspection language="Python" shortName="PyDecoratorInspection" suppressId="PyDecorator" bundle="messages.PyPsiBundle" key="INSP.NAME.decorator.outside.class" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyDecoratorInspection"/>
<localInspection language="Python" shortName="PyTypeCheckerInspection" suppressId="PyTypeChecker" bundle="messages.PyPsiBundle" key="INSP.type.checker" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTypeCheckerInspection"/>
<localInspection language="Python" shortName="PyDeprecationInspection" suppressId="PyDeprecation" bundle="messages.PyPsiBundle" key="INSP.deprecated.function.class.or.module" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyDeprecationInspection"/>
<localInspection language="Python" shortName="PyMandatoryEncodingInspection" suppressId="PyMandatoryEncoding" bundle="messages.PyPsiBundle" key="INSP.mandatory.encoding" groupKey="INSP.GROUP.python" enabledByDefault="false" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyMandatoryEncodingInspection"/>
<localInspection language="Python" shortName="PyClassHasNoInitInspection" suppressId="PyClassHasNoInit" bundle="messages.PyPsiBundle" key="INSP.class.has.no.init" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyClassHasNoInitInspection"/>
<localInspection language="Python" shortName="PyNoneFunctionAssignmentInspection" suppressId="PyNoneFunctionAssignment" bundle="messages.PyPsiBundle" key="INSP.assigning.function.call.that.doesnt.return.anything" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyNoneFunctionAssignmentInspection"/>
<localInspection language="Python" shortName="PyProtectedMemberInspection" suppressId="PyProtectedMember" bundle="messages.PyPsiBundle" key="INSP.protected.member" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyProtectedMemberInspection"/>
<localInspection language="Python" shortName="PyMethodMayBeStaticInspection" suppressId="PyMethodMayBeStatic" bundle="messages.PyPsiBundle" key="INSP.method.may.be.static" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyMethodMayBeStaticInspection"/>
<localInspection language="Python" shortName="PyDocstringTypesInspection" suppressId="PyDocstringTypes" bundle="messages.PyPsiBundle" key="INSP.NAME.docstring.types" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyDocstringTypesInspection"/>
<localInspection language="Python" shortName="PyShadowingNamesInspection" suppressId="PyShadowingNames" bundle="messages.PyPsiBundle" key="INSP.shadowing.names" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyShadowingNamesInspection"/>
<localInspection language="Python" shortName="PyAbstractClassInspection" suppressId="PyAbstractClass" bundle="messages.PyPsiBundle" key="INSP.abstract.class" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyAbstractClassInspection"/>
<localInspection language="Python" shortName="PyMissingTypeHintsInspection" suppressId="PyMissingTypeHints" bundle="messages.PyPsiBundle" key="INSP.missing.type.hints" groupKey="INSP.GROUP.python" enabledByDefault="false" level="WEAK WARNING" implementationClass="com.jetbrains.python.inspections.PyMissingTypeHintsInspection"/>
<localInspection language="Python" shortName="PyOverloadsInspection" suppressId="PyOverloads" bundle="messages.PyPsiBundle" key="INSP.overloads.in.regular.python.files" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyOverloadsInspection"/>
<localInspection language="Python" shortName="PyProtocolInspection" suppressId="PyProtocol" bundle="messages.PyPsiBundle" key="INSP.protocol.definition.and.usages" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyProtocolInspection"/>
<localInspection language="Python" shortName="PyTypeHintsInspection" suppressId="PyTypeHints" bundle="messages.PyPsiBundle" key="INSP.type.hints" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTypeHintsInspection"/>
<localInspection language="Python" shortName="PyStubPackagesAdvertiser" suppressId="PyStubPackagesAdvertiser" bundle="messages.PyPsiBundle" key="INSP.stub.packages" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.codeInsight.typing.PyStubPackagesAdvertiser"/>
<localInspection language="Python" shortName="PyStubPackagesCompatibilityInspection" suppressId="PyStubPackagesCompatibility" bundle="messages.PyPsiBundle" key="INSP.stub.packages.compatibility" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.codeInsight.typing.PyStubPackagesCompatibilityInspection"/>
<localInspection language="Python" shortName="PyTypedDictInspection" suppressId="PyTypedDict" bundle="messages.PyPsiBundle" key="INSP.typed.dict" groupKey="INSP.GROUP.python" enabledByDefault="true" level="WARNING" implementationClass="com.jetbrains.python.inspections.PyTypedDictInspection"/>
</extensions>
@@ -101,6 +101,7 @@ can.t.assign.to.await.expression=can't assign to await expression
for.expected='for' expected
rarrow.expected='->' expected
unexpected.tokens=unexpected tokens
enable.in.python.3=Enable in Python 3+
PARSE.function.type.annotations.py2=Type annotations are unsupported in Python 2
PARSE.function.return.type.annotations.py2=Return type annotations are unsupported in Python 2
@@ -126,6 +127,56 @@ formatter.panel.dict.alignment.do.not.align=Do not align
formatter.panel.dict.alignment.align.on.colon=Align on colon
formatter.panel.dict.alignment.align.on.value=Align on value
ignore.overridden.functions=Ignore overridden functions
### Intentions ###
INTN.replace.octal.numeric.literal=Convert octal numeric literal to supported form
INTN.convert.builtin.import=Convert builtin module import to supported form
INTN.Family.convert.except.part=Convert except part to supported form
INTN.Family.convert.set.literal=Convert set literal two supported forms
INTN.Family.convert.builtin=Convert builtin module import
INTN.Family.convert.dict.comp.expression=Convert dictionary comprehension expression
INTN.Family.convert.string=Convert single-quoted string to double-quoted
INTN.convert.to.from.$0.import.$1=Convert to ''from {0} import {1}''
INTN.convert.to.import.$0=Convert to ''import {0}''
INTN.convert.except.to=Convert 'except exceptClass, Target' to 'except exceptClass as Target'
INTN.convert.set.literal.to=Convert set literal to 'set' method call
INTN.alias.for.$0.dialog.title=Alias for ''{0}'':
INTN.add.alias.for.import.$0=Add alias to ''{0}''
INTN.remove.alias.for.import.$0=Remove alias ''{0}''
INTN.Family.migration.to.python3=Migration to Python 3
INTN.replace.noteq.operator=Replace not equal operator
INTN.convert.dict.comp.to=Convert dictionary comprehension to 'dict' method call
INTN.remove.leading.$0=Remove leading {0}
INTN.remove.leading.prefix=Remove prefix
INTN.replace.backquote.expression=Replace backquote expression
INTN.replace.raise.statement=Convert raise statement to supported form
INTN.replace.list.comprehensions=Convert list comprehensions to supported form
### Quick fixes ###
QFIX.auto.import.family=Import
QFIX.auto.import.import.this.name=Import this name
QFIX.auto.import.import.name=Import ''{0}''
QFIX.local.auto.import.family=Import locally
QFIX.local.auto.import.import.locally={0} locally
QFIX.augment.assignment=Replace assignment with augmented assignment
QFIX.NAME.remove.call=Remove call
QFIX.replace.equality=Replace equality
QFIX.dict.creation=Replace dictionary creation
QFIX.NAME.remove.dict.key=Remove this key
QFIX.NAME.move.except.up=Move except clause up
QFIX.add.field.to.class=Add field to class
QFIX.added.constructor.$0.for.field.$1=Added a __init__ to class <code>{0}</code><br/>to accommodate new field <code>{1}</code>
QFIX.NAME.remove.parameter=Remove parameter
@@ -138,6 +189,48 @@ QFIX.simplify.boolean.expression=Simplify boolean expression
QFIX.simplify.$0=Replace boolean expression with ''{0}''
QFIX.chained.comparison=Simplify chained comparison
QFIX.move.from.future.import=Move 'from __future__ import' to a correct place
QFIX.list.creation=Replace list creation
QFIX.add.super=Add super class call
QFIX.NAME.remove.assignment=Remove assignment
QFIX.NAME.remove.argument=Remove argument
QFIX.add.parameter.self=Add parameter ''{0}''
QFIX.statement.effect=Replace with function call
QFIX.remove.trailing.semicolon=Remove trailing semicolon
QFIX.introduce.variable=Introduce variable for statement
QFIX.NAME.make.list=Replace tuple with list
QFIX.NAME.add.specifier=Add format specifier character
QFIX.NAME.wrap.in.exception=Wrap with Exception call
QFIX.add.global=Add global statement
QFIX.create.property=Create property
QFIX.replace.with.type.name=Replace with type name
QFIX.remove.function.annotations=Remove function annotations
QFIX.replace.with.target.name=Replace with target name
QFIX.remove.generic.parameters=Remove generic parameter(s)
QFIX.replace.with.square.brackets=Replace with square brackets
QFIX.surround.with.square.brackets=Surround with square brackets
QFIX.remove.square.brackets=Remove square brackets
QFIX.add.property=Add property for the field
QFIX.use.property=Use property for the field
QFIX.make.public=Make public
QFIX.NAME.update.parameters=Update parameters
QFIX.rename.parameter=Rename parameter
QFIX.convert.to.new.style=Convert to New-style class
QFIX.change.base.class=Change base class
QFIX.classic.class.transform=Inherit from object
QFIX.NAME.rename.argument=Rename argument
QFIX.NAME.add.exception.base=Add Exception base class
QFIX.add.encoding=Add encoding declaration
QFIX.remove.trailing.suffix=Remove trailing suffix
#PyRemoveUnderscoresInNumericLiteralsQuickFix
QFIX.NAME.remove.underscores.in.numeric=Remove underscores in numeric literals
# ReplaceFunctionWithSetLiteralQuickFix
QFIX.replace.function.set.with.literal=Replace function call with set literal
#RemoveArgumentEqualDefaultQuickFix
QFIX.remove.argument.equal.default=Remove arguments equal to default
@@ -154,14 +247,344 @@ QFIX.docstring.remove.$0=Remove docstring parameter ''{0}''
QFIX.docstring.insert.stub=Insert docstring
QFIX.fix.docstring=Fix docstring
#PyMakeMethodStaticQuickFix
QFIX.NAME.make.static=Make method static
#PyMakeFunctionFromMethodQuickFix
QFIX.NAME.make.function=Make function from method
#ConvertIndents
QFIX.convert.indents=Convert indents
QFIX.convert.indents.to.tabs=Convert indents to tabs
QFIX.convert.indents.to.spaces=Convert indents to spaces
# ConvertDocstringQuickFix
QFIX.convert.single.quoted.docstring=Convert docstring to the triple double-quoted string form
# RemoveUnnecessaryBackslashQuickFix
QFIX.remove.unnecessary.backslash=Remove unnecessary backslash in expression
#RemoveDecoratorQuickFix
QFIX.remove.decorator=Remove decorator
#PyMakeFunctionReturnTypeQuickFix
QFIX.NAME.make.$0.return.$1=Make ''{0}'' return ''{1}''
# Add method quick fix
QFIX.NAME.add.method.$0.to.class.$1=Add method {0}() to class {1}
QFIX.failed.to.add.method=<br/>Failed to add a method!<br/><br/>
QFIX.NAME.add.function.$0.to.module.$1=Create function {0}() in module {1}
QFIX.failed.to.add.function=<br/>Failed to add a function!<br/><br/>
QFIX.add.method.to.class=Add method to class
# Actions and associated commands
ACT.CMD.use.import=Use an imported module
ACT.qualify.with.module=Qualify with an imported module
ACT.from.some.module.import=Import from ...
python.docstring.file.type=python docstring
python.function.type.annotation.file.type.description=Python PEP-484 function type comment
### Inspections: INSP ###
INSP.GROUP.python=Python
INSP.compatibility.this.syntax.available.only.since.py3=This syntax available only since py3
INSP.compatibility.check.for.compatibility.with.python.versions=Check for compatibility with python versions:
INSP.abstract.class.set.as.metaclass=Set ''{0}'' as metaclass
INSP.abstract.class.add.to.superclasses=Add ''{0}'' to superclasses
INSP.pep8.naming=PEP 8 naming convention violation
INSP.shadowing.builtins=Shadowing built-ins
INSP.calling.non.callable=Trying to call a non-callable object
INSP.dataclass.definition.and.usages=Dataclass definition and usages
INSP.dunder.slots=Definition of __slots__ in a class
INSP.final.classes.methods.and.variables=Final classes, methods and variables
INSP.global.undefined=Global variable is undefined at the module level
INSP.inconsistent.indentation=Inconsistent indentation
INSP.named.tuple=Namedtuple definition
INSP.shadows.name.from.outer.scope=Shadows name ''{0}'' from outer scope
INSP.trailing.semicolon=Trailing semicolon in the statement
INSP.raising.string.exception=Raising a string exception
INSP.protected.member.ignore.annotations=Ignore annotations
INSP.protected.member.ignore.test.functions=Ignore test functions
INSP.docstring.types.fix.docstring=Fix docstring
INSP.docstring.types.change.type=Change {0} type from {1} to {2}
INSP.interpreter.configure.python.interpreter=Configure Python interpreter
INSP.interpreter.interpreter.settings=Interpreter settings
INSP.interpreter.use.interpreter=Use {0}
INSP.interpreter.use.suggested.interpreter=Use suggested interpreter
INSP.mandatory.encoding.encoding.comment.format=Encoding comment format:
INSP.mandatory.encoding.select.default.encoding=Select default encoding:
INSP.mandatory.encoding.no.encoding.specified.for.file=No encoding specified for file
INSP.method.parameters.metaclass.method.first.argument.name=Metaclass method first argument name
INSP.missing.type.hints.add.type.hints=Add type hints
INSP.missing.type.hints.add.type.hints.for=Add type hints for ''{0}''
INSP.missing.type.hints.only.when.types.are.known.collected.from.run.time.or.inferred=Only when types are known(collected from run-time or inferred)
form.debugger.save.call.signatures=Save call signatures
INSP.package.requirements.requirements.have.been.ignored=Requirements have been ignored
INSP.package.requirements.requirement.has.been.ignored=''{0}'' has been ignored
INSP.package.requirements.add.import=Add import
INSP.package.requirements.administrator.privileges.required=Administrator Privileges Required
INSP.package.requirements.administrator.privileges.required.description=\
Installing packages into ''{0}'' requires administrator privileges.\n\n\
Configure a per-project virtual environment as your project interpreter\n\
to avoid installing packages to a protected area of the file system.
INSP.package.requirements.administrator.privileges.required.button.configure=Configure
INSP.package.requirements.administrator.privileges.required.button.install.anyway=Install Anyway
INSP.pep8.ignore.base.class=Ignore base class
INSP.pep8.ignore.method.names.for.descendants.of.class=Ignore method names for descendants of class
INSP.shadowing.builtins.ignore.shadowed.built.in.name=Ignore shadowed built-in name
INSP.stub.packages.compatibility.ignore=Ignore ''{0}'' compatibility
INSP.arguments.not.declared.but.provided.by.decorator=Following arguments are not declared but provided by decorator: {0}
INSP.abstract.class=Class must implement all abstract methods
INSP.assigning.function.call.that.doesnt.return.anything=Assigning function call that doesn't return anything
INSP.deprecated.function.class.or.module=Deprecated function, class or module
INSP.mandatory.encoding=No encoding specified for file
INSP.missing.type.hints=Missing type hinting for function definition
INSP.overloads.in.regular.python.files=Overloads in regular Python files
INSP.pep8.coding.style.violation=PEP 8 coding style violation
INSP.protected.member=Access to a protected member of a class or a module
INSP.protocol.definition.and.usages=Protocol definition and usages
INSP.shadowing.names=Shadowing names from outer scopes
INSP.stub.packages.compatibility=Stub packages compatibility inspection
INSP.stub.packages=Stub packages advertiser
INSP.type.checker=Type checker
INSP.type.hints=Type hints definitions and usages
INSP.typed.dict=TypedDict definition and usages
# PyArgumentListInspection
INSP.NAME.incorrect.call.arguments=Incorrect call arguments
INSP.cannot.appear.past.keyword.arg=Cannot appear past keyword arguments or *arg or **kwarg
INSP.unexpected.arg=Unexpected argument
INSP.unexpected.arg(s)=Unexpected argument(s)
INSP.parameter.$0.unfilled=Parameter ''{0}'' unfilled
INSP.parameter(s).unfilled=Parameter(s) unfilled
INSP.possible.callees=Possible callees
INSP.func.$0.lacks.first.arg=Function ''{0}'' lacks a positional argument
INSP.expected.dict.got.$0=Expected a dictionary, got {0}
INSP.expected.iter.got.$0=Expected an iterable, got {0}
INSP.more.args.that.pos.params=Multiple values resolve to one positional parameter
INSP.multiple.values.resolve.to.positional.$0=Multiple values resolve to positional parameter ''{0}''
INSP.cannot.analyze=This argument list cannot be analyzed
# PyMethodParametersInspection
INSP.NAME.problematic.first.parameter=Methods having troubles with first parameter
INSP.must.have.first.parameter=Method must have a first parameter, usually called ''{0}''
INSP.probably.mistyped.self=Did not you mean 'self'?
INSP.usually.named.self=Usually first parameter of a method is named 'self'
INSP.usually.named.$0=Usually first parameter of such methods is named ''{0}''
INSP.first.param.must.not.be.tuple=First parameter of a non-static method must not be a tuple
# PyNestedDecoratorsInspection
INSP.NAME.nested.decorators=Problematic nesting of decorators
INSP.decorator.receives.unexpected.builtin=This decorator will not receive a callable it may expect; the built-in decorator returns a special object
# PyRedeclarationInspection
INSP.NAME.redeclaration=Redeclared names without usage
INSP.redeclared.name=Redeclared ''{0}'' defined above without usage
# PyUnresolvedReferencesInspection
INSP.try.except.import.error=''{0}'' in try block with ''except ImportError'' should also be defined in except block
INSP.unused.import.statement=Unused import statement <code>#ref</code>
# PyInterpreterInspection
INSP.NAME.invalid.interpreter=Invalid interpreter configured
# ReturnValueFromInitInspection
INSP.NAME.init.return=__init__ method that returns a value
INSP.cant.return.value.from.init=Cannot return a value from __init__
# PyUnreachableCodeInspection
INSP.NAME.unreachable.code=Unreachable code
INSP.unreachable.code=This code is unreachable
# PyStringFormatInspection
INSP.NAME.str.format=Errors in string formatting operations
INSP.format.requires.no.mapping=Format doesn't require a mapping
INSP.key.$0.has.no.arg=Key ''{0}'' has no corresponding argument
INSP.unexpected.type.$0=Unexpected type {0}
INSP.too.few.keys=Too few mapping keys
INSP.no.format.specifier.char=Format specifier character missing
INSP.format.requires.mapping=Format requires a mapping
INSP.too.many.args.for.fmt.string=Too many arguments for format string
INSP.too.few.args.for.fmt.string=Too few arguments for format string
INSP.incompatible.options=The format options in chunk "{0}" are incompatible
INSP.unused.mapping = Mapping key "{0}" is unused
INSP.unsupported.format.character=Unsupported format character ''{0}''
INSP.manual.to.auto.field.numbering=Cannot switch from manual field specification to automatic field numbering
INSP.auto.to.manual.field.numbering=Cannot switch from automatic field numbering to manual field specification
# PyMethodOverridingInspection
INSP.NAME.method.over=Method signature does not match signature of overridden method
INSP.signature.mismatch=Signature of method ''{0}'' does not match signature of base method in class ''{1}''
# PyInitNewSignatureInspection
INSP.NAME.new.init.signature=Incompatible signatures of __new__ and __init__
INSP.new.incompatible.to.init=Signature is not compatible to __init__
INSP.init.incompatible.to.new=Signature is not compatible to __new__
# PyTrailingSemicolonInspection
INSP.NAME.trailing.semicolon=Trailing semicolon in statement
# PyUnboundLocalVariableInspection
INSP.NAME.unbound=Unbound local variable
INSP.unbound.local.variable=Local variable ''{0}'' might be referenced before assignment
INSP.unbound.nonlocal.variable=Nonlocal variable ''{0}'' must be bound in an outer function scope
INSP.unbound.name.undefined=Name ''{0}'' can be undefined
INSP.unbound.function.too.large=Function ''{0}'' is too large to analyse
# PyListCreationInspection
INSP.NAME.list.creation=List creation could be rewritten by list literal
# PyTupleAssignmentBalanceInspection
INSP.NAME.incorrect.assignment=Tuple assignment balance is incorrect
# PyClassicStyleClassInspection
INSP.NAME.classic.class.usage=Classic style class usage
INSP.classic.class.usage.old.style.class=Old-style class
INSP.classic.class.usage.old.style.class.ancestors=Old-style class, because all classes from whom it inherits are old-style
# PyExceptionInheritance
INSP.NAME.exception.not.inherit=Exception doesn't inherit from standard ''Exception'' class
# PyDefaultArgumentInspection
INSP.NAME.default.argument=Default argument is mutable
# PyDocstringTypesInspection
INSP.NAME.docstring.types=Type in docstring doesn't match inferred type
# PyStatementEffectInspection
INSP.NAME.statement.effect=Statement has no effect
INSP.NAME.statement.message=Statement seems to have no effect
# PyStringExceptionInspection
INSP.NAME.raising.string.exception=Raising a string exception
# PySuperArgumentsInspection
INSP.NAME.wrong.super.arguments=Wrong arguments to call super
INSP.$0.is.not.superclass.of.$1=''{0}'' is not an instance or a subclass of ''{1}''
# PynonAsciiCharInspection
INSP.NAME.non.ascii=File contains non-ASCII character
# PyMandatoryEncodingInspection
INSP.NAME.mandatory.encoding=No encoding specified for file
# PyTupleItemAssignmentInspection
INSP.NAME.tuple.item.assignment=Tuple item assignment
INSP.tuples.never.assign.items=Tuples don't support item assignment
# PyPropertyAccessInspection
INSP.NAME.property.access=Access to properties
INSP.property.$0.cant.be.set=Property ''{0}'' cannot be set
INSP.property.$0.cant.be.read=Property ''{0}'' cannot be read
INSP.property.$0.cant.be.deleted=Property ''{0}'' cannot be deleted
# PyPropertyDefinitionInspection
INSP.NAME.property.definition=Property definitions
INSP.doc.param.should.be.str=The doc parameter should be a string
INSP.strange.arg.want.callable=Strange argument; a callable is expected
INSP.func.property.name.mismatch=Names of function and decorator don't match; property accessor is not created
INSP.getter.return.smth=Getter should return or yield something
INSP.setter.should.not.return=Setter should not return a value
INSP.deleter.should.not.return=Deleter should not return a value
INSP.getter.signature.advice=Getter signature should be (self)
INSP.setter.signature.advice=Setter signature should be (self, value)
INSP.deleter.signature.advice=Deleter signature should be (self)
INSP.accessor.first.param.is.$0=First parameter of an accessor is usually called ''{0}''
# PyProtectedMemberInspection
INSP.protected.member.$0.access=Access to a protected member {0} of a class
INSP.protected.member.$0.access.module=Access to a protected member {0} of a module
# PyOldStyleClassesInspection
INSP.NAME.oldstyle.class=Old-style class contains new-style class features
INSP.oldstyle.class.slots=Old-style class contains __slots__ definition
INSP.oldstyle.class.getattribute=Old-style class contains __getattribute__ definition
INSP.oldstyle.class.super=Old-style class contains call for super method
# PyCompatibilityInspection
INSP.NAME.compatibility=Code compatibility inspection
# PyUnnecessaryBackslashInspection
INSP.NAME.unnecessary.backslash=Unnecessary backslash
# PySingleQuotedDocstringInspection
INSP.NAME.single.quoted.docstring=Single quoted docstring
INSP.message.single.quoted.docstring=Triple double-quoted strings should be used for docstrings.
# PyMissingConstructorInspection
INSP.NAME.missing.super.constructor=Missed call to __init__ of super class
INSP.missing.super.constructor.message=Call to __init__ of super class is missed
# PySetFunctionToLiteralInspection
INSP.NAME.set.function.to.literal=Function call can be replaced with set literal
# PyDecoratorInspection
INSP.NAME.decorator.outside.class=Class specific decorator on method outside class
# PyPackageRequirementsInspection
INSP.NAME.requirements=Package requirements
# PyClassHasNoInitInspection
INSP.NAME.class.has.no.init=Class has no __init__ method
INSP.class.has.no.init=Class has no __init__ method
INSP.parent.$0.has.no.init=Parent ''{0}'' has no __init__ method
#PyNoneFunctionAssignmentInspection
INSP.NAME.none.function.assignment=Assigning function call that doesn't return anything (None)
INSP.none.function.assignment=Function ''{0}'' doesn''t return anything
# PyTestParametrizedInspection
INSP.NAME.pytest-parametrized=Checks that functions decorated by pytest parametrize have correct arguments
# PyUnusedLocalInspection
INSP.NAME.unused=Unused local
INSP.unused.locals.parameter.isnot.used=Parameter ''{0}'' value is not used
INSP.unused.locals.local.variable.isnot.used=Local variable ''{0}'' value is not used
INSP.unused.locals.replace.with.wildcard=Replace with _
INSP.unused.locals.local.function.isnot.used=Local function ''{0}'' is not used
INSP.unused.locals.local.class.isnot.used=Local class ''{0}'' is not used
INSP.unused.locals.ignore.variables.starting.with=Ignore variables starting with '_'
INSP.unused.locals.ignore.range.iteration.variables=Ignore range iteration variables
INSP.unused.locals.ignore.lambda.parameters=Ignore lambda parameters
INSP.unused.locals.ignore.variables.used.in.tuple.unpacking=Ignore variables used in tuple unpacking
# PyChainedComparsonsInspection
INSP.NAME.chained.comparisons=Chained comparisons can be simplified
# PyAugmentAssignmentInspection
INSP.NAME.augment.assignment=Assignment can be replaced with augmented assignment
# PyBroadExceptionInspection
INSP.NAME.too.broad.exception.clauses=Too broad exception clauses
# PyByteLiteralInspection
INSP.NAME.byte.literal=Byte literal contains characters > 255
# PyComparisonWithNoneInspection
INSP.NAME.comparison.with.none=Comparison with None performed with equality operators
# PyDictCreationInspection
INSP.NAME.dict.creation=Dictionary creation could be rewritten by dictionary literal
# PyDictDuplicateKeysInspection
INSP.NAME.duplicate.keys=Dictionary contains duplicate keys
# PyFromFutureImportInspection
INSP.NAME.from.future.import=from __future__ import must be the first executable statement
# PyMethodFirstArgAssignmentInspection
INSP.NAME.first.arg.assign=Reassignment of method's first argument
INSP.first.arg.$0.assigned=Method''s parameter ''{0}'' reassigned
# PyMethodMayBeStaticInspection
INSP.NAME.method.may.be.static=Method may be static
INSP.method.may.be.static=Method <code>#ref</code> may be 'static'
# PyAbstractClassInspection
INSP.NAME.abstract.class=Class must implement all abstract methods
@@ -229,77 +652,8 @@ INSP.class.$0.superclass.$1.already.caught=''{0}'', superclass of exception clas
INSP.NAME.global.undefined=Global variable is undefined at the module level
INSP.NAME.global.$0.undefined=Global variable ''{0}'' is undefined at the module level
# Actions and associated commands
ACT.CMD.use.import=Use an imported module
ACT.qualify.with.module=Qualify with an imported module
ACT.from.some.module.import=Import from ...
### Quick fixes ###
QFIX.auto.import.family=Import
QFIX.auto.import.import.this.name=Import this name
QFIX.auto.import.import.name=Import ''{0}''
QFIX.local.auto.import.family=Import locally
QFIX.local.auto.import.import.locally={0} locally
QFIX.augment.assignment=Replace assignment with augmented assignment
QFIX.NAME.remove.call=Remove call
QFIX.replace.equality=Replace equality
QFIX.dict.creation=Replace dictionary creation
QFIX.NAME.remove.dict.key=Remove this key
QFIX.NAME.move.except.up=Move except clause up
python.docstring.file.type=python docstring
python.function.type.annotation.file.type.description=Python PEP-484 function type comment
# PyUnusedLocalInspection
INSP.NAME.unused=Unused local
INSP.unused.locals.parameter.isnot.used=Parameter ''{0}'' value is not used
INSP.unused.locals.local.variable.isnot.used=Local variable ''{0}'' value is not used
INSP.unused.locals.replace.with.wildcard=Replace with _
INSP.unused.locals.local.function.isnot.used=Local function ''{0}'' is not used
INSP.unused.locals.local.class.isnot.used=Local class ''{0}'' is not used
INSP.unused.locals.ignore.variables.starting.with=Ignore variables starting with '_'
INSP.unused.locals.ignore.range.iteration.variables=Ignore range iteration variables
INSP.unused.locals.ignore.lambda.parameters=Ignore lambda parameters
INSP.unused.locals.ignore.variables.used.in.tuple.unpacking=Ignore variables used in tuple unpacking
INSP.abstract.class.set.as.metaclass=Set ''{0}'' as metaclass
INSP.abstract.class.add.to.superclasses=Add ''{0}'' to superclasses
INSP.pep8.naming=PEP 8 naming convention violation
INSP.shadowing.builtins=Shadowing built-ins
INSP.calling.non.callable=Trying to call a non-callable object
INSP.dataclass.definition.and.usages=Dataclass definition and usages
INSP.dunder.slots=Definition of __slots__ in a class
INSP.final.classes.methods.and.variables=Final classes, methods and variables
INSP.global.undefined=Global variable is undefined at the module level
INSP.inconsistent.indentation=Inconsistent indentation
INSP.named.tuple=Namedtuple definition
# PyDefaultArgumentInspection
INSP.NAME.default.argument=Default argument is mutable
# PyChainedComparsonsInspection
INSP.NAME.chained.comparisons=Chained comparisons can be simplified
# PyAugmentAssignmentInspection
INSP.NAME.augment.assignment=Assignment can be replaced with augmented assignment
# PyBroadExceptionInspection
INSP.NAME.too.broad.exception.clauses=Too broad exception clauses
# PyByteLiteralInspection
INSP.NAME.byte.literal=Byte literal contains characters > 255
# PyComparisonWithNoneInspection
INSP.NAME.comparison.with.none=Comparison with None performed with equality operators
# PyDictCreationInspection
INSP.NAME.dict.creation=Dictionary creation could be rewritten by dictionary literal
# PyDictDuplicateKeysInspection
INSP.NAME.duplicate.keys=Dictionary contains duplicate keys
# PyFromFutureImportInspection
INSP.NAME.from.future.import=from __future__ import must be the first executable statement
# PyHighlightingAnnotator
INSP.python.trailing.suffix.not.support=Python does not support a trailing ''{0}''
find.usages.unnamed=<unnamed>
find.usages.keyword.argument=keyword argument
@@ -1,10 +1,26 @@
package com.jetbrains.python;
import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.JDOMExternalizableStringList;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.util.Consumer;
import com.jetbrains.python.inspections.PyMandatoryEncodingInspection;
import com.jetbrains.python.psi.PyCallExpression;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.List;
@ApiStatus.Experimental
public class PythonUiService {
@@ -13,7 +29,7 @@ public class PythonUiService {
public void showBalloonError(Project project, String message) {}
public Editor openTextEditor(PsiFile file) {
public Editor openTextEditor(@NotNull Project project, VirtualFile virtualFile) {
return null;
}
@@ -21,7 +37,73 @@ public class PythonUiService {
return false;
}
public JComponent createCompatibilityInspectionOptionsPanel(@NotNull List<String> supportedInSettings,
JDOMExternalizableStringList ourVersions) {
return null;
}
public void runRenameProcessor(Project project, PsiElement element, String newName, boolean searchInComments, boolean searchTextOccurrences) {}
public LocalQuickFix createPyChangeSignatureQuickFixForMismatchingMethods(PyFunction function, PyFunction method) {
return null;
}
public LocalQuickFix createPyChangeSignatureQuickFixForMismatchedCall(@NotNull PyCallExpression.PyArgumentsMapping mapping) {
return null;
}
public LocalQuickFix createPyImplementMethodsQuickFix(PyClass aClass, List<PyFunction> toImplement) {
return null;
}
public JComponent createSingleCheckboxOptionsPanel(String label, InspectionProfileEntry inspection, String property) {
return null;
}
public void annotateTypesIntention(Editor editor, PyFunction function) {
}
@NotNull
public JComponent createEncodingsOptionsPanel(String[] possibleEncodings,
String defaultEncoding,
String[] possibleFormats,
int formatIndex,
Consumer<String> encodingChanged,
Consumer<Integer> formatIndexChanged) {
return null;
}
public JCheckBox createInspectionCheckBox(String message, InspectionProfileEntry inspection, String property) {
return null;
}
public <E> JComboBox<E> createComboBox(E[] items) {
return null;
}
public <E> JComboBox<E> createComboBox(E[] items, int width) {
return null;
}
public JComponent createListEditForm(String title, List<String> stringList) {
return null;
}
public static PythonUiService getInstance() {
return ServiceManager.getService(PythonUiService.class);
}
@Nullable
public LocalQuickFix createPyRenameElementQuickFix(@NotNull final PsiElement element) {
return null;
}
@Nullable
public JComponent createComboBoxWithLabel(@NotNull String label,
String[] items,
final String selectedItem,
Consumer<Object> selectedItemChanged) {
return null;
}
}
@@ -1,11 +1,17 @@
package com.jetbrains.python.codeInsight;
import com.intellij.find.findUsages.FindUsagesHandlerBase;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiNamedElement;
import com.intellij.usageView.UsageInfo;
import com.jetbrains.python.findUsages.PyPsiFindUsagesHandlerFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collections;
@@ -31,4 +37,18 @@ public class PyPsiIndexUtil {
}
return usages;
}
public static boolean isNotUnderSourceRoot(@NotNull final Project project, @Nullable final PsiFile psiFile) {
if (psiFile == null) {
return true;
}
final VirtualFile virtualFile = psiFile.getVirtualFile();
if (virtualFile != null) {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (fileIndex.isExcluded(virtualFile) || (fileIndex.isInLibraryClasses(virtualFile) && !fileIndex.isInContent(virtualFile))) {
return true;
}
}
return false;
}
}
@@ -13,8 +13,6 @@ import java.util.List;
import java.util.stream.Collectors;
public abstract class PySignatureCacheManager {
static final String RETURN_TYPE = "<RETURN_TYPE>";
public static PySignatureCacheManager getInstance(Project project) {
@@ -0,0 +1,36 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.jetbrains.python.editor;
import com.intellij.psi.PsiComment;
import com.jetbrains.python.psi.*;
public class PyEditorHandlerConfig {
private PyEditorHandlerConfig() {
}
public static final Class[] IMPLICIT_WRAP_CLASSES = new Class[] {
PyListLiteralExpression.class,
PySetLiteralExpression.class,
PyDictLiteralExpression.class,
PyDictLiteralExpression.class,
PyParenthesizedExpression.class,
PyArgumentList.class,
PyParameterList.class
};
static final Class[] WRAPPABLE_CLASSES = new Class[]{
PsiComment.class,
PyParenthesizedExpression.class,
PyListCompExpression.class,
PyDictCompExpression.class,
PySetCompExpression.class,
PyDictLiteralExpression.class,
PySetLiteralExpression.class,
PyListLiteralExpression.class,
PyArgumentList.class,
PyParameterList.class,
PyDecoratorList.class,
PySliceExpression.class,
PySubscriptionExpression.class,
PyGeneratorExpression.class
};
}
@@ -11,8 +11,8 @@ import com.intellij.psi.PsiElementVisitor;
import com.intellij.util.SmartList;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.codeInsight.typing.PyProtocolsKt;
import com.jetbrains.python.inspections.quickfix.PyImplementMethodsQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.types.PyClassLikeType;
import com.jetbrains.python.psi.types.TypeEvalContext;
@@ -46,10 +46,13 @@ public class PyAbstractClassInspection extends PyInspection {
final List<PyFunction> toImplement = PyPsiRefactoringUtil.getAllSuperAbstractMethods(pyClass, myTypeEvalContext);
final ASTNode nameNode = pyClass.getNameNode();
if (!toImplement.isEmpty() && nameNode != null) {
final SmartList<LocalQuickFix> quickFixes = new SmartList<>(
new PyImplementMethodsQuickFix(pyClass, toImplement),
new SetABCMetaAsMetaclassQuickFix()
);
final SmartList<LocalQuickFix> quickFixes = new SmartList<>();
LocalQuickFix qf = PythonUiService.getInstance().createPyImplementMethodsQuickFix(pyClass, toImplement);
if (qf != null) {
quickFixes.add(qf);
}
quickFixes.add(new SetABCMetaAsMetaclassQuickFix());
if (LanguageLevel.forElement(pyClass).isPy3K()) {
quickFixes.add(new AddABCToSuperclassesQuickFix());
@@ -14,17 +14,17 @@ import com.intellij.psi.ResolveResult;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.xml.util.XmlStringUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.inspections.quickfix.PyChangeSignatureQuickFix;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.codeInsight.PyPsiIndexUtil;
import com.jetbrains.python.inspections.quickfix.PyRemoveArgumentQuickFix;
import com.jetbrains.python.inspections.quickfix.PyRenameArgumentQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.ParamHelper;
import com.jetbrains.python.psi.resolve.PyResolveContext;
import com.jetbrains.python.psi.types.*;
import com.jetbrains.python.refactoring.changeSignature.PyChangeSignatureHandler;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -74,7 +74,7 @@ public class PyArgumentListInspection extends PyInspection {
final PyCallableParameter allegedFirstParam = ContainerUtil.getOrElse(params, firstParamOffset - 1, null);
if (allegedFirstParam == null || allegedFirstParam.isKeywordContainer()) {
// no parameters left to pass function implicitly, or wrong param type
registerProblem(deco, PyBundle.message("INSP.func.$0.lacks.first.arg", callable.getName())); // TODO: better names for anon lambdas
registerProblem(deco, PyPsiBundle.message("INSP.func.$0.lacks.first.arg", callable.getName())); // TODO: better names for anon lambdas
}
else { // possible unfilled params
for (int i = firstParamOffset; i < params.size(); i++) {
@@ -85,7 +85,7 @@ public class PyArgumentListInspection extends PyInspection {
// param tuples, non-starred or non-default won't do
if (!parameter.isKeywordContainer() && !parameter.isPositionalContainer() && !parameter.hasDefaultValue()) {
final String parameterName = parameter.getName();
registerProblem(deco, PyBundle.message("INSP.parameter.$0.unfilled", parameterName == null ? "(...)" : parameterName));
registerProblem(deco, PyPsiBundle.message("INSP.parameter.$0.unfilled", parameterName == null ? "(...)" : parameterName));
}
}
}
@@ -195,12 +195,12 @@ public class PyArgumentListInspection extends PyInspection {
if (inside_type != null && !PyTypeChecker.isUnknown(inside_type, context)) {
if (((PyStarArgument)arg).isKeyword()) {
if (!PyABCUtil.isSubtype(inside_type, PyNames.MAPPING, context)) {
holder.registerProblem(arg, PyBundle.message("INSP.expected.dict.got.$0", inside_type.getName()));
holder.registerProblem(arg, PyPsiBundle.message("INSP.expected.dict.got.$0", inside_type.getName()));
}
}
else { // * arg
if (!PyABCUtil.isSubtype(inside_type, PyNames.ITERABLE, context)) {
holder.registerProblem(arg, PyBundle.message("INSP.expected.iter.got.$0", inside_type.getName()));
holder.registerProblem(arg, PyPsiBundle.message("INSP.expected.iter.got.$0", inside_type.getName()));
}
}
}
@@ -240,9 +240,9 @@ public class PyArgumentListInspection extends PyInspection {
if (callableType != null) {
final PyCallable callable = callableType.getCallable();
final Project project = node.getProject();
if (callable instanceof PyFunction && !PyChangeSignatureHandler.isNotUnderSourceRoot(project, callable.getContainingFile())) {
final String message = PyBundle.message("INSP.unexpected.arg(s)");
holder.registerProblem(node, message, ProblemHighlightType.INFORMATION, PyChangeSignatureQuickFix.forMismatchedCall(mapping));
if (callable instanceof PyFunction && !PyPsiIndexUtil.isNotUnderSourceRoot(project, callable.getContainingFile())) {
final String message = PyPsiBundle.message("INSP.unexpected.arg(s)");
holder.registerProblem(node, message, ProblemHighlightType.INFORMATION, PythonUiService.getInstance().createPyChangeSignatureQuickFixForMismatchedCall(mapping));
}
}
}
@@ -257,7 +257,7 @@ public class PyArgumentListInspection extends PyInspection {
quickFixes.add(new PyRenameArgumentQuickFix());
}
holder.registerProblem(argument,
PyBundle.message("INSP.unexpected.arg"),
PyPsiBundle.message("INSP.unexpected.arg"),
quickFixes.toArray(new LocalQuickFix[quickFixes.size() - 1]));
}
}
@@ -265,7 +265,7 @@ public class PyArgumentListInspection extends PyInspection {
// all mappings have unmapped arguments so we couldn't determine desired argument list and suggest appropriate quick fixes
holder.registerProblem(
node,
addPossibleCalleesRepresentation(PyBundle.message("INSP.unexpected.arg(s)"), mappings, context, holder.isOnTheFly())
addPossibleCalleesRepresentation(PyPsiBundle.message("INSP.unexpected.arg(s)"), mappings, context, holder.isOnTheFly())
);
}
}
@@ -286,7 +286,7 @@ public class PyArgumentListInspection extends PyInspection {
ContainerUtil.exists(mappings.get(0).getUnmappedParameters(), parameter -> parameter.getName() == null)) {
holder.registerProblem(
psi,
addPossibleCalleesRepresentation(PyBundle.message("INSP.parameter(s).unfilled"), mappings, context, holder.isOnTheFly())
addPossibleCalleesRepresentation(PyPsiBundle.message("INSP.parameter(s).unfilled"), mappings, context, holder.isOnTheFly())
);
}
else {
@@ -294,7 +294,7 @@ public class PyArgumentListInspection extends PyInspection {
.of(mappings.get(0).getUnmappedParameters())
.map(PyCallableParameter::getName)
.filter(Objects::nonNull)
.forEach(name -> holder.registerProblem(psi, PyBundle.message("INSP.parameter.$0.unfilled", name)));
.forEach(name -> holder.registerProblem(psi, PyPsiBundle.message("INSP.parameter.$0.unfilled", name)));
}
}
);
@@ -311,13 +311,13 @@ public class PyArgumentListInspection extends PyInspection {
if (isOnTheFly) {
return XmlStringUtil.wrapInHtml(
prefix + separator +
PyBundle.message("INSP.possible.callees") + ":" + separator +
PyPsiBundle.message("INSP.possible.callees") + ":" + separator +
possibleCalleesRepresentation
);
}
else {
return prefix + "." + separator +
PyBundle.message("INSP.possible.callees") + ":" + separator +
PyPsiBundle.message("INSP.possible.callees") + ":" + separator +
possibleCalleesRepresentation;
}
}
@@ -20,15 +20,14 @@ import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.codeInsight.typing.PyTypedDictTypeProvider;
import com.jetbrains.python.inspections.quickfix.AddMethodQuickFix;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import com.jetbrains.python.psi.types.PyClassLikeType;
import com.jetbrains.python.psi.types.PyClassType;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -71,7 +70,7 @@ public class PyClassHasNoInitInspection extends PyInspection {
final PyFunction init = node.findInitOrNew(true, myTypeEvalContext);
if (init == null) {
registerProblem(node.getNameIdentifier(), PyBundle.message("INSP.class.has.no.init"),
registerProblem(node.getNameIdentifier(), PyPsiBundle.message("INSP.class.has.no.init"),
new AddMethodQuickFix(PyNames.INIT, node.getName(), false));
}
}
@@ -19,7 +19,7 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.TransformClassicClassQuickFix;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyExpression;
@@ -56,9 +56,9 @@ public class PyClassicStyleClassInspection extends PyInspection {
if (!node.isNewStyleClass(myTypeEvalContext) && nameNode != null) {
PyExpression[] superClassExpressions = node.getSuperClassExpressions();
if (superClassExpressions.length == 0) {
registerProblem(nameNode.getPsi(), PyBundle.message("INSP.classic.class.usage.old.style.class"), new TransformClassicClassQuickFix());
registerProblem(nameNode.getPsi(), PyPsiBundle.message("INSP.classic.class.usage.old.style.class"), new TransformClassicClassQuickFix());
} else {
registerProblem(nameNode.getPsi(), PyBundle.message("INSP.classic.class.usage.old.style.class.ancestors"));
registerProblem(nameNode.getPsi(), PyPsiBundle.message("INSP.classic.class.usage.old.style.class.ancestors"));
}
}
}
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.InspectionProfile;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.ide.util.ElementsChooser;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.JDOMExternalizableStringList;
@@ -32,9 +31,9 @@ import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.QualifiedName;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.inspections.quickfix.PyRenameElementQuickFix;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyBuiltinCache;
import com.jetbrains.python.psi.types.PyClassType;
@@ -44,13 +43,10 @@ import com.jetbrains.python.psi.types.TypeEvalContext;
import com.jetbrains.python.validation.CompatibilityVisitor;
import com.jetbrains.python.validation.UnsupportedFeaturesUtil;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.List;
import java.util.*;
/**
@@ -121,22 +117,7 @@ public class PyCompatibilityInspection extends PyInspection {
@Override
public JComponent createOptionsPanel() {
final ElementsChooser<String> chooser = new ElementsChooser<>(true);
chooser.setElements(SUPPORTED_IN_SETTINGS, false);
chooser.markElements(ContainerUtil.filter(ourVersions, SUPPORTED_IN_SETTINGS::contains));
chooser.addElementsMarkListener(new ElementsChooser.ElementsMarkListener<String>() {
@Override
public void elementMarkChanged(String element, boolean isMarked) {
ourVersions.clear();
ourVersions.addAll(chooser.getMarkedElements());
}
});
final JPanel versionPanel = new JPanel(new BorderLayout());
JLabel label = new JLabel(PyBundle.message("INSP.compatibility.check.for.compatibility.with.python.versions"));
label.setLabelFor(chooser);
versionPanel.add(label, BorderLayout.PAGE_START);
versionPanel.add(chooser);
return versionPanel;
return PythonUiService.getInstance().createCompatibilityInspectionOptionsPanel(SUPPORTED_IN_SETTINGS, ourVersions);
}
@NotNull
@@ -297,7 +278,7 @@ public class PyCompatibilityInspection extends PyInspection {
.stream(node.getArguments())
.filter(PyKeywordArgument.class::isInstance)
.forEach(expression -> myHolder.registerProblem(expression,
PyBundle.message("INSP.compatibility.this.syntax.available.only.since.py3"),
PyPsiBundle.message("INSP.compatibility.this.syntax.available.only.since.py3"),
!isPython2
? ProblemHighlightType.GENERIC_ERROR_OR_WARNING
: ProblemHighlightType.GENERIC_ERROR));
@@ -374,7 +355,7 @@ public class PyCompatibilityInspection extends PyInspection {
registerForAllMatchingVersions(level -> level.isAtLeast(LanguageLevel.PYTHON37),
" not allow 'async' and 'await' as names",
nameIdentifier,
new PyRenameElementQuickFix(nameIdentifierOwner));
PythonUiService.getInstance().createPyRenameElementQuickFix(nameIdentifierOwner));
}
}
@@ -18,13 +18,11 @@ package com.jetbrains.python.inspections;
import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.inspections.quickfix.RemoveDecoratorQuickFix;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyDecorator;
import com.jetbrains.python.psi.PyDecoratorList;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -7,8 +7,8 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.SmartPointerManager;
import com.intellij.psi.SmartPsiElementPointer;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.debugger.PySignature;
import com.jetbrains.python.debugger.PySignatureCacheManager;
import com.jetbrains.python.documentation.docstrings.DocStringUtil;
@@ -141,13 +141,13 @@ public class PyDocstringTypesInspection extends PyInspection {
@NotNull
@Override
public String getName() {
return PyBundle.message("INSP.docstring.types.change.type", myParamName, myTypeSubstring.getValue(), myNewType);
return PyPsiBundle.message("INSP.docstring.types.change.type", myParamName, myTypeSubstring.getValue(), myNewType);
}
@NotNull
@Override
public String getFamilyName() {
return PyBundle.message("INSP.docstring.types.fix.docstring");
return PyPsiBundle.message("INSP.docstring.types.fix.docstring");
}
@Override
@@ -15,11 +15,6 @@
*/
package com.jetbrains.python.inspections;
import com.jetbrains.python.PyBundle;
import javax.swing.*;
import java.awt.*;
/**
* User : catherine
*/
@@ -39,36 +34,4 @@ public class PyEncodingUtil {
public static String[] ENCODING_FORMAT = new String[]{"# coding=<encoding name>", "# -*- coding: <encoding name> -*-", "# vim: set fileencoding=<encoding name> :"};
public static String[] ENCODING_FORMAT_PATTERN = new String[]{"# coding=%s", "# -*- coding: %s -*-", "# vim: set fileencoding=%s :"};
public static JComponent createEncodingOptionsPanel(JComboBox defaultEncoding, JComboBox encodingFormat) {
final JPanel optionsPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.NORTH;
c.gridx = 0;
c.gridy = 0;
final JLabel encodingLabel = new JLabel(PyBundle.message("code.insight.select.default.encoding"));
final JPanel encodingPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
encodingPanel.add(encodingLabel);
optionsPanel.add(encodingPanel, c);
c.gridx = 1;
c.gridy = 0;
optionsPanel.add(defaultEncoding, c);
c.gridx = 0;
c.gridy = 1;
c.weighty = 1;
final JLabel formatLabel = new JLabel(PyBundle.message("code.insight.encoding.comment.format"));
final JPanel formatPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
formatPanel.add(formatLabel);
optionsPanel.add(formatPanel, c);
c.gridx = 1;
c.gridy = 1;
optionsPanel.add(encodingFormat, c);
return optionsPanel;
}
}
@@ -55,7 +55,6 @@ public class PyExceptionInheritInspection extends PyInspection {
PyExpression callee = ((PyCallExpression)expression).getCallee();
if (callee instanceof PyReferenceExpression) {
final PsiPolyVariantReference reference = ((PyReferenceExpression)callee).getReference(getResolveContext());
if (reference == null) return;
PsiElement psiElement = reference.resolve();
if (psiElement instanceof PyClass) {
PyClass aClass = (PyClass) psiElement;
@@ -68,7 +67,7 @@ public class PyExceptionInheritInspection extends PyInspection {
return;
}
}
registerProblem(expression, "Exception doesn't inherit from base \'Exception\' class", new PyAddExceptionSuperClassQuickFix());
registerProblem(expression, "Exception doesn't inherit from base 'Exception' class", new PyAddExceptionSuperClassQuickFix());
}
}
}
@@ -6,14 +6,13 @@ import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.inspections.quickfix.PyChangeSignatureQuickFix;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import com.jetbrains.python.psi.PyParameterList;
import com.jetbrains.python.psi.PyUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -55,7 +54,8 @@ public class PyInitNewSignatureInspection extends PyInspection {
}
if (complementaryMethods.size() == 1) {
registerIncompatibilityProblem(node, PyChangeSignatureQuickFix.forMismatchingMethods(node, complementaryMethods.get(0)));
registerIncompatibilityProblem(node, PythonUiService.getInstance().createPyChangeSignatureQuickFixForMismatchingMethods(
node, complementaryMethods.get(0)));
}
else if (!complementaryMethods.isEmpty()) {
registerIncompatibilityProblem(node, null);
@@ -83,8 +83,8 @@ public class PyInitNewSignatureInspection extends PyInspection {
private void registerIncompatibilityProblem(@NotNull PyFunction function, @Nullable LocalQuickFix quickFix) {
final PyParameterList parameterList = function.getParameterList();
final String message = PyBundle.message(PyUtil.isNewMethod(function) ? "INSP.new.incompatible.to.init"
: "INSP.init.incompatible.to.new");
final String message = PyPsiBundle.message(PyUtil.isNewMethod(function) ? "INSP.new.incompatible.to.init"
: "INSP.init.incompatible.to.new");
if (quickFix != null) {
registerProblem(parameterList, message, quickFix);
}
@@ -19,10 +19,8 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.inspections.quickfix.ListCreationQuickFix;
import com.jetbrains.python.psi.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -17,12 +17,11 @@ package com.jetbrains.python.inspections;
import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.util.ui.CheckBox;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonFileType;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.inspections.quickfix.AddEncodingQuickFix;
import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.psi.PyFile;
@@ -66,8 +65,8 @@ public class PyMandatoryEncodingInspection extends PyInspection {
TextRange tr = new TextRange(0,0);
ProblemsHolder holder = getHolder();
if (holder != null)
holder.registerProblem(node, tr, PyBundle.message("INSP.mandatory.encoding.no.encoding.specified.for.file"), new AddEncodingQuickFix(myDefaultEncoding,
myEncodingFormatIndex));
holder.registerProblem(node, tr, PyPsiBundle.message("INSP.mandatory.encoding.no.encoding.specified.for.file"),
new AddEncodingQuickFix(myDefaultEncoding, myEncodingFormatIndex));
}
}
}
@@ -120,20 +119,20 @@ public class PyMandatoryEncodingInspection extends PyInspection {
@NotNull
private JPanel onlyPython2Box() {
final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
panel.add(new CheckBox(PyBundle.message("enable.in.python.3"), this, "myAllPythons"));
panel.add(PythonUiService.getInstance().createInspectionCheckBox(PyPsiBundle.message("enable.in.python.3"), this, "myAllPythons"));
return panel;
}
@NotNull
private static JPanel defaultEncodingLabel() {
final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
panel.add(new JLabel(PyBundle.message("INSP.mandatory.encoding.select.default.encoding")));
panel.add(new JLabel(PyPsiBundle.message("INSP.mandatory.encoding.select.default.encoding")));
return panel;
}
@NotNull
private JComboBox<String> defaultEncodingBox() {
final JComboBox<String> box = new ComboBox<>(PyEncodingUtil.POSSIBLE_ENCODINGS);
final JComboBox<String> box = PythonUiService.getInstance().createComboBox(PyEncodingUtil.POSSIBLE_ENCODINGS);
box.setSelectedItem(myDefaultEncoding);
box.addActionListener(new ActionListener() {
@@ -150,13 +149,13 @@ public class PyMandatoryEncodingInspection extends PyInspection {
@NotNull
private static JPanel encodingFormatLabel() {
final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
panel.add(new JLabel(PyBundle.message("INSP.mandatory.encoding.encoding.comment.format")));
panel.add(new JLabel(PyPsiBundle.message("INSP.mandatory.encoding.encoding.comment.format")));
return panel;
}
@NotNull
private JComboBox<String> encodingFormatBox() {
final JComboBox<String> box = new ComboBox<>(PyEncodingUtil.ENCODING_FORMAT, 250);
final JComboBox<String> box = PythonUiService.getInstance().createComboBox(PyEncodingUtil.ENCODING_FORMAT, 250);
box.setSelectedIndex(myEncodingFormatIndex);
box.addActionListener(new ActionListener() {
@@ -6,7 +6,7 @@ import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiNamedElement;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.psi.*;
import org.jetbrains.annotations.NotNull;
@@ -34,7 +34,7 @@ public class PyMethodFirstArgAssignmentInspection extends PyInspection {
}
private void complain(PsiElement element, String name) {
registerProblem(element, PyBundle.message("INSP.first.arg.$0.assigned", name));
registerProblem(element, PyPsiBundle.message("INSP.first.arg.$0.assigned", name));
}
private void handleTarget(PyQualifiedExpression target, String name) {
@@ -20,14 +20,13 @@ import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.PyMakeFunctionFromMethodQuickFix;
import com.jetbrains.python.inspections.quickfix.PyMakeMethodStaticQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.search.PyOverridingMethodsSearch;
import com.jetbrains.python.psi.search.PySuperMethodsSearch;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -125,7 +124,7 @@ public class PyMethodMayBeStaticInspection extends PyInspection {
node.accept(visitor);
final PsiElement identifier = node.getNameIdentifier();
if (mayBeStatic[0] && identifier != null) {
registerProblem(identifier, PyBundle.message("INSP.method.may.be.static"), ProblemHighlightType.WEAK_WARNING,
registerProblem(identifier, PyPsiBundle.message("INSP.method.may.be.static"), ProblemHighlightType.WEAK_WARNING,
null, new PyMakeMethodStaticQuickFix(), new PyMakeFunctionFromMethodQuickFix());
}
}
@@ -6,14 +6,13 @@ import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.inspections.quickfix.PyChangeSignatureQuickFix;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import com.jetbrains.python.psi.PyKnownDecoratorUtil;
import com.jetbrains.python.psi.PyUtil;
import com.jetbrains.python.psi.search.PySuperMethodsSearch;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,10 +50,10 @@ public class PyMethodOverridingInspection extends PyInspection {
final PyFunction baseMethod = (PyFunction)psiElement;
if (!PyUtil.isSignatureCompatibleTo(function, baseMethod, myTypeEvalContext)) {
final PyClass baseClass = baseMethod.getContainingClass();
final String msg = PyBundle.message("INSP.signature.mismatch",
final String msg = PyPsiBundle.message("INSP.signature.mismatch",
cls.getName() + "." + function.getName() + "()",
baseClass != null ? baseClass.getName() : "");
registerProblem(function.getParameterList(), msg, PyChangeSignatureQuickFix.forMismatchingMethods(function, baseMethod));
registerProblem(function.getParameterList(), msg, PythonUiService.getInstance().createPyChangeSignatureQuickFixForMismatchingMethods(function, baseMethod));
}
}
}
@@ -7,27 +7,24 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.ui.ComboBox;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.inspections.quickfix.AddSelfQuickFix;
import com.jetbrains.python.inspections.quickfix.RenameParameterQuickFix;
import com.jetbrains.python.psi.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Looks for the 'self' or its equivalents.
*
* @author dcheryasov
*/
public class PyMethodParametersInspection extends PyInspection {
@@ -45,23 +42,11 @@ public class PyMethodParametersInspection extends PyInspection {
public JComponent createOptionsPanel() {
//TODO: simplify this (drop this?)
// it should offer only one default option mcs or metacls, inspection should accept both
ComboBox comboBox = new ComboBox<>(new String[] {"mcs", "metacls"});
comboBox.setSelectedItem(MCS);
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
ComboBox cb = (ComboBox)e.getSource();
MCS = (String)cb.getSelectedItem();
}
});
JPanel option = new JPanel(new BorderLayout());
option.add(new JLabel(PyBundle.message("INSP.method.parameters.metaclass.method.first.argument.name")), BorderLayout.WEST);
option.add(comboBox, BorderLayout.EAST);
final JPanel root = new JPanel(new BorderLayout());
root.add(option, BorderLayout.PAGE_START);
return root;
return PythonUiService.getInstance().createComboBoxWithLabel(PyPsiBundle.message("INSP.method.parameters.metaclass.method.first.argument.name"),
new String[]{"mcs", "metacls"}, MCS,
item -> {
MCS = (String)item;
});
}
@Override
@@ -127,7 +112,7 @@ public class PyMethodParametersInspection extends PyInspection {
paramName = PyNames.CANONICAL_SELF;
}
registerProblem(
plist, PyBundle.message("INSP.must.have.first.parameter", paramName),
plist, PyPsiBundle.message("INSP.must.have.first.parameter", paramName),
ProblemHighlightType.GENERIC_ERROR, null, new AddSelfQuickFix(paramName)
);
}
@@ -145,7 +130,7 @@ public class PyMethodParametersInspection extends PyInspection {
if (PyUtil.among(pname, mangled)) {
registerProblem(
PyUtil.sure(params[0].getNode()).getPsi(),
PyBundle.message("INSP.probably.mistyped.self"),
PyPsiBundle.message("INSP.probably.mistyped.self"),
new RenameParameterQuickFix(PyNames.CANONICAL_SELF)
);
return;
@@ -169,7 +154,7 @@ public class PyMethodParametersInspection extends PyInspection {
if (!expectedName.equals(pname) && (alternativeName == null || !alternativeName.equals(pname))) {
registerProblem(
PyUtil.sure(params[0].getNode()).getPsi(),
PyBundle.message("INSP.usually.named.$0", expectedName),
PyPsiBundle.message("INSP.usually.named.$0", expectedName),
new RenameParameterQuickFix(expectedName)
);
}
@@ -178,7 +163,7 @@ public class PyMethodParametersInspection extends PyInspection {
if (!CLS.equals(pname)) {
registerProblem(
PyUtil.sure(params[0].getNode()).getPsi(),
PyBundle.message("INSP.usually.named.$0", CLS),
PyPsiBundle.message("INSP.usually.named.$0", CLS),
new RenameParameterQuickFix(CLS)
);
}
@@ -189,19 +174,18 @@ public class PyMethodParametersInspection extends PyInspection {
}
registerProblem(
PyUtil.sure(params[0].getNode()).getPsi(),
PyBundle.message("INSP.usually.named.self"),
PyPsiBundle.message("INSP.usually.named.self"),
new RenameParameterQuickFix(PyNames.CANONICAL_SELF)
);
}
}
else { // the unusual case of a method with first tuple param
if (!flags.isStaticMethod()) {
registerProblem(plist, PyBundle.message("INSP.first.param.must.not.be.tuple"));
registerProblem(plist, PyPsiBundle.message("INSP.first.param.must.not.be.tuple"));
}
}
}
}
}
}
}
@@ -21,11 +21,10 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiReference;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.AddCallSuperQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.types.TypeEvalContext;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -69,11 +68,11 @@ public class PyMissingConstructorInspection extends PyInspection {
}
if (superClasses.length == 1 || node.isNewStyleClass(myTypeEvalContext)) {
registerProblem(initMethod.getNameIdentifier(), PyBundle.message("INSP.missing.super.constructor.message"),
registerProblem(initMethod.getNameIdentifier(), PyPsiBundle.message("INSP.missing.super.constructor.message"),
new AddCallSuperQuickFix());
}
else {
registerProblem(initMethod.getNameIdentifier(), PyBundle.message("INSP.missing.super.constructor.message"));
registerProblem(initMethod.getNameIdentifier(), PyPsiBundle.message("INSP.missing.super.constructor.message"));
}
}
@@ -5,13 +5,12 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.codeInsight.intentions.PyAnnotateTypesIntention;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.debugger.PySignature;
import com.jetbrains.python.debugger.PySignatureCacheManager;
import com.jetbrains.python.inspections.quickfix.PyQuickFixUtil;
@@ -87,8 +86,8 @@ public class PyMissingTypeHintsInspection extends PyInspection {
@Override
public JComponent createOptionsPanel() {
return new SingleCheckboxOptionsPanel(
PyBundle.message("INSP.missing.type.hints.only.when.types.are.known.collected.from.run.time.or.inferred"),
return PythonUiService.getInstance().createSingleCheckboxOptionsPanel(
PyPsiBundle.message("INSP.missing.type.hints.only.when.types.are.known.collected.from.run.time.or.inferred"),
this, "m_onlyWhenTypesAreKnown");
}
@@ -103,14 +102,14 @@ public class PyMissingTypeHintsInspection extends PyInspection {
@NotNull
@Override
public String getName() {
return PyBundle.message("INSP.missing.type.hints.add.type.hints.for", myName);
return PyPsiBundle.message("INSP.missing.type.hints.add.type.hints.for", myName);
}
@Nls
@NotNull
@Override
public String getFamilyName() {
return PyBundle.message("INSP.missing.type.hints.add.type.hints");
return PyPsiBundle.message("INSP.missing.type.hints.add.type.hints");
}
@Override
@@ -118,7 +117,7 @@ public class PyMissingTypeHintsInspection extends PyInspection {
PyFunction function = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PyFunction.class);
if (function != null) {
PyAnnotateTypesIntention.annotateTypes(PyQuickFixUtil.getEditor(function), function);
PythonUiService.getInstance().annotateTypesIntention(PyQuickFixUtil.getEditor(function), function);
}
}
}
@@ -6,13 +6,12 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.RemoveDecoratorQuickFix;
import com.jetbrains.python.psi.PyDecorator;
import com.jetbrains.python.psi.PyDecoratorList;
import com.jetbrains.python.psi.PyFunction;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -54,7 +53,7 @@ public class PyNestedDecoratorsInspection extends PyInspection {
if ((PyNames.CLASSMETHOD.equals(deconame) || PyNames.STATICMETHOD.equals(deconame)) && deco.isBuiltin()) {
registerProblem(
decos[i-1],
PyBundle.message("INSP.decorator.receives.unexpected.builtin"),
PyPsiBundle.message("INSP.decorator.receives.unexpected.builtin"),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, new RemoveDecoratorQuickFix()
);
}
@@ -21,20 +21,17 @@ import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiFile;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PythonFileType;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.inspections.quickfix.AddEncodingQuickFix;
import com.jetbrains.python.psi.LanguageLevel;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.PyStringLiteralExpression;
import com.jetbrains.python.psi.PyTargetExpression;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
@@ -110,28 +107,14 @@ public class PyNonAsciiCharInspection extends PyInspection {
@Override
public JComponent createOptionsPanel() {
final JComboBox defaultEncoding = new JComboBox(PyEncodingUtil.POSSIBLE_ENCODINGS);
defaultEncoding.setSelectedItem(myDefaultEncoding);
defaultEncoding.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
myDefaultEncoding = (String)cb.getSelectedItem();
}
});
final JComboBox encodingFormat = new JComboBox(PyEncodingUtil.ENCODING_FORMAT);
encodingFormat.setSelectedIndex(myEncodingFormatIndex);
encodingFormat.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JComboBox cb = (JComboBox)e.getSource();
myEncodingFormatIndex = cb.getSelectedIndex();
}
});
return PyEncodingUtil.createEncodingOptionsPanel(defaultEncoding, encodingFormat);
return PythonUiService.getInstance()
.createEncodingsOptionsPanel(PyEncodingUtil.POSSIBLE_ENCODINGS, myDefaultEncoding, PyEncodingUtil.ENCODING_FORMAT,
myEncodingFormatIndex,
encoding -> {
myDefaultEncoding = encoding;
},
formatIndex -> {
myEncodingFormatIndex = formatIndex;
});
}
}
@@ -6,14 +6,13 @@ import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.PyRemoveAssignmentQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.search.PyOverridingMethodsSearch;
import com.jetbrains.python.psi.types.PyNoneType;
import com.jetbrains.python.psi.types.PyType;
import com.jetbrains.python.sdk.PythonSdkUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import java.util.HashMap;
@@ -61,7 +60,7 @@ public class PyNoneFunctionAssignmentInspection extends PyInspection {
final List<PyCallable> callables = call.multiResolveCalleeFunction(getResolveContext());
if (!callables.isEmpty() && !ContainerUtil.exists(callables, ignoredCallable)) {
registerProblem(node, PyBundle.message("INSP.none.function.assignment", callee.getName()), new PyRemoveAssignmentQuickFix());
registerProblem(node, PyPsiBundle.message("INSP.none.function.assignment", callee.getName()), new PyRemoveAssignmentQuickFix());
}
}
}
@@ -23,7 +23,7 @@ import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.inspections.quickfix.PyChangeBaseClassQuickFix;
import com.jetbrains.python.inspections.quickfix.PyConvertToNewStyleQuickFix;
@@ -66,7 +66,7 @@ public class PyOldStyleClassesInspection extends PyInspection {
if (!node.isNewStyleClass(myTypeEvalContext)) {
for (PyTargetExpression attr : node.getClassAttributes()) {
if (PyNames.SLOTS.equals(attr.getName())) {
registerProblem(attr, PyBundle.message("INSP.oldstyle.class.slots"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, quickFixes.toArray(
registerProblem(attr, PyPsiBundle.message("INSP.oldstyle.class.slots"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, quickFixes.toArray(
LocalQuickFix.EMPTY_ARRAY));
}
}
@@ -74,7 +74,7 @@ public class PyOldStyleClassesInspection extends PyInspection {
if (PyNames.GETATTRIBUTE.equals(attr.getName())) {
final ASTNode nameNode = attr.getNameNode();
assert nameNode != null;
registerProblem(nameNode.getPsi(), PyBundle.message("INSP.oldstyle.class.getattribute"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, quickFixes.toArray(
registerProblem(nameNode.getPsi(), PyPsiBundle.message("INSP.oldstyle.class.getattribute"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, quickFixes.toArray(
LocalQuickFix.EMPTY_ARRAY));
}
}
@@ -100,7 +100,7 @@ public class PyOldStyleClassesInspection extends PyInspection {
if (PyUtil.isSuperCall(node)) {
final PyExpression callee = node.getCallee();
if (callee != null) {
registerProblem(callee, PyBundle.message("INSP.oldstyle.class.super"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
registerProblem(callee, PyPsiBundle.message("INSP.oldstyle.class.super"), ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
null, quickFixes.toArray(quickFixes.toArray(LocalQuickFix.EMPTY_ARRAY)));
}
}
@@ -19,7 +19,8 @@ class PyOverloadsInspection : PyInspection() {
override fun buildVisitor(holder: ProblemsHolder,
isOnTheFly: Boolean,
session: LocalInspectionToolSession): PsiElementVisitor = Visitor(holder, session)
session: LocalInspectionToolSession): PsiElementVisitor = Visitor(
holder, session)
private class Visitor(holder: ProblemsHolder, session: LocalInspectionToolSession) : PyInspectionVisitor(holder, session) {
@@ -107,4 +108,4 @@ class PyOverloadsInspection : PyInspection() {
return true
}
}
}
}
@@ -19,13 +19,12 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.PyCreatePropertyQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.types.PyClassType;
import com.jetbrains.python.psi.types.PyType;
import com.jetbrains.python.toolbox.Maybe;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
/**
@@ -90,13 +89,13 @@ public class PyPropertyAccessInspection extends PyInspection {
if (accessor.isDefined() && accessor.value() == null) {
final String message;
if (dir == AccessDirection.WRITE) {
message = PyBundle.message("INSP.property.$0.cant.be.set", name);
message = PyPsiBundle.message("INSP.property.$0.cant.be.set", name);
}
else if (dir == AccessDirection.DELETE) {
message = PyBundle.message("INSP.property.$0.cant.be.deleted", name);
message = PyPsiBundle.message("INSP.property.$0.cant.be.deleted", name);
}
else {
message = PyBundle.message("INSP.property.$0.cant.be.read", name);
message = PyPsiBundle.message("INSP.property.$0.cant.be.read", name);
}
registerProblem(node, message, new PyCreatePropertyQuickFix(dir));
}
@@ -16,7 +16,7 @@ import com.intellij.psi.PsiPolyVariantReference;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.QualifiedName;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
import com.jetbrains.python.inspections.quickfix.PyUpdatePropertySignatureQuickFix;
@@ -154,7 +154,7 @@ public class PyPropertyDefinitionInspection extends PyInspection {
else if ("doc".equals(paramName)) {
PyType type = myTypeEvalContext.getType(argument);
if (!(type instanceof PyClassType && myStringClasses.contains(((PyClassType)type).getPyClass()))) {
registerProblem(argument, PyBundle.message("INSP.doc.param.should.be.str"));
registerProblem(argument, PyPsiBundle.message("INSP.doc.param.should.be.str"));
}
}
}
@@ -170,7 +170,7 @@ public class PyPropertyDefinitionInspection extends PyInspection {
final PyType type = myTypeEvalContext.getType((PyTypedElement)resolved);
final Boolean isCallable = PyTypeChecker.isCallable(type);
if (isCallable != null && !isCallable) {
registerProblem(element, PyBundle.message("INSP.strange.arg.want.callable"));
registerProblem(element, PyPsiBundle.message("INSP.strange.arg.want.callable"));
}
}
}
@@ -202,7 +202,7 @@ public class PyPropertyDefinitionInspection extends PyInspection {
}
}
else {
registerProblem(deco, PyBundle.message("INSP.func.property.name.mismatch"));
registerProblem(deco, PyPsiBundle.message("INSP.func.property.name.mismatch"));
}
}
}
@@ -225,7 +225,7 @@ public class PyPropertyDefinitionInspection extends PyInspection {
private void checkGetter(PyCallable callable, PsiElement beingChecked) {
if (callable != null) {
checkOneParameter(callable, beingChecked, true);
checkReturnValueAllowed(callable, beingChecked, true, PyBundle.message("INSP.getter.return.smth"));
checkReturnValueAllowed(callable, beingChecked, true, PyPsiBundle.message("INSP.getter.return.smth"));
}
}
@@ -234,18 +234,18 @@ public class PyPropertyDefinitionInspection extends PyInspection {
// signature: at least two params, more optionals ok; first arg 'self'
final PyParameterList paramList = callable.getParameterList();
if (myTwoParamFunction != null && !PyUtil.isSignatureCompatibleTo(callable, myTwoParamFunction, myTypeEvalContext)) {
registerProblem(beingChecked, PyBundle.message("INSP.setter.signature.advice"), new PyUpdatePropertySignatureQuickFix(true));
registerProblem(beingChecked, PyPsiBundle.message("INSP.setter.signature.advice"), new PyUpdatePropertySignatureQuickFix(true));
}
checkForSelf(paramList);
// no explicit return type
checkReturnValueAllowed(callable, beingChecked, false, PyBundle.message("INSP.setter.should.not.return"));
checkReturnValueAllowed(callable, beingChecked, false, PyPsiBundle.message("INSP.setter.should.not.return"));
}
}
private void checkDeleter(PyCallable callable, PsiElement beingChecked) {
if (callable != null) {
checkOneParameter(callable, beingChecked, false);
checkReturnValueAllowed(callable, beingChecked, false, PyBundle.message("INSP.deleter.should.not.return"));
checkReturnValueAllowed(callable, beingChecked, false, PyPsiBundle.message("INSP.deleter.should.not.return"));
}
}
@@ -253,11 +253,11 @@ public class PyPropertyDefinitionInspection extends PyInspection {
final PyParameterList parameterList = callable.getParameterList();
if (myOneParamFunction != null && !PyUtil.isSignatureCompatibleTo(callable, myOneParamFunction, myTypeEvalContext)) {
if (isGetter) {
registerProblem(beingChecked, PyBundle.message("INSP.getter.signature.advice"),
registerProblem(beingChecked, PyPsiBundle.message("INSP.getter.signature.advice"),
new PyUpdatePropertySignatureQuickFix(false));
}
else {
registerProblem(beingChecked, PyBundle.message("INSP.deleter.signature.advice"), new PyUpdatePropertySignatureQuickFix(false));
registerProblem(beingChecked, PyPsiBundle.message("INSP.deleter.signature.advice"), new PyUpdatePropertySignatureQuickFix(false));
}
}
checkForSelf(parameterList);
@@ -269,7 +269,7 @@ public class PyPropertyDefinitionInspection extends PyInspection {
if (cls != null && cls.isSubclass("type", myTypeEvalContext)) return;
if (parameters.length > 0 && !PyNames.CANONICAL_SELF.equals(parameters[0].getName())) {
registerProblem(
parameters[0], PyBundle.message("INSP.accessor.first.param.is.$0", PyNames.CANONICAL_SELF), ProblemHighlightType.WEAK_WARNING,
parameters[0], PyPsiBundle.message("INSP.accessor.first.param.is.$0", PyNames.CANONICAL_SELF), ProblemHighlightType.WEAK_WARNING,
null,
new RenameParameterQuickFix(PyNames.CANONICAL_SELF));
}
@@ -11,22 +11,21 @@ import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ThreeState;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
import com.jetbrains.python.inspections.quickfix.PyAddPropertyForFieldQuickFix;
import com.jetbrains.python.inspections.quickfix.PyMakePublicQuickFix;
import com.jetbrains.python.inspections.quickfix.PyRenameElementQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.resolve.PyResolveContext;
import com.jetbrains.python.psi.types.PyClassType;
import com.jetbrains.python.psi.types.PyModuleType;
import com.jetbrains.python.psi.types.PyType;
import com.jetbrains.python.pyi.PyiUtil;
import com.jetbrains.python.testing.PyTestsSharedKt;
import com.jetbrains.python.testing.PythonUnitTestDetectorsKt;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -104,7 +103,10 @@ public class PyProtectedMemberInspection extends PyInspection {
private void checkReference(@NotNull final PyReferenceExpression node, @NotNull final PyExpression qualifier) {
final String name = node.getName();
final List<LocalQuickFix> quickFixes = new ArrayList<>();
quickFixes.add(new PyRenameElementQuickFix(node));
LocalQuickFix renameElementQuickFix = PythonUiService.getInstance().createPyRenameElementQuickFix(node);
if (renameElementQuickFix != null) {
quickFixes.add(renameElementQuickFix);
}
if (name != null && name.startsWith("_") && !name.startsWith("__") && !name.endsWith("__")) {
final PsiReference reference = node.getReference(getResolveContext());
@@ -122,7 +124,7 @@ public class PyProtectedMemberInspection extends PyInspection {
if (resolvedClass != null) {
final String qFixName = resolvedClass.getProperties().containsKey(newName) ?
PyBundle.message("QFIX.use.property") : PyBundle.message("QFIX.add.property");
PyPsiBundle.message("QFIX.use.property") : PyPsiBundle.message("QFIX.add.property");
quickFixes.add(new PyAddPropertyForFieldQuickFix(qFixName));
final PyClassType classType = PyUtil.as(myTypeEvalContext.getType(resolvedClass), PyClassType.class);
@@ -138,7 +140,7 @@ public class PyProtectedMemberInspection extends PyInspection {
if (ignoreTestFunctions) {
for (PsiElement item = node.getParent(); item != null && !(item instanceof PsiFileSystemItem); item = item.getParent()) {
if (PyTestsSharedKt.isTestElement(item, ThreeState.UNSURE, myTypeEvalContext)) {
if (PythonUnitTestDetectorsKt.isTestElement(item, myTypeEvalContext)) {
return;
}
}
@@ -160,7 +162,7 @@ public class PyProtectedMemberInspection extends PyInspection {
}
final PyType type = myTypeEvalContext.getType(qualifier);
final String bundleKey = type instanceof PyModuleType ? "INSP.protected.member.$0.access.module" : "INSP.protected.member.$0.access";
registerProblem(node, PyBundle.message(bundleKey, name), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, quickFixes.toArray(new LocalQuickFix[quickFixes.size() - 1]));
registerProblem(node, PyPsiBundle.message(bundleKey, name), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, null, quickFixes.toArray(new LocalQuickFix[quickFixes.size() - 1]));
}
}
@@ -235,8 +237,8 @@ public class PyProtectedMemberInspection extends PyInspection {
@Override
public JComponent createOptionsPanel() {
MultipleCheckboxOptionsPanel panel = new MultipleCheckboxOptionsPanel(this);
panel.addCheckbox(PyBundle.message("INSP.protected.member.ignore.test.functions"), "ignoreTestFunctions");
panel.addCheckbox(PyBundle.message("INSP.protected.member.ignore.annotations"), "ignoreAnnotations");
panel.addCheckbox(PyPsiBundle.message("INSP.protected.member.ignore.test.functions"), "ignoreTestFunctions");
panel.addCheckbox(PyPsiBundle.message("INSP.protected.member.ignore.annotations"), "ignoreAnnotations");
return panel;
}
}
@@ -24,7 +24,8 @@ class PyProtocolInspection : PyInspection() {
override fun buildVisitor(holder: ProblemsHolder,
isOnTheFly: Boolean,
session: LocalInspectionToolSession): PsiElementVisitor = Visitor(holder, session)
session: LocalInspectionToolSession): PsiElementVisitor = Visitor(
holder, session)
private class Visitor(holder: ProblemsHolder, session: LocalInspectionToolSession) : PyInspectionVisitor(holder, session) {
@@ -27,17 +27,16 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiNameIdentifierOwner;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
import com.jetbrains.python.codeInsight.controlflow.ReadWriteInstruction;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
import com.jetbrains.python.inspections.quickfix.PyRenameElementQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyEvaluator;
import com.jetbrains.python.pyi.PyiUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -152,11 +151,14 @@ public class PyRedeclarationInspection extends PyInspection {
if (writeElement != null && readElementRef.get() == null) {
final List<LocalQuickFix> quickFixes = new ArrayList<>();
if (suggestRename(element, writeElement)) {
quickFixes.add(new PyRenameElementQuickFix(element));
LocalQuickFix quickFix = PythonUiService.getInstance().createPyRenameElementQuickFix(element);
if (quickFix != null) {
quickFixes.add(quickFix);
}
}
final PsiElement identifier = element.getNameIdentifier();
registerProblem(identifier != null ? identifier : element,
PyBundle.message("INSP.redeclared.name", name),
PyPsiBundle.message("INSP.redeclared.name", name),
ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
null,
quickFixes.toArray(LocalQuickFix.EMPTY_ARRAY));
@@ -5,13 +5,12 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.PyRemoveStatementQuickFix;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyFunction;
import com.jetbrains.python.psi.PyReturnStatement;
import com.jetbrains.python.psi.PyUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -43,7 +42,7 @@ public class PyReturnFromInitInspection extends PyInspection {
Collection<PsiElement> offenders = new ArrayList<>();
findReturnValueInside(function, offenders);
for (PsiElement offender : offenders) {
registerProblem(offender, PyBundle.message("INSP.cant.return.value.from.init"), new PyRemoveStatementQuickFix());
registerProblem(offender, PyPsiBundle.message("INSP.cant.return.value.from.init"), new PyRemoveStatementQuickFix());
}
}
}
@@ -23,12 +23,11 @@ import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.openapi.util.JDOMExternalizableStringList;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.ReplaceFunctionWithSetLiteralQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.impl.PyBuiltinCache;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -62,7 +61,7 @@ public class PySetFunctionToLiteralInspection extends PyInspection {
if (arguments.length == 1) {
PyElement[] elements = getSetCallArguments(node);
if (elements.length != 0)
registerProblem(node, PyBundle.message("INSP.NAME.set.function.to.literal"),
registerProblem(node, PyPsiBundle.message("INSP.NAME.set.function.to.literal"),
new ReplaceFunctionWithSetLiteralQuickFix());
}
}
@@ -15,18 +15,19 @@
*/
package com.jetbrains.python.inspections;
import com.google.common.collect.Lists;
import com.intellij.codeInsight.intention.LowPriorityAction;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.ex.InspectionProfileModifiableModelKt;
import com.intellij.codeInspection.ui.ListEditForm;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.inspections.quickfix.PyRenameElementQuickFix;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.List;
/**
* Warns about shadowing built-in names.
@@ -38,13 +39,18 @@ public class PyShadowingBuiltinsInspection extends PyPsiShadowingBuiltinsInspect
@NotNull
@Override
protected LocalQuickFix[] createQuickFixes(String name, PsiElement problemElement) {
return new LocalQuickFix[]{new PyRenameElementQuickFix(problemElement), new PyIgnoreBuiltinQuickFix(name)};
List<LocalQuickFix> fixes = Lists.newArrayList();
LocalQuickFix qf = PythonUiService.getInstance().createPyRenameElementQuickFix(problemElement);
if (qf != null) {
fixes.add(qf);
}
fixes.add(new PyIgnoreBuiltinQuickFix(name));
return fixes.toArray(new LocalQuickFix[fixes.size()]);
}
@Override
public JComponent createOptionsPanel() {
final ListEditForm form = new ListEditForm("Ignore built-ins", ignoredNames);
return form.getContentPanel();
return PythonUiService.getInstance().createListEditForm("Ignore built-ins", ignoredNames);
}
private static class PyIgnoreBuiltinQuickFix implements LocalQuickFix, LowPriorityAction {
@@ -68,7 +74,7 @@ public class PyShadowingBuiltinsInspection extends PyPsiShadowingBuiltinsInspect
@NotNull
@Override
public String getFamilyName() {
return PyBundle.message("INSP.shadowing.builtins.ignore.shadowed.built.in.name");
return PyPsiBundle.message("INSP.shadowing.builtins.ignore.shadowed.built.in.name");
}
@Override
@@ -23,11 +23,12 @@ import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiNameIdentifierOwner;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PythonUiService;
import com.jetbrains.python.codeInsight.controlflow.ControlFlowCache;
import com.jetbrains.python.codeInsight.controlflow.ScopeOwner;
import com.jetbrains.python.codeInsight.dataflow.scope.Scope;
import com.jetbrains.python.codeInsight.dataflow.scope.ScopeUtil;
import com.jetbrains.python.inspections.quickfix.PyRenameElementQuickFix;
import com.jetbrains.python.psi.*;
import com.jetbrains.python.psi.resolve.PyResolveProcessor;
import com.jetbrains.python.psi.resolve.PyResolveUtil;
@@ -112,8 +113,8 @@ public class PyShadowingNamesInspection extends PyInspection {
.anyMatch(o -> o.ignoreShadowed(resolved))) {
return;
}
registerProblem(problemElement, String.format("Shadows name '%s' from outer scope", name),
ProblemHighlightType.WEAK_WARNING, null, new PyRenameElementQuickFix(problemElement));
registerProblem(problemElement, PyPsiBundle.message("INSP.shadows.name.from.outer.scope", name),
ProblemHighlightType.WEAK_WARNING, null, PythonUiService.getInstance().createPyRenameElementQuickFix(problemElement));
return;
}
}
@@ -20,12 +20,11 @@ import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.util.PsiTreeUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.ConvertDocstringQuickFix;
import com.jetbrains.python.psi.PyDocStringOwner;
import com.jetbrains.python.psi.PyStringLiteralExpression;
import com.jetbrains.python.psi.PyStringLiteralUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -68,13 +67,13 @@ public class PySingleQuotedDocstringInspection extends PyInspection {
TextRange trEnd = new TextRange(stringText.length()+length-quoteCount,
stringText.length()+length);
if (string.getStringValue().isEmpty())
holder.registerProblem(string, PyBundle.message("INSP.message.single.quoted.docstring"),
holder.registerProblem(string, PyPsiBundle.message("INSP.message.single.quoted.docstring"),
new ConvertDocstringQuickFix());
else {
holder.registerProblem(string, trStart,
PyBundle.message("INSP.message.single.quoted.docstring"), new ConvertDocstringQuickFix());
PyPsiBundle.message("INSP.message.single.quoted.docstring"), new ConvertDocstringQuickFix());
holder.registerProblem(string, trEnd,
PyBundle.message("INSP.message.single.quoted.docstring"), new ConvertDocstringQuickFix());
PyPsiBundle.message("INSP.message.single.quoted.docstring"), new ConvertDocstringQuickFix());
}
}
}
@@ -21,7 +21,7 @@ import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.ResolveResult;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.inspections.quickfix.StatementEffectFunctionCallQuickFix;
import com.jetbrains.python.inspections.quickfix.StatementEffectIntroduceVariableQuickFix;
@@ -76,10 +76,10 @@ public class PyStatementEffectInspection extends PyInspection {
return;
}
if (expression instanceof PyReferenceExpression && !((PyReferenceExpression)expression).isQualified()) {
registerProblem(expression, PyBundle.message("INSP.NAME.statement.message"));
registerProblem(expression, PyPsiBundle.message("INSP.NAME.statement.message"));
}
else {
registerProblem(expression, PyBundle.message("INSP.NAME.statement.message"), new StatementEffectIntroduceVariableQuickFix());
registerProblem(expression, PyPsiBundle.message("INSP.NAME.statement.message"), new StatementEffectIntroduceVariableQuickFix());
}
}
@@ -18,12 +18,11 @@ package com.jetbrains.python.inspections;
import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.inspections.quickfix.PyWrapInExceptionQuickFix;
import com.jetbrains.python.psi.PyExpression;
import com.jetbrains.python.psi.PyRaiseStatement;
import com.jetbrains.python.psi.PyStringLiteralExpression;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -51,7 +50,7 @@ public class PyStringExceptionInspection extends PyInspection {
if (expressions.length > 0) {
PyExpression expression = expressions[0];
if (expression instanceof PyStringLiteralExpression) {
registerProblem(expression, "Raising a string exception", new PyWrapInExceptionQuickFix());
registerProblem(expression, PyPsiBundle.message("INSP.raising.string.exception"), new PyWrapInExceptionQuickFix());
}
}
}
@@ -11,8 +11,8 @@ import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyStringFormatParser;
import com.jetbrains.python.codeInsight.PySubstitutionChunkReference;
import com.jetbrains.python.inspections.quickfix.PyAddSpecifierToFormatQuickFix;
@@ -21,7 +21,6 @@ import com.jetbrains.python.psi.impl.PyBuiltinCache;
import com.jetbrains.python.psi.resolve.PyResolveContext;
import com.jetbrains.python.psi.resolve.QualifiedRatedResolveResult;
import com.jetbrains.python.psi.types.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -260,7 +259,7 @@ public class PyStringFormatInspection extends PyInspection {
if (myExpectedArguments > 0) {
if (myExpectedArguments > 1 && myExpectedArguments == (expressions.length + additionalExpressions.size())) {
// probably "%s %s" % {'a':1, 'b':2}, with names forgotten in template
registerProblem(rightExpression, PyBundle.message("INSP.format.requires.no.mapping"));
registerProblem(rightExpression, PyPsiBundle.message("INSP.format.requires.no.mapping"));
}
else {
// "braces: %s" % {'foo':1} gives "braces: {'foo':1}", implicit str() kicks in
@@ -299,7 +298,7 @@ public class PyStringFormatInspection extends PyInspection {
if (!myUsedMappingKeys.get(key).booleanValue()) {
unresolved++;
if (unresolved > referenceKeyNumber) {
registerProblem(problemTarget, PyBundle.message("INSP.key.$0.has.no.arg", key));
registerProblem(problemTarget, PyPsiBundle.message("INSP.key.$0.has.no.arg", key));
break;
}
}
@@ -344,7 +343,7 @@ public class PyStringFormatInspection extends PyInspection {
return;
}
if (actual != null && !PyTypeChecker.match(expected, actual, myTypeEvalContext)) {
registerProblem(problemTarget, PyBundle.message("INSP.unexpected.type.$0", actual.getName()));
registerProblem(problemTarget, PyPsiBundle.message("INSP.unexpected.type.$0", actual.getName()));
}
}
@@ -364,7 +363,7 @@ public class PyStringFormatInspection extends PyInspection {
String mappingKey = Integer.toString(i + 1);
if (mapping) {
if (chunk.getMappingKey() == null || chunk.isUnclosedMapping()) {
registerProblem(formatExpression, PyBundle.message("INSP.too.few.keys"));
registerProblem(formatExpression, PyPsiBundle.message("INSP.too.few.keys"));
break;
}
mappingKey = chunk.getMappingKey();
@@ -391,7 +390,7 @@ public class PyStringFormatInspection extends PyInspection {
myFormatSpec.put(mappingKey, PERCENT_FORMAT_CONVERSIONS.get(conversionType));
continue;
}
registerProblem(formatExpression, PyBundle.message("INSP.no.format.specifier.char"), new PyAddSpecifierToFormatQuickFix());
registerProblem(formatExpression, PyPsiBundle.message("INSP.no.format.specifier.char"), new PyAddSpecifierToFormatQuickFix());
return;
}
}
@@ -429,7 +428,7 @@ public class PyStringFormatInspection extends PyInspection {
final PyClassType type = as(myTypeEvalContext.getType(rightExpression), PyClassType.class);
if (type != null) {
if (myUsedMappingKeys.size() > 0 && !PyABCUtil.isSubclass(type.getPyClass(), PyNames.MAPPING, myTypeEvalContext)) {
registerProblem(rightExpression, PyBundle.message("INSP.format.requires.mapping"));
registerProblem(rightExpression, PyPsiBundle.message("INSP.format.requires.mapping"));
return;
}
}
@@ -441,10 +440,10 @@ public class PyStringFormatInspection extends PyInspection {
final int arguments = inspectArguments(rightExpression, rightExpression);
if (myUsedMappingKeys.isEmpty() && arguments >= 0) {
if (myExpectedArguments < arguments) {
registerProblem(rightExpression, PyBundle.message("INSP.too.many.args.for.fmt.string"));
registerProblem(rightExpression, PyPsiBundle.message("INSP.too.many.args.for.fmt.string"));
}
else if (myExpectedArguments > arguments) {
registerProblem(rightExpression, PyBundle.message("INSP.too.few.args.for.fmt.string"));
registerProblem(rightExpression, PyPsiBundle.message("INSP.too.few.args.for.fmt.string"));
}
}
}
@@ -499,10 +498,10 @@ public class PyStringFormatInspection extends PyInspection {
if (prevChunk != null) {
if (prevChunk.getManualPosition() != null && chunk.getAutoPosition() != null) {
registerProblem(myFormatExpression, PyBundle.message("INSP.manual.to.auto.field.numbering"));
registerProblem(myFormatExpression, PyPsiBundle.message("INSP.manual.to.auto.field.numbering"));
}
else if (prevChunk.getAutoPosition() != null && chunk.getManualPosition() != null) {
registerProblem(myFormatExpression, PyBundle.message("INSP.auto.to.manual.field.numbering"));
registerProblem(myFormatExpression, PyPsiBundle.message("INSP.auto.to.manual.field.numbering"));
}
}
String mappingKey = inspectNewStyleChunkAndGetMappingKey(chunk);
@@ -539,7 +538,7 @@ public class PyStringFormatInspection extends PyInspection {
hasTypeOptions = true;
}
else {
registerProblem(myFormatExpression, PyBundle.message("INSP.unsupported.format.character", conversionType));
registerProblem(myFormatExpression, PyPsiBundle.message("INSP.unsupported.format.character", conversionType));
}
}
@@ -547,7 +546,7 @@ public class PyStringFormatInspection extends PyInspection {
myFormatSpec.put(mappingKey, StringUtil.join(supportedTypes, " or "));
}
else if (hasTypeOptions) {
registerProblem(myFormatExpression, PyBundle.message("INSP.incompatible.options", mappingKey));
registerProblem(myFormatExpression, PyPsiBundle.message("INSP.incompatible.options", mappingKey));
}
return mappingKey;
}
@@ -559,11 +558,11 @@ public class PyStringFormatInspection extends PyInspection {
final String chunkMapping = chunk.getMappingKey();
if (chunkMapping != null) {
registerProblem(myFormatExpression, hasElementIndex ?
PyBundle.message("INSP.too.few.args.for.fmt.string") :
PyBundle.message("INSP.key.$0.has.no.arg", chunkMapping));
PyPsiBundle.message("INSP.too.few.args.for.fmt.string") :
PyPsiBundle.message("INSP.key.$0.has.no.arg", chunkMapping));
}
else {
registerProblem(myFormatExpression, PyBundle.message("INSP.too.few.args.for.fmt.string"));
registerProblem(myFormatExpression, PyPsiBundle.message("INSP.too.few.args.for.fmt.string"));
}
}
else {
@@ -586,7 +585,7 @@ public class PyStringFormatInspection extends PyInspection {
if (expected != null && actual != null
&& CHECKED_TYPES.contains(actual.getName())
&& !PyTypeChecker.match(expected, actual, myTypeEvalContext)) {
registerProblem(typedElement, PyBundle.message("INSP.unexpected.type.$0", actual.getName()));
registerProblem(typedElement, PyPsiBundle.message("INSP.unexpected.type.$0", actual.getName()));
}
}
}
@@ -19,15 +19,14 @@ import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.psi.PyCallExpression;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyExpression;
import com.jetbrains.python.psi.PyReferenceExpression;
import com.jetbrains.python.psi.types.PyClassType;
import com.jetbrains.python.psi.types.PyType;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -62,7 +61,7 @@ public class PySuperArgumentsInspection extends PyInspection {
if (!secondClass.isSubclass(firstClass, myTypeEvalContext)) {
registerProblem(
node.getArgumentList(),
PyBundle.message("INSP.$0.is.not.superclass.of.$1",
PyPsiBundle.message("INSP.$0.is.not.superclass.of.$1",
secondClass.getName(), firstClass.getName())
);
}
@@ -8,11 +8,10 @@ import com.intellij.psi.PsiElementVisitor;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.containers.ContainerUtil;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.PyPsiBundle;
import com.jetbrains.python.PyTokenTypes;
import com.jetbrains.python.inspections.quickfix.RemoveTrailingSemicolonQuickFix;
import com.jetbrains.python.psi.PyStatement;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -49,7 +48,7 @@ public class PyTrailingSemicolonInspection extends PyInspection {
extension -> extension.ignoreTrailingSemicolon(statement))) {
return;
}
registerProblem(node.getPsi(), "Trailing semicolon in the statement", new RemoveTrailingSemicolonQuickFix());
registerProblem(node.getPsi(), PyPsiBundle.message("INSP.trailing.semicolon"), new RemoveTrailingSemicolonQuickFix());
}
}
}

Some files were not shown because too many files have changed in this diff Show More