Skip to content

Remove python3parser in python code generation #1390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package org.utbot.python

import com.squareup.moshi.Moshi
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import org.utbot.framework.codegen.PythonSysPathImport
import org.utbot.framework.codegen.PythonSystemImport
import org.utbot.framework.codegen.PythonUserImport
import org.utbot.python.framework.codegen.model.PythonSysPathImport
import org.utbot.python.framework.codegen.model.PythonSystemImport
import org.utbot.python.framework.codegen.model.PythonUserImport
import org.utbot.framework.codegen.domain.TestFramework
import org.utbot.framework.codegen.domain.models.CgMethodTestSet
import org.utbot.framework.plugin.api.ExecutableId
Expand Down
3 changes: 3 additions & 0 deletions utbot-python/src/main/kotlin/org/utbot/python/UTPythonAPI.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package org.utbot.python

import io.github.danielnaczo.python3parser.model.stmts.compoundStmts.functionStmts.FunctionDef
import io.github.danielnaczo.python3parser.model.mods.Module
import org.utbot.framework.plugin.api.UtError
import org.utbot.framework.plugin.api.UtExecution
import org.utbot.python.framework.api.python.PythonClassId
import org.utbot.python.framework.api.python.util.pythonAnyClassId
import org.utbot.python.typing.MypyAnnotations
import org.utbot.python.utils.moduleToString

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

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