MCPcopy Index your code
hub / github.com/go-python/gopy / NewPackage

Function NewPackage

bind/package.go:53–75  ·  view source on GitHub ↗

NewPackage creates a new Package, tying types.Package and ast.Package together.

(pkg *types.Package, doc *doc.Package)

Source from the content-addressed store, hash-verified

51
52// NewPackage creates a new Package, tying types.Package and ast.Package together.
53func NewPackage(pkg *types.Package, doc *doc.Package) (*Package, error) {
54 // protection for parallel tests
55 universeMutex.Lock()
56 defer universeMutex.Unlock()
57 fmt.Printf("\n--- Processing package: %v ---\n", pkg.Path())
58 sz := int64(reflect.TypeOf(int(0)).Size())
59 p := &Package{
60 pkg: pkg,
61 n: 0,
62 sz: &types.StdSizes{WordSize: sz, MaxAlign: sz},
63 doc: doc,
64 syms: current,
65 objs: map[string]Object{},
66 pyimports: map[string]string{},
67 }
68 err := p.process()
69 if err != nil {
70 return nil, err
71 }
72
73 Packages = append(Packages, p)
74 return p, err
75}
76
77// Name returns the package name.
78func (p *Package) Name() string {

Callers 1

parsePackageFunction · 0.92

Calls 2

processMethod · 0.95
PrintfMethod · 0.80

Tested by

no test coverage detected