Skip to content

Commit df40a70

Browse files
authored
Remove python3parser in python code generation (#1390)
Remove python3parser from python codegen (code for running and code for mypy checking) Co-authored-by: Vyacheslav Tamarin <vyacheslav.tamarin@yandex.ru>
1 parent 62a6bfe commit df40a70

File tree

11 files changed

+182
-431
lines changed

11 files changed

+182
-431
lines changed

utbot-python/src/main/kotlin/org/utbot/python/PythonTestGenerationProcessor.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ package org.utbot.python
22

33
import com.squareup.moshi.Moshi
44
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
5-
import org.utbot.framework.codegen.PythonSysPathImport
6-
import org.utbot.framework.codegen.PythonSystemImport
7-
import org.utbot.framework.codegen.PythonUserImport
5+
import org.utbot.python.framework.codegen.model.PythonSysPathImport
6+
import org.utbot.python.framework.codegen.model.PythonSystemImport
7+
import org.utbot.python.framework.codegen.model.PythonUserImport
88
import org.utbot.framework.codegen.domain.TestFramework
99
import org.utbot.framework.codegen.domain.models.CgMethodTestSet
1010
import org.utbot.framework.plugin.api.ExecutableId

utbot-python/src/main/kotlin/org/utbot/python/UTPythonAPI.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package org.utbot.python
22

33
import io.github.danielnaczo.python3parser.model.stmts.compoundStmts.functionStmts.FunctionDef
4+
import io.github.danielnaczo.python3parser.model.mods.Module
45
import org.utbot.framework.plugin.api.UtError
56
import org.utbot.framework.plugin.api.UtExecution
67
import org.utbot.python.framework.api.python.PythonClassId
78
import org.utbot.python.framework.api.python.util.pythonAnyClassId
89
import org.utbot.python.typing.MypyAnnotations
10+
import org.utbot.python.utils.moduleToString
911

1012
data class PythonArgument(val name: String, val annotation: String?)
1113

@@ -17,6 +19,7 @@ interface PythonMethod {
1719
fun asString(): String
1820
fun ast(): FunctionDef
1921
val containingPythonClassId: PythonClassId?
22+
fun codeLines(): List<String> = moduleToString(Module(listOf(ast().body))).split('\n')
2023
fun methodSignature(): String = "$name(" + arguments.joinToString(", ") {
2124
"${it.name}: ${it.annotation ?: pythonAnyClassId.name}"
2225
} + ")"

0 commit comments

Comments
 (0)