mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
PY-73263 Python 3.13 Support - Code Insight - Typeshed
Remove custom deprecation check for abc. Typesheds now have deprecation decorator GitOrigin-RevId: 72ba0028bfda2d7eda4a8e01aed5962613305531
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4c8d95ccc7
commit
0f8e5afa8a
@@ -93,45 +93,6 @@ public final class PyDeprecationInspection extends PyInspection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void visitPyFunction(@NotNull PyFunction node) {
|
|
||||||
super.visitPyFunction(node);
|
|
||||||
|
|
||||||
final PyDecoratorList decoratorList = node.getDecoratorList();
|
|
||||||
if (!LanguageLevel.forElement(node).isPython2() && decoratorList != null) {
|
|
||||||
for (PyDecorator decorator : decoratorList.getDecorators()) {
|
|
||||||
for (KnownDecorator knownDecorator : PyKnownDecoratorUtil.asKnownDecorators(decorator, myTypeEvalContext)) {
|
|
||||||
final KnownDecorator deprecated;
|
|
||||||
final KnownDecorator builtin;
|
|
||||||
|
|
||||||
if (knownDecorator == KnownDecorator.ABC_ABSTRACTPROPERTY) {
|
|
||||||
deprecated = KnownDecorator.ABC_ABSTRACTPROPERTY;
|
|
||||||
builtin = KnownDecorator.PROPERTY;
|
|
||||||
}
|
|
||||||
else if (knownDecorator == KnownDecorator.ABC_ABSTRACTCLASSMETHOD) {
|
|
||||||
deprecated = KnownDecorator.ABC_ABSTRACTCLASSMETHOD;
|
|
||||||
builtin = KnownDecorator.CLASSMETHOD;
|
|
||||||
}
|
|
||||||
else if (knownDecorator == KnownDecorator.ABC_ABSTRACTSTATICMETHOD) {
|
|
||||||
deprecated = KnownDecorator.ABC_ABSTRACTSTATICMETHOD;
|
|
||||||
builtin = KnownDecorator.STATICMETHOD;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final KnownDecorator abcAbsMethod = KnownDecorator.ABC_ABSTRACTMETHOD;
|
|
||||||
final String message = PyPsiBundle.message("INSP.deprecation.abc.decorator.deprecated.use.alternative",
|
|
||||||
deprecated.getQualifiedName(),
|
|
||||||
builtin.getQualifiedName(),
|
|
||||||
abcAbsMethod.getQualifiedName());
|
|
||||||
|
|
||||||
registerProblem(decorator, message, ProblemHighlightType.LIKE_DEPRECATED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private PyElement resolve(@NotNull PyReferenceExpression node) {
|
private PyElement resolve(@NotNull PyReferenceExpression node) {
|
||||||
final PyElement resolve = PyUtil.as(node.getReference(getResolveContext()).resolve(), PyElement.class);
|
final PyElement resolve = PyUtil.as(node.getReference(getResolveContext()).resolve(), PyElement.class);
|
||||||
|
|||||||
@@ -2,25 +2,25 @@ import abc
|
|||||||
|
|
||||||
|
|
||||||
class A(metaclass=abc.ABCMeta):
|
class A(metaclass=abc.ABCMeta):
|
||||||
<warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use 'property' with 'abc.abstractmethod' instead">@abc.abstractproperty</warning>
|
@abc.<warning descr="Use 'property' with 'abstractmethod' instead">abstractproperty</warning>
|
||||||
def prop(self):
|
def prop(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
from abc import abstractproperty
|
from abc import <warning descr="Use 'property' with 'abstractmethod' instead">abstractproperty</warning>
|
||||||
|
|
||||||
|
|
||||||
class B(metaclass=abc.ABCMeta):
|
class B(metaclass=abc.ABCMeta):
|
||||||
<warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use 'property' with 'abc.abstractmethod' instead">@abstractproperty</warning>
|
@<warning descr="Use 'property' with 'abstractmethod' instead">abstractproperty</warning>
|
||||||
def prop(self):
|
def prop(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
from abc import abstractproperty as ap
|
from abc import <warning descr="Use 'property' with 'abstractmethod' instead">abstractproperty</warning> as ap
|
||||||
|
|
||||||
|
|
||||||
class C(metaclass=abc.ABCMeta):
|
class C(metaclass=abc.ABCMeta):
|
||||||
<warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use 'property' with 'abc.abstractmethod' instead">@ap</warning>
|
@<warning descr="Use 'property' with 'abstractmethod' instead">ap</warning>
|
||||||
def prop(self):
|
def prop(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -29,16 +29,16 @@ import abc as foo
|
|||||||
|
|
||||||
|
|
||||||
class D(metaclass=abc.ABCMeta):
|
class D(metaclass=abc.ABCMeta):
|
||||||
<warning descr="'abc.abstractproperty' is deprecated since Python 3.3. Use 'property' with 'abc.abstractmethod' instead">@foo.abstractproperty</warning>
|
@foo.<warning descr="Use 'property' with 'abstractmethod' instead">abstractproperty</warning>
|
||||||
def prop(self):
|
def prop(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class A:
|
class A:
|
||||||
<warning descr="'abc.abstractclassmethod' is deprecated since Python 3.3. Use 'classmethod' with 'abc.abstractmethod' instead">@abc.abstractclassmethod</warning>
|
@abc.<warning descr="Use 'classmethod' with 'abstractmethod' instead">abstractclassmethod</warning>
|
||||||
def foo(cls):
|
def foo(cls):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
<warning descr="'abc.abstractstaticmethod' is deprecated since Python 3.3. Use 'staticmethod' with 'abc.abstractmethod' instead">@abc.abstractstaticmethod</warning>
|
@abc.<warning descr="Use 'staticmethod' with 'abstractmethod' instead">abstractstaticmethod</warning>
|
||||||
def bar():
|
def bar():
|
||||||
pass
|
pass
|
||||||
Reference in New Issue
Block a user