MCPcopy Create free account
hub / github.com/go-python/gopy / AddPyImport

Method AddPyImport

bind/package.go:88–107  ·  view source on GitHub ↗

add given path to python imports -- these packages were referenced

(ipath string, extra bool)

Source from the content-addressed store, hash-verified

86
87// add given path to python imports -- these packages were referenced
88func (p *Package) AddPyImport(ipath string, extra bool) {
89 mypath := p.pkg.Path()
90 if mypath == "go" {
91 return
92 }
93 if ipath == mypath {
94 return
95 }
96 if p.pyimports == nil {
97 p.pyimports = make(map[string]string)
98 }
99 if _, has := p.pyimports[ipath]; has {
100 return
101 }
102 nm := filepath.Base(ipath)
103 p.pyimports[ipath] = nm
104 // if extra {
105 // fmt.Printf("%v added py import: %v = %v\n", mypath, ipath, nm)
106 // }
107}
108
109// getDoc returns the doc string associated with types.Object
110// parent is the name of the containing scope ("" for global scope)

Callers 2

pyPkgIdMethod · 0.80
genPyWrapPreambleMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected