@@ -132,7 +132,8 @@ enum class HintResolver {
132
132
},
133
133
134
134
CLASS_ATTRIBUTE_HINT {
135
- override fun isApplicable (settings : PythonVariablesInlayTypeHintsProvider .Settings ): Boolean = ! settings.showClassAttributeHints
135
+ override fun isApplicable (settings : PythonVariablesInlayTypeHintsProvider .Settings ): Boolean =
136
+ ! settings.showClassAttributeHints
136
137
137
138
override fun shouldShowTypeHint (
138
139
element : PyTargetExpression ,
@@ -321,7 +322,9 @@ enum class HintResolver {
321
322
if (isLiteralExpression(assignedValue)) {
322
323
if ((typeAnnotation is PyTypedDictType || (typeAnnotation is PyClassType && typeAnnotation.pyClass.qualifiedName == PyNames .DICT )) && assignedValue is PySequenceExpression ) {
323
324
// Handle case when dict contains all literal expressions
324
- if (assignedValue.elements.isNotEmpty() && assignedValue.elements.all { it is PyKeyValueExpression && isLiteralExpression(it.value) }) {
325
+ if (assignedValue.elements.isNotEmpty() && assignedValue.elements.all {
326
+ it is PyKeyValueExpression && isLiteralExpression(it.value)
327
+ }) {
325
328
return false
326
329
}
327
330
@@ -408,7 +411,12 @@ enum class HintResolver {
408
411
409
412
companion object {
410
413
val builtinMethods = setOf (" globals" , " locals" )
411
- fun resolve (element : PyTargetExpression , typeEvalContext : TypeEvalContext , settings : PythonVariablesInlayTypeHintsProvider .Settings ): Boolean {
414
+
415
+ fun resolve (
416
+ element : PyTargetExpression ,
417
+ typeEvalContext : TypeEvalContext ,
418
+ settings : PythonVariablesInlayTypeHintsProvider .Settings
419
+ ): Boolean {
412
420
val typeAnnotation = getExpressionAnnotationType(element, typeEvalContext)
413
421
414
422
return resolveEnabled(settings).any {
@@ -454,13 +462,14 @@ enum class HintResolver {
454
462
|| (element is PyFunction && typeAnnotation is PyNoneType )
455
463
|| ((element is PyFunction || element is PyTargetExpression ) && (element as PyTypeCommentOwner ).typeCommentAnnotation != null )
456
464
|| (element is PyAnnotationOwner && element.annotation != null )
457
- || (element is PyFunction && ! element.textContains(" :" .single()))
458
465
) {
459
466
return false
460
467
}
461
468
462
469
if (typeAnnotation is PyUnionType ) {
463
- return ! typeAnnotation.members.all { PyTypeChecker .isUnknown(it, false , typeEvalContext) || (it is PyNoneType || it == null ) }
470
+ return ! typeAnnotation.members.all {
471
+ PyTypeChecker .isUnknown(it, false , typeEvalContext) || (it is PyNoneType || it == null )
472
+ }
464
473
}
465
474
466
475
if (PyTypeChecker .isUnknown(typeAnnotation, false , typeEvalContext)) {
0 commit comments