@@ -5,7 +5,7 @@ import com.jetbrains.python.psi.PyLambdaExpression
55import com.jetbrains.python.psi.types.*
66
77enum class HintGenerator {
8- UNION_TYPE () {
8+ UNION_TYPE {
99 override fun handleType (type : PyType ? , typeEvalContext : TypeEvalContext ): String? {
1010 if (type !is PyUnionType ) {
1111 return null
@@ -24,7 +24,7 @@ enum class HintGenerator {
2424 }
2525 },
2626
27- COLLECTION_TYPE () {
27+ COLLECTION_TYPE {
2828 override fun handleType (type : PyType ? , typeEvalContext : TypeEvalContext ): String? {
2929 if (
3030 type is PyCollectionType
@@ -54,7 +54,7 @@ enum class HintGenerator {
5454 }
5555 },
5656
57- TUPLE_TYPE () {
57+ TUPLE_TYPE {
5858 override fun handleType (type : PyType ? , typeEvalContext : TypeEvalContext ): String? {
5959 if (type !is PyTupleType ) {
6060 return null
@@ -67,17 +67,17 @@ enum class HintGenerator {
6767 if (type.elementCount > 2 ) {
6868 val firstElement = generateTypeHintText(type.elementTypes[0 ], typeEvalContext)
6969 val secondElement = generateTypeHintText(type.elementTypes[1 ], typeEvalContext)
70-
70+
7171 return " ${PyNames .TUPLE } [$firstElement , $secondElement , ...]"
7272 }
73-
73+
7474 return type.elementTypes
7575 .mapNotNull { generateTypeHintText(it, typeEvalContext) }
7676 .joinToString(separator = " , " , prefix = " ${PyNames .TUPLE } [" , postfix = " ]" )
7777 }
7878 },
7979
80- CLASS_TYPE () {
80+ CLASS_TYPE {
8181 override fun handleType (type : PyType ? , typeEvalContext : TypeEvalContext ): String? {
8282 if (type is PyClassType && type.isDefinition) {
8383 return " ${PyNames .TYPE .replaceFirstChar { it.titlecaseChar() }} [${type.declarationElement?.name} ]"
@@ -87,17 +87,19 @@ enum class HintGenerator {
8787 }
8888 },
8989
90- FUNCTION_TYPE () {
90+ FUNCTION_TYPE {
9191 override fun handleType (type : PyType ? , typeEvalContext : TypeEvalContext ): String? {
9292 if (type !is PyFunctionType ) {
9393 return null
9494 }
9595
9696 val parametersText = when (type.callable) {
9797 is PyLambdaExpression -> type.callable.parameterList.getPresentableText(false , typeEvalContext)
98- else -> " (${type.callable.parameterList.parameters
99- .filter { ! it.isSelf }
100- .joinToString(separator = " , " ) { " ${HintUtil .getParameterAnnotationValue(it)} " }} )"
98+ else -> " (${
99+ type.callable.parameterList.parameters
100+ .filter { ! it.isSelf }
101+ .joinToString(separator = " , " ) { " ${HintUtil .getParameterAnnotationValue(it)} " }
102+ } )"
101103 }
102104
103105 val callableReturnType = typeEvalContext.getReturnType(type.callable)
@@ -106,7 +108,7 @@ enum class HintGenerator {
106108 }
107109 },
108110
109- ANY_TYPE () {
111+ ANY_TYPE {
110112 override fun handleType (type : PyType ? , typeEvalContext : TypeEvalContext ): String {
111113 return type?.name ? : PyNames .UNKNOWN_TYPE
112114 }
0 commit comments