mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-79063 migrate remaining 262 callers off deprecated PyCollectionType
Follow-up to the eb382056 cherry-pick: 262-only code paths not covered by the original commit still used the now-deprecated PyCollectionType marker. Switch them to PyClassType + isParameterized() and make the SQLAlchemy helper static, matching the commit's idiom. GitOrigin-RevId: c1e526da373d1e895869b9e10dca456c18e7a1fa
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7286220b3c
commit
2170579103
+2
-2
@@ -8,7 +8,7 @@ import com.jetbrains.python.psi.PyDoubleStarExpression;
|
||||
import com.jetbrains.python.psi.PyElementVisitor;
|
||||
import com.jetbrains.python.psi.PyExpression;
|
||||
import com.jetbrains.python.psi.PyKeyValueExpression;
|
||||
import com.jetbrains.python.psi.types.PyCollectionType;
|
||||
import com.jetbrains.python.psi.types.PyClassType;
|
||||
import com.jetbrains.python.psi.types.PyCollectionTypeImpl;
|
||||
import com.jetbrains.python.psi.types.PyLiteralType;
|
||||
import com.jetbrains.python.psi.types.PyType;
|
||||
@@ -39,7 +39,7 @@ public class PyDictCompExpressionImpl extends PyComprehensionElementImpl impleme
|
||||
final PyExpression mapping = doubleStarExpression.getExpression();
|
||||
if (mapping != null &&
|
||||
PyTypeUtil.convertToType(context.getType(mapping), "typing.Mapping", doubleStarExpression, context)
|
||||
instanceof PyCollectionType mappingType) {
|
||||
instanceof PyClassType mappingType && mappingType.isParameterized()) {
|
||||
final List<PyType> elementTypes = mappingType.getTypeArguments();
|
||||
if (elementTypes.size() == 2) {
|
||||
keyType = elementTypes.get(0);
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.jetbrains.python.getEffectiveLanguageLevel
|
||||
import com.jetbrains.python.psi.LanguageLevel
|
||||
import com.jetbrains.python.psi.PyClass
|
||||
import com.jetbrains.python.psi.types.PyClassType
|
||||
import com.jetbrains.python.psi.types.PyCollectionType
|
||||
import com.jetbrains.python.psi.types.PyLiteralStringType
|
||||
import com.jetbrains.python.psi.types.PyLiteralType
|
||||
import com.jetbrains.python.psi.types.PyNamedTupleType
|
||||
@@ -39,7 +38,7 @@ internal fun PresentationTreeBuilder.printPyTypeHint(type: PyType?, context: Typ
|
||||
// tuple[...] (homogeneous/empty forms) and NamedTuple have dedicated formatting.
|
||||
type is PyTupleType || type is PyNamedTupleType -> fallbackText(type, context)
|
||||
type is PyUnionType -> printUnion(type, context)
|
||||
type is PyCollectionType && !type.isDefinition -> printGenericType(type, context)
|
||||
type is PyClassType && type.isParameterized && !type.isDefinition -> printGenericType(type, context)
|
||||
type is PyClassType && !type.isDefinition -> printClassType(type, context)
|
||||
else -> fallbackText(type, context)
|
||||
}
|
||||
@@ -73,7 +72,7 @@ private fun PresentationTreeBuilder.printUnion(union: PyUnionType, context: Type
|
||||
fallbackText(union, context)
|
||||
}
|
||||
|
||||
private fun PresentationTreeBuilder.printGenericType(type: PyCollectionType, context: TypeEvalContext) {
|
||||
private fun PresentationTreeBuilder.printGenericType(type: PyClassType, context: TypeEvalContext) {
|
||||
val name = type.name
|
||||
val origin = context.origin
|
||||
val builtinGenericsAvailable = origin == null || getEffectiveLanguageLevel(origin).isAtLeast(LanguageLevel.PYTHON39)
|
||||
|
||||
Reference in New Issue
Block a user