mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[python] Slightly simplified code (PyTypeHintsInspection.kt)
GitOrigin-RevId: 65179c153ec0f6c2a00ba85a269637bc9fc9aa6f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a6518212d0
commit
47b67bdbb4
+5
-7
@@ -810,8 +810,8 @@ class PyTypeHintsInspection : PyInspection() {
|
||||
|
||||
private fun checkGenericCompleteness(cls: PyClass) {
|
||||
var seenGeneric = false
|
||||
val genericTypeVars = linkedSetOf<PsiElement>()
|
||||
val nonGenericTypeVars = linkedSetOf<PsiElement>()
|
||||
val genericTypeVars = linkedSetOf<PyTargetExpression>()
|
||||
val nonGenericTypeVars = linkedSetOf<PyTargetExpression>()
|
||||
|
||||
cls.superClassExpressions.forEach { superClass ->
|
||||
val generics = collectGenerics(superClass)
|
||||
@@ -827,13 +827,11 @@ class PyTypeHintsInspection : PyInspection() {
|
||||
if (seenGeneric && (nonGenericTypeVars - genericTypeVars).isNotEmpty()) {
|
||||
val nonGenericTypeVarsNames = nonGenericTypeVars
|
||||
.asSequence()
|
||||
.filterIsInstance<PyTargetExpression>()
|
||||
.mapNotNull { it.name }
|
||||
.joinToString(", ")
|
||||
|
||||
val genericTypeVarsNames = genericTypeVars
|
||||
.asSequence()
|
||||
.filterIsInstance<PyTargetExpression>()
|
||||
.mapNotNull { it.name }
|
||||
.joinToString(", ")
|
||||
|
||||
@@ -844,14 +842,14 @@ class PyTypeHintsInspection : PyInspection() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun collectGenerics(superClassExpression: PyExpression): Pair<Set<PsiElement>?, Set<PsiElement>> {
|
||||
private fun collectGenerics(superClassExpression: PyExpression): Pair<Set<PyTargetExpression>?, Set<PyTargetExpression>> {
|
||||
val resolvedSuperClass =
|
||||
if (superClassExpression is PyReferenceExpression) multiFollowAssignmentsChain(superClassExpression)
|
||||
else listOf(superClassExpression)
|
||||
|
||||
var seenGeneric = false
|
||||
val genericTypeVars = linkedSetOf<PsiElement>()
|
||||
val nonGenericTypeVars = linkedSetOf<PsiElement>()
|
||||
val genericTypeVars = linkedSetOf<PyTargetExpression>()
|
||||
val nonGenericTypeVars = linkedSetOf<PyTargetExpression>()
|
||||
|
||||
resolvedSuperClass
|
||||
.asSequence()
|
||||
|
||||
Reference in New Issue
Block a user