@@ -132,7 +132,8 @@ enum class HintResolver {
132132 },
133133
134134 CLASS_ATTRIBUTE_HINT {
135- override fun isApplicable (settings : PythonVariablesInlayTypeHintsProvider .Settings ): Boolean = ! settings.showClassAttributeHints
135+ override fun isApplicable (settings : PythonVariablesInlayTypeHintsProvider .Settings ): Boolean =
136+ ! settings.showClassAttributeHints
136137
137138 override fun shouldShowTypeHint (
138139 element : PyTargetExpression ,
@@ -321,7 +322,9 @@ enum class HintResolver {
321322 if (isLiteralExpression(assignedValue)) {
322323 if ((typeAnnotation is PyTypedDictType || (typeAnnotation is PyClassType && typeAnnotation.pyClass.qualifiedName == PyNames .DICT )) && assignedValue is PySequenceExpression ) {
323324 // 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+ }) {
325328 return false
326329 }
327330
@@ -408,7 +411,12 @@ enum class HintResolver {
408411
409412 companion object {
410413 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 {
412420 val typeAnnotation = getExpressionAnnotationType(element, typeEvalContext)
413421
414422 return resolveEnabled(settings).any {
@@ -454,13 +462,14 @@ enum class HintResolver {
454462 || (element is PyFunction && typeAnnotation is PyNoneType )
455463 || ((element is PyFunction || element is PyTargetExpression ) && (element as PyTypeCommentOwner ).typeCommentAnnotation != null )
456464 || (element is PyAnnotationOwner && element.annotation != null )
457- || (element is PyFunction && ! element.textContains(" :" .single()))
458465 ) {
459466 return false
460467 }
461468
462469 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+ }
464473 }
465474
466475 if (PyTypeChecker .isUnknown(typeAnnotation, false , typeEvalContext)) {
0 commit comments