MCPcopy Create free account
hub / github.com/astercloud/aster / NewPythonRuntime

Function NewPythonRuntime

pkg/tools/bridge/runtime.go:73–90  ·  view source on GitHub ↗

NewPythonRuntime 创建 Python 运行时

(config *RuntimeConfig)

Source from the content-addressed store, hash-verified

71
72// NewPythonRuntime 创建 Python 运行时
73func NewPythonRuntime(config *RuntimeConfig) *PythonRuntime {
74 if config == nil {
75 config = DefaultRuntimeConfig()
76 }
77
78 // 查找 Python 可执行文件
79 pythonPath := "python3"
80 if path, err := exec.LookPath("python3"); err == nil {
81 pythonPath = path
82 } else if path, err := exec.LookPath("python"); err == nil {
83 pythonPath = path
84 }
85
86 return &PythonRuntime{
87 config: config,
88 pythonPath: pythonPath,
89 }
90}
91
92func (r *PythonRuntime) Language() Language {
93 return LangPython

Callers 9

mainFunction · 0.92
TestRuntime_TimeoutFunction · 0.85
TestRuntime_SyntaxErrorFunction · 0.85
TestPTCIntegrationFunction · 0.85
checkPythonAiohttpFunction · 0.85
NewRuntimeManagerFunction · 0.85

Calls 1

DefaultRuntimeConfigFunction · 0.85

Tested by 7

TestRuntime_TimeoutFunction · 0.68
TestRuntime_SyntaxErrorFunction · 0.68
TestPTCIntegrationFunction · 0.68
checkPythonAiohttpFunction · 0.68