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

Function isPyCompatField

bind/symbols.go:133–145  ·  view source on GitHub ↗

isPyCompatField checks if field is compatible with python

(f *types.Var)

Source from the content-addressed store, hash-verified

131
132// isPyCompatField checks if field is compatible with python
133func isPyCompatField(f *types.Var) (*symbol, error) {
134 if !f.Exported() || f.Embedded() {
135 return nil, fmt.Errorf("gopy: field not exported or is embedded")
136 }
137 ftyp := current.symtype(f.Type())
138 if _, isSig := f.Type().Underlying().(*types.Signature); isSig {
139 return nil, fmt.Errorf("gopy: type is function signature")
140 }
141 if f.Type().Underlying().String() == "interface{}" {
142 return nil, fmt.Errorf("gopy: type is interface{}")
143 }
144 return ftyp, isPyCompatVar(ftyp)
145}
146
147// isPyCompatFunc checks if function signature is a python-compatible function.
148// Returns nil if function is compatible, err message if not.

Callers 2

genStructInitMethod · 0.85
genStructMembersMethod · 0.85

Calls 3

isPyCompatVarFunction · 0.85
symtypeMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected