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

Method genConstValue

bind/gen_varconst.go:118–138  ·  view source on GitHub ↗
(c *Const)

Source from the content-addressed store, hash-verified

116}
117
118func (g *pyGen) genConstValue(c *Const) {
119 // constants go directly into wrapper as-is
120 val := c.val
121 switch val {
122 case "true":
123 val = "True"
124 case "false":
125 val = "False"
126 }
127 g.pywrap.Printf("%s = %s\n", c.GoName(), val)
128 if c.doc != "" {
129 lns := strings.Split(c.doc, "\n")
130 g.pywrap.Printf(`"""`)
131 g.pywrap.Printf("\n")
132 for _, l := range lns {
133 g.pywrap.Printf("%s\n", l)
134 }
135 g.pywrap.Printf(`"""`)
136 g.pywrap.Printf("\n")
137 }
138}
139
140func (g *pyGen) genEnum(e *Enum) {
141 g.pywrap.Printf("class %s(Enum):\n", e.typ.Obj().Name())

Callers 2

genConstMethod · 0.95
genEnumMethod · 0.95

Calls 2

PrintfMethod · 0.80
GoNameMethod · 0.65

Tested by

no test coverage detected