File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
utbot-python/src/main/kotlin/org/utbot/python/framework/codegen/model Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -107,8 +107,18 @@ class PythonCodeGenerator(
107
107
imports.forEach { renderer.renderPythonImport(it) }
108
108
109
109
val paramNames = method.argumentsNames
110
- val parameters = paramNames.map { argument ->
111
- " ${argument} : ${methodAnnotations[argument]?.pythonTypeRepresentation() ? : pythonAnyType.pythonTypeRepresentation()} "
110
+ val parameters: List <String > = paramNames.map { argument ->
111
+ if (methodAnnotations[argument]?.meta.toString() == " numpy.ndarray" ) {
112
+ val re = """ , .*[^]]""" .toRegex()
113
+ val type = re.find(methodAnnotations[argument]?.pythonTypeRepresentation().toString())?.value
114
+ val newAnnotation: String =
115
+ type?.let {
116
+ methodAnnotations[argument]?.pythonTypeRepresentation().toString()
117
+ .replace(it, " , ${pythonAnyType.pythonTypeRepresentation()} " )
118
+ } ? : pythonAnyType.pythonTypeRepresentation()
119
+ " ${argument} : $newAnnotation "
120
+ } else
121
+ " ${argument} : ${methodAnnotations[argument]?.pythonTypeRepresentation() ? : pythonAnyType.pythonTypeRepresentation()} "
112
122
}
113
123
114
124
val functionPrefix = " __mypy_check"
You can’t perform that action at this time.
0 commit comments