mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
PY-87796 UI Texts: Fix typos and grammar mistakes (Feb 2026)
(cherry picked from commit f4b52fc04911cc80b05fc155485fa5aafcd70bf4) GitOrigin-RevId: 76b3859ef35485c1704d9d12419fae927a3989c6
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6830492812
commit
2bf9d316a5
@@ -164,13 +164,13 @@ python.run.anything.pip.provider=Run pip command
|
||||
python.run.anything.conda.provider=Run conda command
|
||||
|
||||
python.testing.target.not.provided=The target is not provided
|
||||
python.testing.provide.qualified.name=Provide a qualified name of a function, class or module
|
||||
python.testing.pattern.can.only.be.used=Pattern can only be used to match files in a folder. Can't use pattern for a file.
|
||||
python.testing.provide.qualified.name=Provide a qualified name of a function, class, or module
|
||||
python.testing.pattern.can.only.be.used=Pattern can only be used to match files in a folder. Can't use a pattern for a file.
|
||||
python.testing.cant.resolve=Can''t resolve {0}. Try to remove the configuration and generate it again
|
||||
python.testing.cant.find.where.declared=Can''t find file where {0} declared. Make sure it is in the project root
|
||||
python.testing.cant.get.importable.name=Can''t get an importable name for {0}. Is it a Python file in project?
|
||||
python.testing.cant.get.importable.name=Can''t get an importable name for {0}. Is it a Python file in the project?
|
||||
|
||||
runcfg.tests.cant_rerun=Can't rerun tests since test IDs can't be resolved. Try to delete run configuration, then right-click to create a new one.
|
||||
runcfg.tests.cant_rerun=Can't rerun tests since test IDs can't be resolved. Try to delete the run configuration, then right-click to create a new one.
|
||||
runcfg.tests.empty_suite=Empty suite
|
||||
|
||||
### doctest run conf
|
||||
@@ -450,11 +450,11 @@ python.sdk.common.options.environment=Environment
|
||||
python.sdk.rendering.project.default=Project Default
|
||||
python.sdk.rendering.project.default.0=Project Default ({0})
|
||||
python.sdk.installation.notification.group=Python interpreter installation
|
||||
python.sdk.installation.balloon.error.message=<b>Python installation interrupted</b><br/>Download Python manually from python.org, install it and configure the project interpreter.
|
||||
python.sdk.installation.balloon.error.message=<b>Python installation interrupted</b><br/>Download Python manually from python.org, install it, and configure the project interpreter.
|
||||
python.sdk.installation.balloon.error.action=See the documentation
|
||||
python.sdk.python.executable.not.found=Python executable {0} is missing
|
||||
python.sdk.failed.to.create.interpreter.title=Failed to create interpreter
|
||||
python.sdk.can.t.obtain.python.version=Can't obtain python version
|
||||
python.sdk.can.t.obtain.python.version=Cannot obtain python version
|
||||
python.sdk.empty.version.string=Python interpreter returned the empty output as a version string
|
||||
python.sdk.non.zero.exit.code=Python interpreter process exited with a non-zero exit code {0}
|
||||
python.sdk.executable.not.found.header=Python executable is not found. Choose one of the following options:
|
||||
@@ -483,7 +483,7 @@ sdk.gen.updating.interpreter=Updating Python interpreter
|
||||
sdk.scanning.installed.packages=Scanning Installed Packages
|
||||
sdk.gen.stubs.for.binary.modules=Generate stubs for binary module {0}
|
||||
sdk.gen.failed.notification.title=Couldn't refresh skeletons for remote interpreter
|
||||
sdk.gen.cannot.create.skeleton.dir=Can''t create skeleton dir {0}
|
||||
sdk.gen.cannot.create.skeleton.dir=Cannot create skeleton dir {0}
|
||||
sdk.updating.interpreter.paths=Updating interpreter paths\u2026
|
||||
sdk.updating.interpreter.version=Updating interpreter version\u2026
|
||||
|
||||
@@ -798,7 +798,7 @@ debugger.exception.breakpoint.activation.policy=Activation policy
|
||||
debugger.exception.breakpoint.any.exception=Any exception
|
||||
debugger.line.breakpoint.type=Python Line Breakpoint
|
||||
debugger.delete.signature.cache=Delete Cache
|
||||
debugger.simplified.view.description=Disables watching classes, functions and modules objects
|
||||
debugger.simplified.view.description=Disables watching classes, functions, and modules objects
|
||||
debugger.simplified.view.text=Simplified Variables View
|
||||
debugger.data.view.colored=Colored
|
||||
debugger.data.view.close.selected.viewer=Close selected viewer
|
||||
@@ -832,7 +832,7 @@ debugger.variables.loading.on.demand.text=On demand
|
||||
debugger.variables.loading.on.demand.description=Load variable values on demand
|
||||
debugger.variables.view.loading.timed.out=Loading timed out
|
||||
debugger.variables.view.switch.to.loading.on.demand=Switch to loading on demand
|
||||
debugger.variables.view.warning.message=The values of several variables couldn't be loaded
|
||||
debugger.variables.view.warning.message=The values of several variables couldn't be loaded
|
||||
debugger.variables.view.quoting.policy=Variables Quoting
|
||||
debugger.variables.view.quoting.single.text=Single quotes
|
||||
debugger.variables.view.quoting.single.description=Enclose values in single quotes
|
||||
@@ -852,7 +852,7 @@ debugger.stack.frame.frame.not.available=<frame not available>
|
||||
debugger.stack.frame.unable.to.display.frame.variables=Unable to display frame variables
|
||||
debugger.stack.frames.not.available.in.non.suspended.state=Frames not available in non-suspended state
|
||||
debugger.test.failed.caption=Test failed
|
||||
debugger.error.in.test.setup.or.teardown.caption=Error in test set up or tear down
|
||||
debugger.error.in.test.setup.or.teardown.caption=Error in test setup or teardown
|
||||
debugger.remote.port.out.of.boundaries=The port number is out of boundaries
|
||||
|
||||
debugger.dataViewer.action.export.name=Export\u2026
|
||||
@@ -929,7 +929,7 @@ pydev.console.console.process.terminated.with.exit.code=Console process terminat
|
||||
pydev.console.couldnt.connect.to.console.process=Couldn't connect to console process.
|
||||
pydev.console.debugger.connected=\nDebugger connected.\n
|
||||
pydev.console.couldnt.read.integer.value.from.stream=Couldn't read an integer value from stream
|
||||
pydev.console.python.interpreter.is.not.selected=Python interpreter is not selected. Please setup Python interpreter first.
|
||||
pydev.console.python.interpreter.is.not.selected=Python interpreter is not selected. Please set up Python interpreter first.
|
||||
|
||||
external.documentation.python.plugin=Python External Documentation
|
||||
external.documentation.pycharm=External Documentation
|
||||
@@ -1008,7 +1008,7 @@ python.packaging.dialog.description.attempt.to.uninstall.for.one.dependent.packa
|
||||
# Do you want to proceed?
|
||||
python.packaging.dialog.description.attempt.to.uninstall.for.several.dependent.packages.single.package.description={0} -> {1}
|
||||
python.packaging.dialog.description.attempt.to.uninstall.for.several.dependent.packages=\
|
||||
You are attempting to uninstall packages which are required for another packages.\n\n\
|
||||
You are attempting to uninstall packages which are required for other packages.\n\n\
|
||||
{0}\n\n\
|
||||
Do you want to proceed?
|
||||
|
||||
@@ -1054,7 +1054,7 @@ form.integrated.tools.package.requirements.file.invalid.path=Invalid package req
|
||||
form.integrated.tools.path.to.pipenv.executable=Path to Pipenv executable:
|
||||
form.integrated.tools.render.external.documentation.for.stdlib=Render external documentation for stdlib
|
||||
form.integrated.tools.sphinx.working.directory=Sphinx working directory:
|
||||
form.integrated.tools.treat.txt.files.as.restructuredtext=Treat *.txt files as reStructuredText
|
||||
form.integrated.tools.treat.txt.files.as.restructuredtext=Treat *.txt files as reStructuredText
|
||||
form.console.options.always.show.debug.console=Always show Debug Console
|
||||
form.console.options.settings.title.system.settings=General settings
|
||||
form.console.options.show.console.variables.by.default=Show console variables by default
|
||||
@@ -1250,7 +1250,7 @@ python.long.string.literals=Long string literals
|
||||
python.long.collection.literals=Long collection literals
|
||||
python.sequential.comments=Sequential comments
|
||||
python.type.annotations=Type annotations
|
||||
python.type.annotations.hint=When unchecked, type annotations remain expanded on first "Collapse All" action.
|
||||
python.type.annotations.hint=When unchecked, type annotations remain expanded on first "Collapse All" action
|
||||
python.provide.a.qualified.name.of.a.module=Provide a qualified name of a module
|
||||
python.input.file.doesn.t.exist=Input file doesn't exist
|
||||
python.call.graph=Call Graph
|
||||
@@ -1439,7 +1439,7 @@ python.toolwindow.packages.add.package.path.selector=Select File Or Directory
|
||||
python.toolwindow.packages.add.package.dialog.title=Install Package
|
||||
python.toolwindow.packages.load.more={0} items. Filter or double-click to show.
|
||||
python.toolwindow.packages.converting.description.progress=Reading package description
|
||||
python.toolwindow.packages.documentation.local.interpreter=PyCharm need at least one local interpreter to display package documentation.
|
||||
python.toolwindow.packages.documentation.local.interpreter=PyCharm needs at least one local interpreter to display package documentation
|
||||
python.toolwindow.packages.sdk.label.html=<html>{0} <b>({1})</b></html>
|
||||
python.packages.dictionary.name=Python Packages Dictionary
|
||||
|
||||
@@ -1479,8 +1479,8 @@ python.interpreters.rename.interpreter.action.text=Rename
|
||||
python.interpreters.show.interpreter.paths.text=Show Interpreter Paths
|
||||
python.interpreters.rename.interpreter.dialog.message=New name:
|
||||
python.interpreters.rename.interpreter.dialog.title=Rename Python Interpreter
|
||||
rename.python.interpreter.dialog.provide.name.error.text=Provide a name for Python interpreter.
|
||||
rename.python.interpreter.name.already.exists.error.text=Python interpreter with the same name already exists.
|
||||
rename.python.interpreter.dialog.provide.name.error.text=Provide a name for a Python interpreter
|
||||
rename.python.interpreter.name.already.exists.error.text=Python interpreter with the same name already exists
|
||||
|
||||
pandas.completion.type.text=DataFrame: {0}
|
||||
dict.completion.type.text=dict key
|
||||
@@ -1591,7 +1591,7 @@ inlay.parameters.python.hints.blacklist.explanation=\
|
||||
<li><code><b>foo(\\<star\\>\\<star\\>kwargs)</b></code> - function <em>foo</em> with parameter <em>**kwargs</em><br></li>\
|
||||
</ul>\
|
||||
<p>Names or placeholders must be provided for all parameters, including the optional ones.<br>\
|
||||
Qualified method names must include class names, or placeholders for them.<br>\
|
||||
Qualified method names must include class names or placeholders for them.<br>\
|
||||
Use the "Do not show hints for current method" {0} action to add patterns from the editor.</p>
|
||||
|
||||
# Requirements
|
||||
@@ -1710,7 +1710,7 @@ python.project.model.progress.title.unlinking.projects.at=Unlinking {0} projects
|
||||
python.project.model.progress.title.discovering.projects=Discovering {0} projects
|
||||
|
||||
project.error.install.python=Python could not be installed {0}. Try restarting PyCharm. If it does not help, install Python manually and try again.
|
||||
project.error.install.not.supported=Python is not installed and this target does not support installation. Please, install it manually.
|
||||
project.error.install.not.supported=Python is not installed, and this target does not support installation. Please install it manually.
|
||||
project.error.all.pythons.bad=No usable Python installations were found on your system. Please install Python manually. Check logs for more info.
|
||||
project.error.cant.venv=Could not create a virtual environment
|
||||
|
||||
@@ -1732,8 +1732,8 @@ uv.run.configuration.editor.field.uv.arguments=uv arguments:
|
||||
uv.run.configuration.editor.field.check.sync=Warn about package synchronization before running
|
||||
|
||||
uv.run.configuration.validation.sdk=Please specify a valid uv sdk
|
||||
uv.run.configuration.validation.script=Please specify a valid python script to execute
|
||||
uv.run.configuration.validation.module=Please specify a valid python module to execute
|
||||
uv.run.configuration.validation.script=Please specify a valid Python script to execute
|
||||
uv.run.configuration.validation.module=Please specify a valid Python module to execute
|
||||
command.name.add.package.to.conda.environments.yml=Add a package to conda environments.yml
|
||||
command.name.add.package.to.requirements.txt=Add a package to requirements.txt
|
||||
command.name.add.package.to.setup.py=Add a package to setup.py
|
||||
@@ -1743,7 +1743,7 @@ python.uv.lockfile.out.of.sync=The lock file at `uv.lock` is out of sync
|
||||
python.uv.update.lock=Update uv lock
|
||||
|
||||
pycharm.free.mode.upgrade.title=Upgrade to PyCharm Pro
|
||||
pycharm.free.mode.upgrade.body=Unlock the full potential of your IDE! Boost productivity, <br/> work faster and be more efficient with powerful development tools.<ul><li>Support for JavaScript, TypeScript, React and others</li><li style="margin-top: 10px;">Advances support for Django, Flask and FastAPI</li><li style="margin-top: 10px;">Remote development</li><li style="margin-top: 10px;">Local and remote full-scale Jupyter notebooks</li></ul>
|
||||
pycharm.free.mode.upgrade.body=Unlock the full potential of your IDE! Boost productivity, <br/> work faster and be more efficient with powerful development tools.<ul><li>Support for JavaScript, TypeScript, React, and others</li><li style="margin-top: 10px;">Advances support for Django, Flask, and FastAPI</li><li style="margin-top: 10px;">Remote development</li><li style="margin-top: 10px;">Local and remote full-scale Jupyter notebooks</li></ul>
|
||||
pycharm.free.mode.upgrade.button=Purchase Subscription
|
||||
python.packaging.sync.packages=Syncing project dependencies
|
||||
python.sdk.read.only=Python SDK ''{0}'' is read-only and operation cannot be performed.
|
||||
@@ -1783,7 +1783,7 @@ progress.title.checking.test.framework=Looking for an Installed Test Framework
|
||||
python.sdk.broken.configuration=Unsupported configuration detected in the Python SDK {0}, please recreate it.
|
||||
|
||||
sdk.create.condaenv.suggestion=Create a conda environment using environment.yml
|
||||
sdk.remote.target.are.not.supported.for.conda.environment=Remote target are not supported for Conda environment
|
||||
sdk.remote.target.are.not.supported.for.conda.environment=Remote target is not supported for Conda environment
|
||||
sdk.cannot.create.conda.environment.yml.not.found=Cannot create Conda environment, environment.yml does not exist
|
||||
sdk.cannot.use.existing.conda.environment=Cannot use existing Conda environment
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ ANN.name.used.both.as.global.and.param=Name ''{0}'' is used both as a parameter
|
||||
ANN.assignment.to.keyword=Assignment to keyword
|
||||
ANN.cannot.assign.to.debug=Cannot assign to __debug__
|
||||
ANN.unparenthesized.assignment.expression.statement=Unparenthesized assignment expressions are prohibited at the top level of an expression statement
|
||||
ANN.unparenthesized.assignment.expression.value=Unparenthesized assignment expressions are prohibited at the top level of the right hand side of an assignment statement
|
||||
ANN.unparenthesized.assignment.expression.value=Unparenthesized assignment expressions are prohibited at the top level of the right-hand side of an assignment statement
|
||||
ANN.assignment.expressions.within.a.comprehension.cannot.be.used.in.a.class.body=Assignment expressions within a comprehension cannot be used in a class body
|
||||
ANN.assignment.expression.as.a.target=Assignment expression cannot be used as a target here
|
||||
ANN.assignment.expression.in.an.iterable=Assignment expression cannot be used in a comprehension iterable
|
||||
@@ -145,7 +145,7 @@ ANN.python.does.not.support.yield.from.inside.async.functions=Python does not su
|
||||
ANN.yield.outside.of.function='yield' outside of function
|
||||
ANN.non.empty.return.inside.asynchronous.generator=non-empty 'return' inside asynchronous generator
|
||||
ANN.return.outside.of.function='return' outside of function
|
||||
ANN.can.t.use.starred.expression.here=Can't use starred expression here
|
||||
ANN.can.t.use.starred.expression.here=Cannot use starred expression here
|
||||
ANN.illegal.target.for.variable.annotation=An illegal target for a variable annotation
|
||||
ANN.variable.annotation.cannot.be.combined.with.tuple.unpacking=A variable annotation cannot be combined with tuple unpacking
|
||||
ANN.variable.annotation.cannot.be.used.in.assignment.with.multiple.targets=A variable annotation cannot be used in assignment with multiple targets
|
||||
@@ -376,7 +376,7 @@ QFIX.NAME.remove.dict.key=Remove this key
|
||||
QFIX.NAME.move.except.up=Move except clause up
|
||||
QFIX.NAME.add.field.to.class=Add field to class
|
||||
QFIX.add.field.to.class=Add field ''{0}'' to class {1}
|
||||
QFIX.add.field.to.class.popup.content.added.init=Added a __init__ to class <code>{0}</code><br/>to accommodate new field <code>{1}</code>
|
||||
QFIX.add.field.to.class.popup.content.added.init=Added __init__ to class <code>{0}</code><br/>to accommodate new field <code>{1}</code>
|
||||
QFIX.NAME.remove.parameter=Remove parameter
|
||||
QFIX.NAME.remove.type.parameter=Remove type parameter
|
||||
QFIX.NAME.rename.parameter=Rename parameter
|
||||
@@ -1011,7 +1011,7 @@ INSP.dataclasses.argument.ignored.if.class.already.defines.method=''{0}'' is ign
|
||||
INSP.dataclasses.order.argument.should.be.false.if.class.defines.one.of.order.methods='order' should be False if the class defines one of order methods
|
||||
INSP.dataclasses.frozen.attribute.should.be.false.if.class.defines.setattr.or.delattr='frozen' should be False if the class defines '__setattr__' or '__delattr__'
|
||||
INSP.dataclasses.unsafe.hash.attribute.should.be.false.if.class.defines.hash='unsafe_hash' should be False if the class defines '__hash__'
|
||||
INSP.dataclasses.frozen.dataclasses.can.not.inherit.non.frozen.one=Frozen dataclasses can not inherit non-frozen one and vice versa
|
||||
INSP.dataclasses.frozen.dataclasses.can.not.inherit.non.frozen.one=Frozen dataclasses cannot inherit non-frozen one and vice versa
|
||||
INSP.dataclasses.method.is.ignored.if.class.already.defines.parameter=''{0}'' is ignored if the class already defines ''{1}'' parameter
|
||||
INSP.dataclasses.hash.ignored.if.class.already.defines.cmp.or.order.or.frozen.parameters='__hash__' is ignored if the class already defines 'cmp/order' and 'frozen' parameters
|
||||
INSP.dataclasses.mutable.attribute.default.not.allowed.use.default.factory=Mutable default ''{0}'' is not allowed. Use ''default_factory''
|
||||
@@ -1047,21 +1047,21 @@ QFIX.dunder.slots.enabled.twice=Remove slots=True
|
||||
INSP.NAME.final.classes.methods.and.variables=Invalid usages of final classes, methods, and variables
|
||||
INSP.final.super.classes.are.marked.as.final.and.should.not.be.subclassed={0} {1,choice,1#is|2#are} marked as ''@final'' and should not be subclassed
|
||||
INSP.final.method.marked.as.final.should.not.be.overridden=''{0}'' is marked as ''@final'' and should not be overridden
|
||||
INSP.final.final.could.not.be.mixed.with.abstract.decorators='Final' could not be mixed with abstract decorators
|
||||
INSP.final.final.class.could.not.contain.abstract.methods='Final' class could not contain abstract methods
|
||||
INSP.final.no.need.to.mark.method.in.final.class.as.final=No need to mark method in 'Final' class as '@final'
|
||||
INSP.final.non.method.function.could.not.be.marked.as.final=Non-method function could not be marked as '@final'
|
||||
INSP.final.final.could.not.be.used.in.annotations.for.function.parameters='Final' could not be used in annotations for function parameters
|
||||
INSP.final.final.could.not.be.used.in.annotation.for.function.return.value='Final' could not be used in annotation for a function return value
|
||||
INSP.final.if.assigned.value.omitted.there.should.be.explicit.type.argument.to.final=If assigned value is omitted, there should be an explicit type argument to 'Final'
|
||||
INSP.final.final.could.not.be.mixed.with.abstract.decorators='Final' cannot be mixed with abstract decorators
|
||||
INSP.final.final.class.could.not.contain.abstract.methods='Final' class cannot contain abstract methods
|
||||
INSP.final.no.need.to.mark.method.in.final.class.as.final=No need to mark a method in the 'Final' class as '@final'
|
||||
INSP.final.non.method.function.could.not.be.marked.as.final=Non-method function cannot be marked as '@final'
|
||||
INSP.final.final.could.not.be.used.in.annotations.for.function.parameters='Final' cannot be used in function parameter annotations
|
||||
INSP.final.final.could.not.be.used.in.annotation.for.function.return.value='Final' cannot be used in a function return type annotation
|
||||
INSP.final.if.assigned.value.omitted.there.should.be.explicit.type.argument.to.final=If the assigned value is omitted, an explicit type argument for 'Final' is required
|
||||
INSP.final.final.name.should.be.initialized.with.value='Final' name should be initialized with a value
|
||||
INSP.final.already.declared.name.could.not.be.redefined.as.final=Already declared name could not be redefined as 'Final'
|
||||
INSP.final.either.instance.attribute.or.class.attribute.could.be.type.hinted.as.final=Either instance attribute or class attribute could be type hinted as 'Final'
|
||||
INSP.final.final.attribute.could.not.be.overridden=''{0}'' is ''Final'' and could not be overridden
|
||||
INSP.final.final.attribute.should.be.declared.in.class.body.or.init='Final' attribute should be declared in class body or '__init__'
|
||||
INSP.final.final.target.could.not.be.reassigned=''{0}'' is ''Final'' and could not be reassigned
|
||||
INSP.final.final.could.only.be.used.as.outermost.type='Final' could only be used as the outermost type
|
||||
INSP.final.final.could.not.be.used.inside.loop='Final' could not be used inside a loop
|
||||
INSP.final.already.declared.name.could.not.be.redefined.as.final=Already declared name cannot be redefined as 'Final'
|
||||
INSP.final.either.instance.attribute.or.class.attribute.could.be.type.hinted.as.final=Either instance attribute or class attribute can be type-hinted as 'Final'
|
||||
INSP.final.final.attribute.could.not.be.overridden=''{0}'' is ''Final'' and cannot be overridden
|
||||
INSP.final.final.attribute.should.be.declared.in.class.body.or.init='Final' attribute should be declared in the class body or '__init__'
|
||||
INSP.final.final.target.could.not.be.reassigned=''{0}'' is ''Final'' and cannot be reassigned
|
||||
INSP.final.final.could.only.be.used.as.outermost.type='Final' can only be used as the outermost type
|
||||
INSP.final.final.could.not.be.used.inside.loop='Final' cannot be used inside a loop
|
||||
INSP.final.can.only.be.parameterized.with.one.type='Final' can only be parameterized with one type
|
||||
|
||||
# PyInconsistentIndentationInspection
|
||||
@@ -1247,7 +1247,7 @@ INSP.type.hints.type.alias.must.be.immediately.initialized=Type alias must be im
|
||||
INSP.type.hints.type.alias.must.be.top.level.declaration=Type alias must be top-level declaration
|
||||
INSP.type.hints.type.alias.invalid.assigned.value=Assigned value of type alias must be a correct type
|
||||
INSP.type.hints.type.alias.cannot.be.parameterized='TypeAlias' cannot be parameterized
|
||||
INSP.type.hints.type.hint.is.not.valid=Type hint is invalid or refers to the expression which is not a correct type
|
||||
INSP.type.hints.type.hint.is.not.valid=Invalid type annotation
|
||||
INSP.type.hints.forward.reference.in.union=Union type annotations with forward references must be wrapped in quotes entirely
|
||||
INSP.type.hints.circular.reference=Circular reference
|
||||
INSP.type.hints.typeIs.has.zero.parameters=User-defined TypeGuard or TypeIs functions must have at least one parameter
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<error descr="Unparenthesized assignment expressions are prohibited at the top level of an expression statement">y := f(x)</error> # INVALID
|
||||
(y := f(x)) # Valid, though not recommended
|
||||
|
||||
y0 = <error descr="Unparenthesized assignment expressions are prohibited at the top level of the right hand side of an assignment statement">y1 := f(x)</error> # INVALID
|
||||
y0 = <error descr="Unparenthesized assignment expressions are prohibited at the top level of the right-hand side of an assignment statement">y1 := f(x)</error> # INVALID
|
||||
y0 = (y1 := f(x)) # Valid, though discouraged
|
||||
|
||||
class A:
|
||||
|
||||
@@ -1 +1 @@
|
||||
y = (<error descr="Can't use starred expression here">*()</error> for _ in ())
|
||||
y = (<error descr="Cannot use starred expression here">*()</error> for _ in ())
|
||||
@@ -1,4 +1,4 @@
|
||||
def func(xs):
|
||||
yield 42, *xs
|
||||
yield from 42, <error descr="Can't use starred expression here">*xs</error>
|
||||
yield from 42, <error descr="Cannot use starred expression here">*xs</error>
|
||||
return 42, *xs
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
def func(xs):
|
||||
yield 42, <error descr="Python version 3.6 does not support unpacking without parentheses in yield statements">*xs</error>
|
||||
yield from 42, <error descr="Can't use starred expression here">*xs</error>
|
||||
yield from 42, <error descr="Cannot use starred expression here">*xs</error>
|
||||
return 42, <error descr="Python version 3.6 does not support unpacking without parentheses in return statements">*xs</error>
|
||||
@@ -3,8 +3,8 @@
|
||||
[1, *x]
|
||||
{1, *x}
|
||||
|
||||
if <error descr="Can't use starred expression here">*x</error>:
|
||||
if <error descr="Cannot use starred expression here">*x</error>:
|
||||
pass
|
||||
|
||||
1 + (<error descr="Can't use starred expression here">*x</error>)
|
||||
1 + (<error descr="Cannot use starred expression here">*x</error>)
|
||||
1 + (*x,)
|
||||
|
||||
@@ -6,9 +6,9 @@ a[1, <warning descr="Python version 2.7 does not support starred expressions in
|
||||
a[1:2, <warning descr="Python version 2.7 does not support starred expressions in tuples, lists, and sets"><warning descr="Python versions 3.7, 3.8, 3.9, 3.10 do not support starred expressions in subscriptions">*x</warning></warning>]
|
||||
|
||||
# Not supported
|
||||
a[(<error descr="Can't use starred expression here">*x</error>)]
|
||||
a[1:<error descr="Can't use starred expression here">*x</error>]
|
||||
a[<error descr="Can't use starred expression here">*x</error>:<error descr="Can't use starred expression here">*x</error>]
|
||||
a[(<error descr="Cannot use starred expression here">*x</error>)]
|
||||
a[1:<error descr="Cannot use starred expression here">*x</error>]
|
||||
a[<error descr="Cannot use starred expression here">*x</error>:<error descr="Cannot use starred expression here">*x</error>]
|
||||
|
||||
# Ok in Python 3
|
||||
a[(<warning descr="Python version 2.7 does not support starred expressions in tuples, lists, and sets">*x</warning>,)]
|
||||
|
||||
+3
-3
@@ -13,6 +13,6 @@ x<warning descr="Python version 2.7 does not support variable annotations">: tup
|
||||
x<warning descr="Python version 2.7 does not support variable annotations">: tuple[int, <warning descr="Python version 2.7 does not support starred expressions in tuples, lists, and sets"><warning descr="Python versions 3.7, 3.8, 3.9, 3.10 do not support starred expressions in subscriptions">*tuple[str, ...]</warning></warning>]</warning>
|
||||
|
||||
# Error in Python 3.11
|
||||
def f(x: <error descr="Can't use starred expression here">*b</error>): pass
|
||||
def f8(**kwargs: <error descr="Can't use starred expression here">*a</error>): pass
|
||||
x<warning descr="Python version 2.7 does not support variable annotations">: <error descr="Can't use starred expression here">*b</error></warning>
|
||||
def f(x: <error descr="Cannot use starred expression here">*b</error>): pass
|
||||
def f8(**kwargs: <error descr="Cannot use starred expression here">*a</error>): pass
|
||||
x<warning descr="Python version 2.7 does not support variable annotations">: <error descr="Cannot use starred expression here">*b</error></warning>
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
def gen(xs):
|
||||
yield 42, <warning descr="Python version 2.7 does not support starred expressions in tuples, lists, and sets"><warning descr="Python version 3.7 does not support unpacking without parentheses in yield statements">*xs</warning></warning>
|
||||
<warning descr="Python version 2.7 does not support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.">yield from 42, <error descr="Can't use starred expression here"><warning descr="Python version 2.7 does not support starred expressions in tuples, lists, and sets">*xs</warning></error></warning>
|
||||
<warning descr="Python version 2.7 does not support this syntax. Delegating to a subgenerator is available since Python 3.3; use explicit iteration over subgenerator instead.">yield from 42, <error descr="Cannot use starred expression here"><warning descr="Python version 2.7 does not support starred expressions in tuples, lists, and sets">*xs</warning></error></warning>
|
||||
|
||||
|
||||
def func(xs):
|
||||
|
||||
+4
-4
@@ -3,20 +3,20 @@ from decorator import my_dataclass, my_dataclass_frozen_default
|
||||
|
||||
|
||||
@my_dataclass()
|
||||
class <error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">B1</error>(BaseFrozenExplicit):
|
||||
class <error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">B1</error>(BaseFrozenExplicit):
|
||||
b: str = "2"
|
||||
|
||||
|
||||
@my_dataclass(<error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">frozen=True</error>)
|
||||
@my_dataclass(<error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">frozen=True</error>)
|
||||
class B2(BaseNonFrozenImplicit):
|
||||
b: str = "2"
|
||||
|
||||
|
||||
@my_dataclass()
|
||||
class <error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">B1</error>(BaseFrozenWithFrozenDefault):
|
||||
class <error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">B1</error>(BaseFrozenWithFrozenDefault):
|
||||
b: str = "2"
|
||||
|
||||
|
||||
@my_dataclass_frozen_default()
|
||||
class <error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">B2</error>(BaseNonFrozenImplicit):
|
||||
class <error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">B2</error>(BaseNonFrozenImplicit):
|
||||
b: str = "2"
|
||||
|
||||
@@ -7,7 +7,7 @@ class A1:
|
||||
a: int = 1
|
||||
|
||||
@dataclasses.dataclass
|
||||
class <error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">B1</error>(A1):
|
||||
class <error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">B1</error>(A1):
|
||||
b: str = "2"
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ class <error descr="Frozen dataclasses can not inherit non-frozen one and vice v
|
||||
class A2:
|
||||
a: int = 1
|
||||
|
||||
@dataclasses.dataclass(<error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">frozen=True</error>)
|
||||
@dataclasses.dataclass(<error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">frozen=True</error>)
|
||||
class B2(A2):
|
||||
b: str = "2"
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class Customer7(Customer3, frozen=False):
|
||||
salary: float
|
||||
|
||||
# This should generate an error: trying to make frozen=False when parent is frozen=True
|
||||
class Customer8(Customer2, <error descr="Frozen dataclasses can not inherit non-frozen one and vice versa">frozen=False</error>): # E
|
||||
class Customer8(Customer2, <error descr="Frozen dataclasses cannot inherit non-frozen one and vice versa">frozen=False</error>): # E
|
||||
salary: float
|
||||
|
||||
# OK: Can mutate Customer3 because it's explicitly non-frozen
|
||||
|
||||
@@ -2,4 +2,4 @@ from typing_extensions import Final
|
||||
from b import A
|
||||
|
||||
class B(A):
|
||||
<warning descr="'A.a' is 'Final' and could not be overridden">a</warning>: Final[str] = "3"
|
||||
<warning descr="'A.a' is 'Final' and cannot be overridden">a</warning>: Final[str] = "3"
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from b import A
|
||||
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">A.a</warning> = 4
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">A.a</warning> = 4
|
||||
|
||||
class B(A):
|
||||
@classmethod
|
||||
def my_cls_method(cls):
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">cls.a</warning> = 6
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">cls.a</warning> = 6
|
||||
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">B.a</warning> = 7
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">B.a</warning> = 7
|
||||
|
||||
class C(A):
|
||||
<warning descr="'A.a' is 'Final' and could not be reassigned">a</warning> = 8
|
||||
<warning descr="'A.a' is 'Final' and cannot be reassigned">a</warning> = 8
|
||||
@@ -4,10 +4,10 @@ from b import A
|
||||
class B(A):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
<warning descr="'A.a' is 'Final' and could not be overridden">self.a</warning>: Final[str] = "2"
|
||||
<warning descr="'A.a' is 'Final' and cannot be overridden">self.a</warning>: Final[str] = "2"
|
||||
|
||||
class C(A):
|
||||
<warning descr="'A.a' is 'Final' and could not be overridden">a</warning>: Final[str]
|
||||
<warning descr="'A.a' is 'Final' and cannot be overridden">a</warning>: Final[str]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
+5
-5
@@ -1,14 +1,14 @@
|
||||
from b import A, B
|
||||
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">A().a</warning> = 3
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">B().b</warning> = 3
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">A().a</warning> = 3
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">B().b</warning> = 3
|
||||
|
||||
class C(B):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> = 4
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">self.b</warning> = 4
|
||||
|
||||
def my_method(self):
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> = 5
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">self.b</warning> = 5
|
||||
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">C().b</warning> = 6
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">C().b</warning> = 6
|
||||
@@ -1,5 +1,5 @@
|
||||
import b
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">b.a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">b.a</warning> = 2
|
||||
|
||||
from b import a
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">a</warning> = 3
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">a</warning> = 3
|
||||
+1
-1
@@ -2,4 +2,4 @@ from b import *
|
||||
|
||||
print(BAR)
|
||||
|
||||
<warning descr="'BAR' is 'Final' and could not be reassigned">BAR</warning> = 43
|
||||
<warning descr="'BAR' is 'Final' and cannot be reassigned">BAR</warning> = 43
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
from typing_extensions import Final
|
||||
|
||||
class A:
|
||||
a: <warning descr="If assigned value is omitted, there should be an explicit type argument to 'Final'">Final</warning>
|
||||
a: <warning descr="If the assigned value is omitted, an explicit type argument for 'Final' is required">Final</warning>
|
||||
b: Final[int]
|
||||
c: int
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from typing_extensions import Final
|
||||
|
||||
a: Final[int]
|
||||
b: <warning descr="If assigned value is omitted, there should be an explicit type argument to 'Final'">Final</warning>
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">b</warning> = "10"
|
||||
b: <warning descr="If the assigned value is omitted, an explicit type argument for 'Final' is required">Final</warning>
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">b</warning> = "10"
|
||||
c: Final[str] = "10"
|
||||
d: int
|
||||
+12
-12
@@ -1,18 +1,18 @@
|
||||
from util import *
|
||||
|
||||
def bad_type_aliases(
|
||||
p1: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias1</warning>,
|
||||
p2: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias2</warning>,
|
||||
p3: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias3</warning>,
|
||||
p4: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias4</warning>,
|
||||
p5: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias5</warning>,
|
||||
p6: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias6</warning>,
|
||||
p7: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias7</warning>,
|
||||
p8: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias8</warning>,
|
||||
p9: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias9</warning>,
|
||||
p10: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias10</warning>,
|
||||
p11: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias11</warning>,
|
||||
p12: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias12</warning>,
|
||||
p1: <warning descr="Invalid type annotation">BadTypeAlias1</warning>,
|
||||
p2: <warning descr="Invalid type annotation">BadTypeAlias2</warning>,
|
||||
p3: <warning descr="Invalid type annotation">BadTypeAlias3</warning>,
|
||||
p4: <warning descr="Invalid type annotation">BadTypeAlias4</warning>,
|
||||
p5: <warning descr="Invalid type annotation">BadTypeAlias5</warning>,
|
||||
p6: <warning descr="Invalid type annotation">BadTypeAlias6</warning>,
|
||||
p7: <warning descr="Invalid type annotation">BadTypeAlias7</warning>,
|
||||
p8: <warning descr="Invalid type annotation">BadTypeAlias8</warning>,
|
||||
p9: <warning descr="Invalid type annotation">BadTypeAlias9</warning>,
|
||||
p10: <warning descr="Invalid type annotation">BadTypeAlias10</warning>,
|
||||
p11: <warning descr="Invalid type annotation">BadTypeAlias11</warning>,
|
||||
p12: <warning descr="Invalid type annotation">BadTypeAlias12</warning>,
|
||||
): pass
|
||||
|
||||
def good_type_aliases(
|
||||
|
||||
+14
-14
@@ -1,20 +1,20 @@
|
||||
from util import *
|
||||
|
||||
def bad_type_aliases(
|
||||
p1: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias1</warning>,
|
||||
p2: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias2</warning>,
|
||||
p3: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias3</warning>,
|
||||
p4: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias4</warning>,
|
||||
p5: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias5</warning>,
|
||||
p6: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias6</warning>,
|
||||
p7: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias7</warning>,
|
||||
p8: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias8</warning>,
|
||||
p9: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias9</warning>,
|
||||
p10: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias10</warning>,
|
||||
p11: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias11</warning>,
|
||||
p12: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias12</warning>,
|
||||
p13: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias13</warning>,
|
||||
p14: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">BadTypeAlias14</warning>,
|
||||
p1: <warning descr="Invalid type annotation">BadTypeAlias1</warning>,
|
||||
p2: <warning descr="Invalid type annotation">BadTypeAlias2</warning>,
|
||||
p3: <warning descr="Invalid type annotation">BadTypeAlias3</warning>,
|
||||
p4: <warning descr="Invalid type annotation">BadTypeAlias4</warning>,
|
||||
p5: <warning descr="Invalid type annotation">BadTypeAlias5</warning>,
|
||||
p6: <warning descr="Invalid type annotation">BadTypeAlias6</warning>,
|
||||
p7: <warning descr="Invalid type annotation">BadTypeAlias7</warning>,
|
||||
p8: <warning descr="Invalid type annotation">BadTypeAlias8</warning>,
|
||||
p9: <warning descr="Invalid type annotation">BadTypeAlias9</warning>,
|
||||
p10: <warning descr="Invalid type annotation">BadTypeAlias10</warning>,
|
||||
p11: <warning descr="Invalid type annotation">BadTypeAlias11</warning>,
|
||||
p12: <warning descr="Invalid type annotation">BadTypeAlias12</warning>,
|
||||
p13: <warning descr="Invalid type annotation">BadTypeAlias13</warning>,
|
||||
p14: <warning descr="Invalid type annotation">BadTypeAlias14</warning>,
|
||||
): pass
|
||||
|
||||
def good_type_aliases(
|
||||
|
||||
+15
-15
@@ -3,19 +3,19 @@ import types
|
||||
var1 = 3
|
||||
|
||||
def invalid_annotations(
|
||||
p1: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">eval(<warning descr="Generics should be specified through square brackets">"".join(<warning descr="Generics should be specified through square brackets">map(chr, [105, 110, 116])</warning>)</warning>)</warning>,
|
||||
p2: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int, str]</warning>,
|
||||
p3: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">(int, str)</warning>,
|
||||
p4: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int for i in <warning descr="Generics should be specified through square brackets">range(1)</warning>]</warning>,
|
||||
p5: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">{}</warning>,
|
||||
p6: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">(lambda: int)()</warning>,
|
||||
p7: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int][0]</warning>,
|
||||
p8: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">int if 1 < 3 else str</warning>,
|
||||
p9: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">var1</warning>,
|
||||
p10: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">True</warning>,
|
||||
p11: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">1</warning>,
|
||||
p12: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">-1</warning>,
|
||||
p13: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">int or str</warning>,
|
||||
p14: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">f"int"</warning>,
|
||||
p15: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">types</warning>,
|
||||
p1: <warning descr="Invalid type annotation">eval(<warning descr="Generics should be specified through square brackets">"".join(<warning descr="Generics should be specified through square brackets">map(chr, [105, 110, 116])</warning>)</warning>)</warning>,
|
||||
p2: <warning descr="Invalid type annotation">[int, str]</warning>,
|
||||
p3: <warning descr="Invalid type annotation">(int, str)</warning>,
|
||||
p4: <warning descr="Invalid type annotation">[int for i in <warning descr="Generics should be specified through square brackets">range(1)</warning>]</warning>,
|
||||
p5: <warning descr="Invalid type annotation">{}</warning>,
|
||||
p6: <warning descr="Invalid type annotation">(lambda: int)()</warning>,
|
||||
p7: <warning descr="Invalid type annotation">[int][0]</warning>,
|
||||
p8: <warning descr="Invalid type annotation">int if 1 < 3 else str</warning>,
|
||||
p9: <warning descr="Invalid type annotation">var1</warning>,
|
||||
p10: <warning descr="Invalid type annotation">True</warning>,
|
||||
p11: <warning descr="Invalid type annotation">1</warning>,
|
||||
p12: <warning descr="Invalid type annotation">-1</warning>,
|
||||
p13: <warning descr="Invalid type annotation">int or str</warning>,
|
||||
p14: <warning descr="Invalid type annotation">f"int"</warning>,
|
||||
p15: <warning descr="Invalid type annotation">types</warning>,
|
||||
): ...
|
||||
@@ -166,7 +166,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
doTestByText("""
|
||||
from typing_extensions import final
|
||||
@final
|
||||
def <warning descr="Non-method function could not be marked as '@final'">foo</warning>():
|
||||
def <warning descr="Non-method function cannot be marked as '@final'">foo</warning>():
|
||||
pass""");
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
<warning descr="'Final' name should be initialized with a value">a</warning>: Final[int]
|
||||
<warning descr="'Final' name should be initialized with a value">b</warning>: Final
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">b</warning> = "10"
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">b</warning> = "10"
|
||||
c: Final[str] = "10"
|
||||
d: int
|
||||
""")
|
||||
@@ -194,7 +194,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
from typing_extensions import Final
|
||||
|
||||
class A:
|
||||
<warning descr="'Final' name should be initialized with a value">a</warning>: <warning descr="If assigned value is omitted, there should be an explicit type argument to 'Final'">Final</warning>
|
||||
<warning descr="'Final' name should be initialized with a value">a</warning>: <warning descr="If the assigned value is omitted, an explicit type argument for 'Final' is required">Final</warning>
|
||||
<warning descr="'Final' name should be initialized with a value">b</warning>: Final[int]
|
||||
c: int
|
||||
d: Final[int]
|
||||
@@ -240,15 +240,15 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
() -> doTestByText("""
|
||||
from typing_extensions import Final
|
||||
|
||||
def foo(a: <warning descr="'Final' could not be used in annotations for function parameters">Final</warning>) -> None:
|
||||
def foo(a: <warning descr="'Final' cannot be used in function parameter annotations">Final</warning>) -> None:
|
||||
pass
|
||||
|
||||
def bar(a, <warning descr="'Final' could not be used in annotations for function parameters"># type: Final[str]</warning>
|
||||
def bar(a, <warning descr="'Final' cannot be used in function parameter annotations"># type: Final[str]</warning>
|
||||
):
|
||||
pass
|
||||
|
||||
def baz(a):
|
||||
<warning descr="'Final' could not be used in annotations for function parameters"># type: (Final[int]) -> None</warning>
|
||||
<warning descr="'Final' cannot be used in function parameter annotations"># type: (Final[int]) -> None</warning>
|
||||
pass""")
|
||||
);
|
||||
}
|
||||
@@ -259,21 +259,21 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
from typing_extensions import Final, TypeAlias
|
||||
|
||||
a1: Final[int] = 10
|
||||
b1: List[<warning descr="'Final' could only be used as the outermost type">Final</warning>[int]] = []
|
||||
b1: List[<warning descr="'Final' can only be used as the outermost type">Final</warning>[int]] = []
|
||||
|
||||
a2 = 10 # type: Final[int]
|
||||
b2 = [] # type: List[<warning descr="'Final' could only be used as the outermost type">Final</warning>[int]]
|
||||
b2 = [] # type: List[<warning descr="'Final' can only be used as the outermost type">Final</warning>[int]]
|
||||
|
||||
a3: Final = 10
|
||||
b3: List[<warning descr="'Final' could only be used as the outermost type">Final</warning>] = []
|
||||
b3: List[<warning descr="'Final' can only be used as the outermost type">Final</warning>] = []
|
||||
|
||||
a4 = 10 # type: Final
|
||||
b4 = [] # type: List[<warning descr="'Final' could only be used as the outermost type">Final</warning>]
|
||||
b4 = [] # type: List[<warning descr="'Final' can only be used as the outermost type">Final</warning>]
|
||||
|
||||
A1: TypeAlias = List[<warning descr="'Final' could only be used as the outermost type">Final</warning>[int]]
|
||||
A2: TypeAlias = 'List[<warning descr="'Final' could only be used as the outermost type">Final</warning>[int]]'
|
||||
A3 = List[<warning descr="'Final' could only be used as the outermost type">Final</warning>[int]] # type: TypeAlias
|
||||
A4 = 'List[<warning descr="'Final' could only be used as the outermost type">Final</warning>[int]]' # type: TypeAlias""");
|
||||
A1: TypeAlias = List[<warning descr="'Final' can only be used as the outermost type">Final</warning>[int]]
|
||||
A2: TypeAlias = 'List[<warning descr="'Final' can only be used as the outermost type">Final</warning>[int]]'
|
||||
A3 = List[<warning descr="'Final' can only be used as the outermost type">Final</warning>[int]] # type: TypeAlias
|
||||
A4 = 'List[<warning descr="'Final' can only be used as the outermost type">Final</warning>[int]]' # type: TypeAlias""");
|
||||
}
|
||||
|
||||
// PY-34945
|
||||
@@ -285,15 +285,15 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
a: Final[int] = 10
|
||||
print(a)
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">a</warning>: Final[str] = "10"
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">a</warning>: Final[str] = "10"
|
||||
|
||||
b = 10 # type: int
|
||||
print(b)
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">b</warning> = "10" # type: Final[str]
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">b</warning> = "10" # type: Final[str]
|
||||
|
||||
c: Final[int] = 10
|
||||
print(c)
|
||||
<warning descr="'c' is 'Final' and could not be reassigned">c</warning>: str = "10\"""")
|
||||
<warning descr="'c' is 'Final' and cannot be reassigned">c</warning>: str = "10\"""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -307,15 +307,15 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
class A:
|
||||
a: Final[int] = 10
|
||||
print(a)
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">a</warning>: Final[str] = "10"
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">a</warning>: Final[str] = "10"
|
||||
|
||||
b = 10 # type: int
|
||||
print(b)
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">b</warning> = "10" # type: Final[str]
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">b</warning> = "10" # type: Final[str]
|
||||
|
||||
c: Final[int] = 10
|
||||
print(c)
|
||||
<warning descr="'c' is 'Final' and could not be reassigned">c</warning>: str = "10\"""")
|
||||
<warning descr="'c' is 'Final' and cannot be reassigned">c</warning>: str = "10\"""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -329,15 +329,15 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
def foo():
|
||||
a: Final[int] = 10
|
||||
print(a)
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">a</warning>: Final[str] = "10"
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">a</warning>: Final[str] = "10"
|
||||
|
||||
b = 10 # type: int
|
||||
print(b)
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">b</warning> = "10" # type: Final[str]
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">b</warning> = "10" # type: Final[str]
|
||||
|
||||
c: Final[int] = 10
|
||||
print(c)
|
||||
<warning descr="'c' is 'Final' and could not be reassigned">c</warning>: str = "10\"""")
|
||||
<warning descr="'c' is 'Final' and cannot be reassigned">c</warning>: str = "10\"""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -353,8 +353,8 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
self.a: Final[str] = "str"
|
||||
|
||||
def method(self):
|
||||
<warning descr="'Final' attribute should be declared in class body or '__init__'"><warning descr="Already declared name could not be redefined as 'Final'">self.a</warning></warning>: Final[int] = 10
|
||||
<warning descr="'Final' attribute should be declared in class body or '__init__'">self.b</warning>: Final[int] = 10""")
|
||||
<warning descr="'Final' attribute should be declared in the class body or '__init__'"><warning descr="Already declared name cannot be redefined as 'Final'">self.a</warning></warning>: Final[int] = 10
|
||||
<warning descr="'Final' attribute should be declared in the class body or '__init__'">self.b</warning>: Final[int] = 10""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -369,12 +369,12 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
class A:
|
||||
a: Final[int] = 1
|
||||
b: Final[str] = "1"
|
||||
<warning descr="Either instance attribute or class attribute could be type hinted as 'Final'">c</warning>: Final[int]
|
||||
<warning descr="Either instance attribute or class attribute can be type-hinted as 'Final'">c</warning>: Final[int]
|
||||
|
||||
def __init__(self):
|
||||
<warning descr="Already declared name could not be redefined as 'Final'">self.a</warning>: Final[int] = 2
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> = "2"
|
||||
<warning descr="Either instance attribute or class attribute could be type hinted as 'Final'">self.c</warning>: Final[int] = 2""")
|
||||
<warning descr="Already declared name cannot be redefined as 'Final'">self.a</warning>: Final[int] = 2
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">self.b</warning> = "2"
|
||||
<warning descr="Either instance attribute or class attribute can be type-hinted as 'Final'">self.c</warning>: Final[int] = 2""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -386,13 +386,13 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
from typing_extensions import Final
|
||||
|
||||
a: Final[int] = 1
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">a</warning> = 2
|
||||
|
||||
b: Final[str] = "3"
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">b</warning> += "4"
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">b</warning> += "4"
|
||||
|
||||
c: Final[int] = 5
|
||||
<warning descr="'c' is 'Final' and could not be reassigned">c</warning> += 6""")
|
||||
<warning descr="'c' is 'Final' and cannot be reassigned">c</warning> += 6""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -412,33 +412,33 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
a: Final[int] = 1
|
||||
|
||||
def __init__(self):
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> += 2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> += 2
|
||||
|
||||
def method(self):
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> = 3
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> += 3
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> = 3
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> += 3
|
||||
|
||||
@classmethod
|
||||
def cls_method(cls):
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">cls.a</warning> = 5
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">cls.a</warning> += 5
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">cls.a</warning> = 5
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">cls.a</warning> += 5
|
||||
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">A.a</warning> = 4
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">A.a</warning> += 4
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">A.a</warning> = 4
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">A.a</warning> += 4
|
||||
|
||||
class B(A):
|
||||
|
||||
@classmethod
|
||||
def my_cls_method(cls):
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">cls.a</warning> = 6
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">cls.a</warning> += 6
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">cls.a</warning> = 6
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">cls.a</warning> += 6
|
||||
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">B.a</warning> = 7
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">B.a</warning> += 7
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">B.a</warning> = 7
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">B.a</warning> += 7
|
||||
|
||||
class C(A):
|
||||
<warning descr="'A.a' is 'Final' and could not be reassigned">a</warning> = 8
|
||||
<warning descr="'A.a' is 'Final' and cannot be reassigned">a</warning> = 8
|
||||
""")
|
||||
);
|
||||
}
|
||||
@@ -458,41 +458,41 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
class A:
|
||||
def __init__(self):
|
||||
self.a: Final[int] = 1
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> += 1
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> += 1
|
||||
|
||||
def method(self):
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">self.a</warning> = +2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">self.a</warning> = +2
|
||||
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">A().a</warning> = 3
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">A().a</warning> = +3
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">A().a</warning> = 3
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">A().a</warning> = +3
|
||||
|
||||
class B:
|
||||
b: Final[int]
|
||||
|
||||
def __init__(self):
|
||||
self.b = 1
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> += 1
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">self.b</warning> += 1
|
||||
|
||||
def method(self):
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> = 2
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">self.b</warning> += 2
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">self.b</warning> = 2
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">self.b</warning> += 2
|
||||
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">B().b</warning> = 3
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">B().b</warning> += 3
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">B().b</warning> = 3
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">B().b</warning> += 3
|
||||
|
||||
class C(B):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> = 4
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> += 4
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">self.b</warning> = 4
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">self.b</warning> += 4
|
||||
|
||||
def my_method(self):
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> = 5
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">self.b</warning> += 5
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">self.b</warning> = 5
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">self.b</warning> += 5
|
||||
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">C().b</warning> = 6
|
||||
<warning descr="'B.b' is 'Final' and could not be reassigned">C().b</warning> += 6""")
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">C().b</warning> = 6
|
||||
<warning descr="'B.b' is 'Final' and cannot be reassigned">C().b</warning> += 6""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -510,11 +510,11 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
def foo():
|
||||
a: Final[int] = 1
|
||||
<warning descr="'a' is 'Final' and could not be reassigned">a</warning> = 2
|
||||
<warning descr="'a' is 'Final' and cannot be reassigned">a</warning> = 2
|
||||
|
||||
def bar():
|
||||
b: Final[int] = 3
|
||||
<warning descr="'b' is 'Final' and could not be reassigned">b</warning> += 4""")
|
||||
<warning descr="'b' is 'Final' and cannot be reassigned">b</warning> += 4""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
def inner():
|
||||
nonlocal x
|
||||
<warning descr="'x' is 'Final' and could not be reassigned">x</warning> = [4, 5]
|
||||
<warning descr="'x' is 'Final' and cannot be reassigned">x</warning> = [4, 5]
|
||||
|
||||
inner()""")
|
||||
);
|
||||
@@ -549,7 +549,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
def foo():
|
||||
global y
|
||||
<warning descr="'y' is 'Final' and could not be reassigned">y</warning> = [4, 5]
|
||||
<warning descr="'y' is 'Final' and cannot be reassigned">y</warning> = [4, 5]
|
||||
""")
|
||||
);
|
||||
}
|
||||
@@ -563,7 +563,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
from typing_extensions import Final
|
||||
|
||||
y: Final[List[int]] = [0, 1]
|
||||
<warning descr="'y' is 'Final' and could not be reassigned">y</warning> += [4, 5]
|
||||
<warning descr="'y' is 'Final' and cannot be reassigned">y</warning> += [4, 5]
|
||||
""")
|
||||
);
|
||||
}
|
||||
@@ -579,7 +579,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
a: Final[int] = 1
|
||||
|
||||
class B(A):
|
||||
<warning descr="'A.a' is 'Final' and could not be overridden">a</warning>: Final[str] = "3"
|
||||
<warning descr="'A.a' is 'Final' and cannot be overridden">a</warning>: Final[str] = "3"
|
||||
""")
|
||||
);
|
||||
}
|
||||
@@ -605,10 +605,10 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
class B(A):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
<warning descr="'A.a' is 'Final' and could not be overridden">self.a</warning>: Final[str] = "2"
|
||||
<warning descr="'A.a' is 'Final' and cannot be overridden">self.a</warning>: Final[str] = "2"
|
||||
|
||||
class C(A):
|
||||
<warning descr="'A.a' is 'Final' and could not be overridden">a</warning>: Final[str]
|
||||
<warning descr="'A.a' is 'Final' and cannot be overridden">a</warning>: Final[str]
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -630,16 +630,16 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
|
||||
for i in undefined:
|
||||
if undefined:
|
||||
<warning descr="'Final' could not be used inside a loop">x</warning>: Final[int] = 1
|
||||
<warning descr="'Final' cannot be used inside a loop">x</warning>: Final[int] = 1
|
||||
while undefined:
|
||||
<warning descr="'Final' could not be used inside a loop">y</warning>: Final[str] = '1'
|
||||
<warning descr="'Final' cannot be used inside a loop">y</warning>: Final[str] = '1'
|
||||
\s
|
||||
def foo():
|
||||
for i in undefined:
|
||||
if undefined:
|
||||
<warning descr="'Final' could not be used inside a loop">x</warning>: Final[int] = 1
|
||||
<warning descr="'Final' cannot be used inside a loop">x</warning>: Final[int] = 1
|
||||
while undefined:
|
||||
<warning descr="'Final' could not be used inside a loop">y</warning>: Final[str] = '1'""")
|
||||
<warning descr="'Final' cannot be used inside a loop">y</warning>: Final[str] = '1'""")
|
||||
);
|
||||
}
|
||||
|
||||
@@ -650,11 +650,11 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
() -> doTestByText("""
|
||||
from typing_extensions import Final
|
||||
|
||||
def foo1() <warning descr="'Final' could not be used in annotation for a function return value">-> Final[int]</warning>:
|
||||
def foo1() <warning descr="'Final' cannot be used in a function return type annotation">-> Final[int]</warning>:
|
||||
pass
|
||||
|
||||
def foo2():
|
||||
<warning descr="'Final' could not be used in annotation for a function return value"># type: () -> Final[int]</warning>
|
||||
<warning descr="'Final' cannot be used in a function return type annotation"># type: () -> Final[int]</warning>
|
||||
pass""")
|
||||
);
|
||||
}
|
||||
@@ -666,9 +666,9 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
@final
|
||||
class <warning descr="'Final' class could not contain abstract methods">A</warning>(ABC):
|
||||
class <warning descr="'Final' class cannot contain abstract methods">A</warning>(ABC):
|
||||
@abstractmethod
|
||||
def <warning descr="'Final' class could not contain abstract methods">method</warning>(self):
|
||||
def <warning descr="'Final' class cannot contain abstract methods">method</warning>(self):
|
||||
pass
|
||||
\s
|
||||
class B(ABC):
|
||||
@@ -679,7 +679,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
class C(ABC):
|
||||
@final
|
||||
@abstractmethod
|
||||
def <warning descr="'Final' could not be mixed with abstract decorators">method</warning>(self):
|
||||
def <warning descr="'Final' cannot be mixed with abstract decorators">method</warning>(self):
|
||||
pass""");
|
||||
}
|
||||
|
||||
@@ -691,7 +691,7 @@ public class PyFinalInspectionTest extends PyInspectionTestCase {
|
||||
@final
|
||||
class A:
|
||||
@final
|
||||
def <weak_warning descr="No need to mark method in 'Final' class as '@final'">method</weak_warning>(self):
|
||||
def <weak_warning descr="No need to mark a method in the 'Final' class as '@final'">method</weak_warning>(self):
|
||||
pass""");
|
||||
}
|
||||
|
||||
|
||||
@@ -944,14 +944,14 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
def __init__(self, v):
|
||||
pass
|
||||
|
||||
def a(b: <warning descr="Generics should be specified through square brackets"><warning descr="Type hint is invalid or refers to the expression which is not a correct type">A(int)</warning></warning>):
|
||||
def a(b: <warning descr="Generics should be specified through square brackets"><warning descr="Invalid type annotation">A(int)</warning></warning>):
|
||||
pass
|
||||
|
||||
def c(d):
|
||||
# type: (<warning descr="Generics should be specified through square brackets">A(int)</warning>) -> None
|
||||
pass
|
||||
|
||||
def e(f: <warning descr="Generics should be specified through square brackets"><warning descr="Type hint is invalid or refers to the expression which is not a correct type">A()</warning></warning>):
|
||||
def e(f: <warning descr="Generics should be specified through square brackets"><warning descr="Invalid type annotation">A()</warning></warning>):
|
||||
pass
|
||||
|
||||
def g(h):
|
||||
@@ -962,7 +962,7 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
v2 = None # type: <warning descr="Generics should be specified through square brackets">A(int)</warning>
|
||||
|
||||
U = A
|
||||
def i(j: <warning descr="Generics should be specified through square brackets"><warning descr="Type hint is invalid or refers to the expression which is not a correct type">U(int)</warning></warning>):
|
||||
def i(j: <warning descr="Generics should be specified through square brackets"><warning descr="Invalid type annotation">U(int)</warning></warning>):
|
||||
pass
|
||||
\s
|
||||
v3 = None # type: <warning descr="Generics should be specified through square brackets">U(int)</warning>
|
||||
@@ -1549,7 +1549,7 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
doTestByText("""
|
||||
from typing import Self
|
||||
|
||||
something: <warning descr="Type hint is invalid or refers to the expression which is not a correct type"><warning descr="Cannot use 'Self' outside class">Self</warning> | None</warning> = None
|
||||
something: <warning descr="Invalid type annotation"><warning descr="Cannot use 'Self' outside class">Self</warning> | None</warning> = None
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -2549,7 +2549,7 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
a1 = 3
|
||||
a2 = a1
|
||||
a3 = a2
|
||||
def foo(p: <warning descr="Type hint is invalid or refers to the expression which is not a correct type">a3</warning>): ...
|
||||
def foo(p: <warning descr="Invalid type annotation">a3</warning>): ...
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -2927,19 +2927,19 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
public void testInvalidTypeAliasStatement() {
|
||||
doTestByText("""
|
||||
var1 = 1
|
||||
type BadTypeAlias1 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">eval(<warning descr="Generics should be specified through square brackets">"".join(<warning descr="Generics should be specified through square brackets">map(chr, [105, 110, 116])</warning>)</warning>)</warning>
|
||||
type BadTypeAlias2 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int, str]</warning>
|
||||
type BadTypeAlias3 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">((int, str),)</warning>
|
||||
type BadTypeAlias4 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int for i in <warning descr="Generics should be specified through square brackets">range(1)</warning>]</warning>
|
||||
type BadTypeAlias5 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">{"a": "b"}</warning>
|
||||
type BadTypeAlias6 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">(lambda: int)()</warning>
|
||||
type BadTypeAlias7 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int][0]</warning>
|
||||
type BadTypeAlias8 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">int if 1 < 3 else str</warning>
|
||||
type BadTypeAlias9 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">var1</warning>
|
||||
type BadTypeAlias10 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">True</warning>
|
||||
type BadTypeAlias11 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">1</warning>
|
||||
type BadTypeAlias12 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">list or set</warning>
|
||||
type BadTypeAlias13 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">f"{'int'}"</warning>
|
||||
type BadTypeAlias1 = <warning descr="Invalid type annotation">eval(<warning descr="Generics should be specified through square brackets">"".join(<warning descr="Generics should be specified through square brackets">map(chr, [105, 110, 116])</warning>)</warning>)</warning>
|
||||
type BadTypeAlias2 = <warning descr="Invalid type annotation">[int, str]</warning>
|
||||
type BadTypeAlias3 = <warning descr="Invalid type annotation">((int, str),)</warning>
|
||||
type BadTypeAlias4 = <warning descr="Invalid type annotation">[int for i in <warning descr="Generics should be specified through square brackets">range(1)</warning>]</warning>
|
||||
type BadTypeAlias5 = <warning descr="Invalid type annotation">{"a": "b"}</warning>
|
||||
type BadTypeAlias6 = <warning descr="Invalid type annotation">(lambda: int)()</warning>
|
||||
type BadTypeAlias7 = <warning descr="Invalid type annotation">[int][0]</warning>
|
||||
type BadTypeAlias8 = <warning descr="Invalid type annotation">int if 1 < 3 else str</warning>
|
||||
type BadTypeAlias9 = <warning descr="Invalid type annotation">var1</warning>
|
||||
type BadTypeAlias10 = <warning descr="Invalid type annotation">True</warning>
|
||||
type BadTypeAlias11 = <warning descr="Invalid type annotation">1</warning>
|
||||
type BadTypeAlias12 = <warning descr="Invalid type annotation">list or set</warning>
|
||||
type BadTypeAlias13 = <warning descr="Invalid type annotation">f"{'int'}"</warning>
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -3014,14 +3014,14 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
// PY-76851
|
||||
public void testSimpleRecursiveTypeAliasStatement() {
|
||||
doTestByText("""
|
||||
type TypeAlias = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">TypeAlias</warning>
|
||||
type TypeAlias = <warning descr="Invalid type annotation">TypeAlias</warning>
|
||||
""");
|
||||
}
|
||||
|
||||
// PY-76851
|
||||
public void testRecursiveTypeAliasStatementInUnion() {
|
||||
doTestByText("""
|
||||
type TypeAlias = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">int | TypeAlias</warning>
|
||||
type TypeAlias = <warning descr="Invalid type annotation">int | TypeAlias</warning>
|
||||
type TypeAlias2 = int | str
|
||||
""");
|
||||
}
|
||||
@@ -3029,7 +3029,7 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
// PY-76851
|
||||
public void testUnionRecursiveTypeAliasStatement() {
|
||||
doTestByText("""
|
||||
type TypeAlias = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">TypeAlias | int</warning>
|
||||
type TypeAlias = <warning descr="Invalid type annotation">TypeAlias | int</warning>
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -3037,9 +3037,9 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
// PY-76851
|
||||
public void testDeepRecursiveTypeAliasStatement() {
|
||||
doTestByText("""
|
||||
type TypeAlias1 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">TypeAlias2</warning>
|
||||
type TypeAlias2 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">TypeAlias3</warning>
|
||||
type TypeAlias3 = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">TypeAlias1</warning>
|
||||
type TypeAlias1 = <warning descr="Invalid type annotation">TypeAlias2</warning>
|
||||
type TypeAlias2 = <warning descr="Invalid type annotation">TypeAlias3</warning>
|
||||
type TypeAlias3 = <warning descr="Invalid type annotation">TypeAlias1</warning>
|
||||
""");
|
||||
}
|
||||
|
||||
@@ -3362,7 +3362,7 @@ public class PyTypeHintsInspectionTest extends PyInspectionTestCase {
|
||||
CARTESIAN = [Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST]
|
||||
print(CARTESIAN[0])
|
||||
|
||||
type Alias = <warning descr="Type hint is invalid or refers to the expression which is not a correct type">[int, str]</warning>
|
||||
type Alias = <warning descr="Invalid type annotation">[int, str]</warning>
|
||||
myAlias: TypeAlias = <warning descr="Assigned value of type alias must be a correct type">[int, str]</warning>
|
||||
""");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user