1 | aubiodefvalue = { |
---|
2 | # we have some clean up to do |
---|
3 | 'buf_size': 'Py_default_vector_length', |
---|
4 | 'win_s': 'Py_default_vector_length', |
---|
5 | # and here too |
---|
6 | 'hop_size': 'Py_default_vector_length / 2', |
---|
7 | 'hop_s': 'Py_default_vector_length / 2', |
---|
8 | # these should be alright |
---|
9 | 'samplerate': 'Py_aubio_default_samplerate', |
---|
10 | # now for the non obvious ones |
---|
11 | 'n_filters': '40', |
---|
12 | 'n_coeffs': '13', |
---|
13 | 'nelems': '10', |
---|
14 | 'flow': '0.', |
---|
15 | 'fhig': '1.', |
---|
16 | 'ilow': '0.', |
---|
17 | 'ihig': '1.', |
---|
18 | 'thrs': '0.5', |
---|
19 | 'ratio': '0.5', |
---|
20 | 'method': '"default"', |
---|
21 | 'uri': '"none"', |
---|
22 | } |
---|
23 | |
---|
24 | member_types = { |
---|
25 | 'name': 'type', |
---|
26 | 'char_t*': 'T_STRING', |
---|
27 | 'uint_t': 'T_INT', |
---|
28 | 'smpl_t': 'AUBIO_NPY_SMPL', |
---|
29 | } |
---|
30 | |
---|
31 | pyfromtype_fn = { |
---|
32 | 'smpl_t': 'PyFloat_FromDouble', |
---|
33 | 'uint_t': 'PyLong_FromLong', # was: 'PyInt_FromLong', |
---|
34 | 'fvec_t*': 'PyAubio_CFvecToArray', |
---|
35 | 'fmat_t*': 'PyAubio_CFmatToArray', |
---|
36 | } |
---|
37 | |
---|
38 | pytoaubio_fn = { |
---|
39 | 'fvec_t*': 'PyAubio_ArrayToCFvec', |
---|
40 | 'cvec_t*': 'PyAubio_PyCvecToCCvec', |
---|
41 | #'fmat_t*': 'PyAubio_ArrayToCFmat', |
---|
42 | } |
---|
43 | |
---|
44 | pyfromaubio_fn = { |
---|
45 | 'fvec_t*': 'PyAubio_CFvecToArray', |
---|
46 | 'cvec_t*': 'PyAubio_CCvecToArray', |
---|
47 | 'fmat_t*': 'PyAubio_CFmatToArray', |
---|
48 | } |
---|
49 | |
---|
50 | newfromtype_fn = { |
---|
51 | 'fvec_t*': 'new_fvec', |
---|
52 | 'fmat_t*': 'new_fmat', |
---|
53 | 'cvec_t*': 'new_cvec', |
---|
54 | } |
---|
55 | |
---|
56 | delfromtype_fn = { |
---|
57 | 'fvec_t*': 'del_fvec', |
---|
58 | 'fmat_t*': 'del_fmat', |
---|
59 | 'cvec_t*': 'del_cvec', |
---|
60 | } |
---|
61 | |
---|
62 | param_init = { |
---|
63 | 'char_t*': 'NULL', |
---|
64 | 'uint_t': '0', |
---|
65 | 'sint_t': 0, |
---|
66 | 'smpl_t': 0., |
---|
67 | 'lsmp_t': 0., |
---|
68 | } |
---|
69 | |
---|
70 | pyargparse_chars = { |
---|
71 | 'smpl_t': 'f', # if not usedouble else 'd', |
---|
72 | 'uint_t': 'I', |
---|
73 | 'sint_t': 'I', |
---|
74 | 'char_t*': 's', |
---|
75 | 'fmat_t*': 'O', |
---|
76 | 'fvec_t*': 'O', |
---|
77 | 'cvec_t*': 'O', |
---|
78 | } |
---|
79 | |
---|
80 | objoutsize = { |
---|
81 | 'onset': '1', |
---|
82 | 'pitch': '1', |
---|
83 | 'wavetable': 'self->hop_size', |
---|
84 | 'sampler': 'self->hop_size', |
---|
85 | 'mfcc': 'self->n_coeffs', |
---|
86 | 'specdesc': '1', |
---|
87 | 'tempo': '1', |
---|
88 | 'filterbank': 'self->n_filters', |
---|
89 | 'tss': 'self->hop_size', |
---|
90 | } |
---|
91 | |
---|
92 | def get_name(proto): |
---|
93 | name = proto.replace(' *', '* ').split()[1].split('(')[0] |
---|
94 | name = name.replace('*','') |
---|
95 | if name == '': raise ValueError(proto + "gave empty name") |
---|
96 | return name |
---|
97 | |
---|
98 | def get_return_type(proto): |
---|
99 | import re |
---|
100 | paramregex = re.compile('(\w+ ?\*?).*') |
---|
101 | outputs = paramregex.findall(proto) |
---|
102 | assert len(outputs) == 1 |
---|
103 | return outputs[0].replace(' ', '') |
---|
104 | |
---|
105 | def split_type(arg): |
---|
106 | """ arg = 'foo *name' |
---|
107 | return ['foo*', 'name'] """ |
---|
108 | l = arg.split() |
---|
109 | type_arg = {} #'type': l[0], 'name': l[1]} |
---|
110 | type_arg['type'] = " ".join(l[:-1]) |
---|
111 | type_arg['name'] = l[-1] |
---|
112 | # fix up type / name |
---|
113 | if type_arg['name'].startswith('*'): |
---|
114 | # ['foo', '*name'] -> ['foo*', 'name'] |
---|
115 | type_arg['type'] += '*' |
---|
116 | type_arg['name'] = type_arg['name'][1:] |
---|
117 | if type_arg['type'].endswith(' *'): |
---|
118 | # ['foo *', 'name'] -> ['foo*', 'name'] |
---|
119 | type_arg['type'] = type_arg['type'].replace(' *','*') |
---|
120 | if type_arg['type'].startswith('const '): |
---|
121 | # ['foo *', 'name'] -> ['foo*', 'name'] |
---|
122 | type_arg['type'] = type_arg['type'].replace('const ','') |
---|
123 | return type_arg |
---|
124 | |
---|
125 | def get_params(proto): |
---|
126 | """ get the list of parameters from a function prototype |
---|
127 | example: proto = "int main (int argc, char ** argv)" |
---|
128 | returns: ['int argc', 'char ** argv'] |
---|
129 | """ |
---|
130 | import re |
---|
131 | paramregex = re.compile('.*\((.*)\);') |
---|
132 | a = paramregex.findall(proto)[0].split(', ') |
---|
133 | #a = [i.replace('const ', '') for i in a] |
---|
134 | return a |
---|
135 | |
---|
136 | def get_input_params(proto): |
---|
137 | a = get_params(proto) |
---|
138 | return [i.replace('const ', '') for i in a if (i.startswith('const ') or i.startswith('uint_t ') or i.startswith('smpl_t '))] |
---|
139 | |
---|
140 | def get_output_params(proto): |
---|
141 | a = get_params(proto) |
---|
142 | return [i for i in a if not i.startswith('const ')][1:] |
---|
143 | |
---|
144 | def get_params_types_names(proto): |
---|
145 | """ get the list of parameters from a function prototype |
---|
146 | example: proto = "int main (int argc, char ** argv)" |
---|
147 | returns: [['int', 'argc'], ['char **','argv']] |
---|
148 | """ |
---|
149 | a = list(map(split_type, get_params(proto))) |
---|
150 | #print proto, a |
---|
151 | #import sys; sys.exit(1) |
---|
152 | return a |
---|
153 | |
---|
154 | class MappedObject(object): |
---|
155 | |
---|
156 | def __init__(self, prototypes, usedouble = False): |
---|
157 | if usedouble: |
---|
158 | pyargparse_chars['smpl_t'] = 'd' |
---|
159 | self.prototypes = prototypes |
---|
160 | |
---|
161 | self.shortname = prototypes['shortname'] |
---|
162 | self.longname = prototypes['longname'] |
---|
163 | self.new_proto = prototypes['new'][0] |
---|
164 | self.del_proto = prototypes['del'][0] |
---|
165 | self.do_proto = prototypes['do'][0] |
---|
166 | self.input_params = get_params_types_names(self.new_proto) |
---|
167 | self.input_params_list = "; ".join(get_input_params(self.new_proto)) |
---|
168 | self.outputs = get_params_types_names(self.do_proto)[2:] |
---|
169 | self.do_inputs = [get_params_types_names(self.do_proto)[1]] |
---|
170 | self.do_outputs = get_params_types_names(self.do_proto)[2:] |
---|
171 | self.outputs_flat = get_output_params(self.do_proto) |
---|
172 | self.output_results = "; ".join(self.outputs_flat) |
---|
173 | |
---|
174 | #print ("input_params: ", map(split_type, get_input_params(self.do_proto))) |
---|
175 | #print ("output_params", map(split_type, get_output_params(self.do_proto))) |
---|
176 | |
---|
177 | def gen_code(self): |
---|
178 | out = "" |
---|
179 | out += self.gen_struct() |
---|
180 | out += self.gen_doc() |
---|
181 | out += self.gen_new() |
---|
182 | out += self.gen_init() |
---|
183 | out += self.gen_del() |
---|
184 | out += self.gen_do() |
---|
185 | out += self.gen_memberdef() |
---|
186 | out += self.gen_set() |
---|
187 | out += self.gen_get() |
---|
188 | out += self.gen_methodef() |
---|
189 | out += self.gen_typeobject() |
---|
190 | return out |
---|
191 | |
---|
192 | def gen_struct(self): |
---|
193 | out = """ |
---|
194 | // {shortname} structure |
---|
195 | typedef struct{{ |
---|
196 | PyObject_HEAD |
---|
197 | // pointer to aubio object |
---|
198 | {longname} *o; |
---|
199 | // input parameters |
---|
200 | {input_params_list}; |
---|
201 | // do input vectors |
---|
202 | {do_inputs_list}; |
---|
203 | // output results |
---|
204 | {output_results}; |
---|
205 | }} Py_{shortname}; |
---|
206 | """ |
---|
207 | # fmat_t* / fvec_t* / cvec_t* inputs -> full fvec_t /.. struct in Py_{shortname} |
---|
208 | do_inputs_list = "; ".join(get_input_params(self.do_proto)).replace('fvec_t *','fvec_t').replace('fmat_t *', 'fmat_t').replace('cvec_t *', 'cvec_t') |
---|
209 | return out.format(do_inputs_list = do_inputs_list, **self.__dict__) |
---|
210 | |
---|
211 | def gen_doc(self): |
---|
212 | out = """ |
---|
213 | // TODO: add documentation |
---|
214 | static char Py_{shortname}_doc[] = \"undefined\"; |
---|
215 | """ |
---|
216 | return out.format(**self.__dict__) |
---|
217 | |
---|
218 | def gen_new(self): |
---|
219 | out = """ |
---|
220 | // new {shortname} |
---|
221 | static PyObject * |
---|
222 | Py_{shortname}_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) |
---|
223 | {{ |
---|
224 | Py_{shortname} *self; |
---|
225 | """.format(**self.__dict__) |
---|
226 | params = self.input_params |
---|
227 | for p in params: |
---|
228 | out += """ |
---|
229 | {type} {name} = {defval};""".format(defval = param_init[p['type']], **p) |
---|
230 | plist = ", ".join(["\"%s\"" % p['name'] for p in params]) |
---|
231 | out += """ |
---|
232 | static char *kwlist[] = {{ {plist}, NULL }};""".format(plist = plist) |
---|
233 | argchars = "".join([pyargparse_chars[p['type']] for p in params]) |
---|
234 | arglist = ", ".join(["&%s" % p['name'] for p in params]) |
---|
235 | out += """ |
---|
236 | if (!PyArg_ParseTupleAndKeywords (args, kwds, "|{argchars}", kwlist, |
---|
237 | {arglist})) {{ |
---|
238 | return NULL; |
---|
239 | }} |
---|
240 | """.format(argchars = argchars, arglist = arglist) |
---|
241 | out += """ |
---|
242 | self = (Py_{shortname} *) pytype->tp_alloc (pytype, 0); |
---|
243 | if (self == NULL) {{ |
---|
244 | return NULL; |
---|
245 | }} |
---|
246 | """.format(**self.__dict__) |
---|
247 | params = self.input_params |
---|
248 | for p in params: |
---|
249 | out += self.check_valid(p) |
---|
250 | out += """ |
---|
251 | return (PyObject *)self; |
---|
252 | } |
---|
253 | """ |
---|
254 | return out |
---|
255 | |
---|
256 | def check_valid(self, p): |
---|
257 | if p['type'] == 'uint_t': |
---|
258 | return self.check_valid_uint(p) |
---|
259 | if p['type'] == 'char_t*': |
---|
260 | return self.check_valid_char(p) |
---|
261 | else: |
---|
262 | print ("ERROR, no idea how to check %s for validity" % p['type']) |
---|
263 | |
---|
264 | def check_valid_uint(self, p): |
---|
265 | name = p['name'] |
---|
266 | return """ |
---|
267 | self->{name} = {defval}; |
---|
268 | if ((sint_t){name} > 0) {{ |
---|
269 | self->{name} = {name}; |
---|
270 | }} else if ((sint_t){name} < 0) {{ |
---|
271 | PyErr_SetString (PyExc_ValueError, "can not use negative value for {name}"); |
---|
272 | return NULL; |
---|
273 | }} |
---|
274 | """.format(defval = aubiodefvalue[name], name = name) |
---|
275 | |
---|
276 | def check_valid_char(self, p): |
---|
277 | name = p['name'] |
---|
278 | return """ |
---|
279 | self->{name} = {defval}; |
---|
280 | if ({name} != NULL) {{ |
---|
281 | self->{name} = {name}; |
---|
282 | }} |
---|
283 | """.format(defval = aubiodefvalue[name], name = name) |
---|
284 | |
---|
285 | def gen_init(self): |
---|
286 | out = """ |
---|
287 | // init {shortname} |
---|
288 | static int |
---|
289 | Py_{shortname}_init (Py_{shortname} * self, PyObject * args, PyObject * kwds) |
---|
290 | {{ |
---|
291 | """.format(**self.__dict__) |
---|
292 | new_name = get_name(self.new_proto) |
---|
293 | new_params = ", ".join(["self->%s" % s['name'] for s in self.input_params]) |
---|
294 | out += """ |
---|
295 | self->o = {new_name}({new_params}); |
---|
296 | """.format(new_name = new_name, new_params = new_params) |
---|
297 | paramchars = "%s" |
---|
298 | paramvals = "self->method" |
---|
299 | out += """ |
---|
300 | // return -1 and set error string on failure |
---|
301 | if (self->o == NULL) {{ |
---|
302 | //char_t errstr[30 + strlen(self->uri)]; |
---|
303 | //sprintf(errstr, "error creating {shortname} with params {paramchars}", {paramvals}); |
---|
304 | char_t errstr[60]; |
---|
305 | sprintf(errstr, "error creating {shortname} with given params"); |
---|
306 | PyErr_SetString (PyExc_Exception, errstr); |
---|
307 | return -1; |
---|
308 | }} |
---|
309 | """.format(paramchars = paramchars, paramvals = paramvals, **self.__dict__) |
---|
310 | output_create = "" |
---|
311 | for o in self.outputs: |
---|
312 | output_create += """ |
---|
313 | self->{name} = {create_fn}({output_size});""".format(name = o['name'], create_fn = newfromtype_fn[o['type']], output_size = objoutsize[self.shortname]) |
---|
314 | out += """ |
---|
315 | // TODO get internal params after actual object creation? |
---|
316 | """ |
---|
317 | out += """ |
---|
318 | // create outputs{output_create} |
---|
319 | """.format(output_create = output_create) |
---|
320 | out += """ |
---|
321 | return 0; |
---|
322 | } |
---|
323 | """ |
---|
324 | return out |
---|
325 | |
---|
326 | def gen_memberdef(self): |
---|
327 | out = """ |
---|
328 | static PyMemberDef Py_{shortname}_members[] = {{ |
---|
329 | """.format(**self.__dict__) |
---|
330 | for p in get_params_types_names(self.new_proto): |
---|
331 | tmp = " {{\"{name}\", {ttype}, offsetof (Py_{shortname}, {name}), READONLY, \"TODO documentation\"}},\n" |
---|
332 | pytype = member_types[p['type']] |
---|
333 | out += tmp.format(name = p['name'], ttype = pytype, shortname = self.shortname) |
---|
334 | out += """ {NULL}, // sentinel |
---|
335 | }; |
---|
336 | """ |
---|
337 | return out |
---|
338 | |
---|
339 | def gen_del(self): |
---|
340 | out = """ |
---|
341 | // del {shortname} |
---|
342 | static void |
---|
343 | Py_{shortname}_del (Py_{shortname} * self, PyObject * unused) |
---|
344 | {{""".format(**self.__dict__) |
---|
345 | for input_param in self.do_inputs: |
---|
346 | if input_param['type'] == 'fmat_t *': |
---|
347 | out += """ |
---|
348 | free(self->{0[name]}.data);""".format(input_param) |
---|
349 | for o in self.outputs: |
---|
350 | name = o['name'] |
---|
351 | del_out = delfromtype_fn[o['type']] |
---|
352 | out += """ |
---|
353 | {del_out}(self->{name});""".format(del_out = del_out, name = name) |
---|
354 | del_fn = get_name(self.del_proto) |
---|
355 | out += """ |
---|
356 | {del_fn}(self->o); |
---|
357 | Py_TYPE(self)->tp_free((PyObject *) self); |
---|
358 | }} |
---|
359 | """.format(del_fn = del_fn) |
---|
360 | return out |
---|
361 | |
---|
362 | def gen_do(self): |
---|
363 | output = self.outputs[0] |
---|
364 | out = """ |
---|
365 | // do {shortname} |
---|
366 | static PyObject* |
---|
367 | Py_{shortname}_do (Py_{shortname} * self, PyObject * args) |
---|
368 | {{""".format(**self.__dict__) |
---|
369 | input_params = self.do_inputs |
---|
370 | output_params = self.do_outputs |
---|
371 | #print input_params |
---|
372 | #print output_params |
---|
373 | for input_param in input_params: |
---|
374 | out += """ |
---|
375 | PyObject *py_{0};""".format(input_param['name'], input_param['type']) |
---|
376 | refs = ", ".join(["&py_%s" % p['name'] for p in input_params]) |
---|
377 | pyparamtypes = "".join([pyargparse_chars[p['type']] for p in input_params]) |
---|
378 | out += """ |
---|
379 | if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{ |
---|
380 | return NULL; |
---|
381 | }}""".format(refs = refs, pyparamtypes = pyparamtypes, **self.__dict__) |
---|
382 | for p in input_params: |
---|
383 | out += """ |
---|
384 | if (!{pytoaubio}(py_{0[name]}, &(self->{0[name]}))) {{ |
---|
385 | return NULL; |
---|
386 | }}""".format(input_param, pytoaubio = pytoaubio_fn[input_param['type']]) |
---|
387 | do_fn = get_name(self.do_proto) |
---|
388 | inputs = ", ".join(['&(self->'+p['name']+')' for p in input_params]) |
---|
389 | outputs = ", ".join(["self->%s" % p['name'] for p in self.do_outputs]) |
---|
390 | out += """ |
---|
391 | |
---|
392 | {do_fn}(self->o, {inputs}, {outputs}); |
---|
393 | |
---|
394 | return (PyObject *) {aubiotonumpy} ({outputs}); |
---|
395 | }} |
---|
396 | """.format( |
---|
397 | do_fn = do_fn, |
---|
398 | aubiotonumpy = pyfromaubio_fn[output['type']], |
---|
399 | inputs = inputs, outputs = outputs, |
---|
400 | ) |
---|
401 | return out |
---|
402 | |
---|
403 | def gen_set(self): |
---|
404 | out = """ |
---|
405 | // {shortname} setters |
---|
406 | """.format(**self.__dict__) |
---|
407 | for set_param in self.prototypes['set']: |
---|
408 | params = get_params_types_names(set_param)[1] |
---|
409 | paramtype = params['type'] |
---|
410 | method_name = get_name(set_param) |
---|
411 | param = method_name.split('aubio_'+self.shortname+'_set_')[-1] |
---|
412 | pyparamtype = pyargparse_chars[paramtype] |
---|
413 | out += """ |
---|
414 | static PyObject * |
---|
415 | Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args) |
---|
416 | {{ |
---|
417 | uint_t err = 0; |
---|
418 | {paramtype} {param}; |
---|
419 | |
---|
420 | if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{ |
---|
421 | return NULL; |
---|
422 | }} |
---|
423 | err = aubio_{shortname}_set_{param} (self->o, {param}); |
---|
424 | |
---|
425 | if (err > 0) {{ |
---|
426 | PyErr_SetString (PyExc_ValueError, "error running aubio_{shortname}_set_{param}"); |
---|
427 | return NULL; |
---|
428 | }} |
---|
429 | Py_RETURN_NONE; |
---|
430 | }} |
---|
431 | """.format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__) |
---|
432 | return out |
---|
433 | |
---|
434 | def gen_get(self): |
---|
435 | out = """ |
---|
436 | // {shortname} getters |
---|
437 | """.format(**self.__dict__) |
---|
438 | for method in self.prototypes['get']: |
---|
439 | params = get_params_types_names(method) |
---|
440 | method_name = get_name(method) |
---|
441 | assert len(params) == 1, \ |
---|
442 | "get method has more than one parameter %s" % params |
---|
443 | param = method_name.split('aubio_'+self.shortname+'_get_')[-1] |
---|
444 | paramtype = get_return_type(method) |
---|
445 | ptypeconv = pyfromtype_fn[paramtype] |
---|
446 | out += """ |
---|
447 | static PyObject * |
---|
448 | Pyaubio_{shortname}_get_{param} (Py_{shortname} *self, PyObject *unused) |
---|
449 | {{ |
---|
450 | {ptype} {param} = aubio_{shortname}_get_{param} (self->o); |
---|
451 | return (PyObject *){ptypeconv} ({param}); |
---|
452 | }} |
---|
453 | """.format(param = param, ptype = paramtype, ptypeconv = ptypeconv, |
---|
454 | **self.__dict__) |
---|
455 | return out |
---|
456 | |
---|
457 | def gen_methodef(self): |
---|
458 | out = """ |
---|
459 | static PyMethodDef Py_{shortname}_methods[] = {{""".format(**self.__dict__) |
---|
460 | for m in self.prototypes['set']: |
---|
461 | name = get_name(m) |
---|
462 | shortname = name.replace('aubio_%s_' % self.shortname, '') |
---|
463 | out += """ |
---|
464 | {{"{shortname}", (PyCFunction) Py{name}, |
---|
465 | METH_VARARGS, ""}},""".format(name = name, shortname = shortname) |
---|
466 | for m in self.prototypes['get']: |
---|
467 | name = get_name(m) |
---|
468 | shortname = name.replace('aubio_%s_' % self.shortname, '') |
---|
469 | out += """ |
---|
470 | {{"{shortname}", (PyCFunction) Py{name}, |
---|
471 | METH_NOARGS, ""}},""".format(name = name, shortname = shortname) |
---|
472 | out += """ |
---|
473 | {NULL} /* sentinel */ |
---|
474 | }; |
---|
475 | """ |
---|
476 | return out |
---|
477 | |
---|
478 | def gen_typeobject(self): |
---|
479 | return """ |
---|
480 | PyTypeObject Py_{shortname}Type = {{ |
---|
481 | //PyObject_HEAD_INIT (NULL) |
---|
482 | //0, |
---|
483 | PyVarObject_HEAD_INIT (NULL, 0) |
---|
484 | "aubio.{shortname}", |
---|
485 | sizeof (Py_{shortname}), |
---|
486 | 0, |
---|
487 | (destructor) Py_{shortname}_del, |
---|
488 | 0, |
---|
489 | 0, |
---|
490 | 0, |
---|
491 | 0, |
---|
492 | 0, |
---|
493 | 0, |
---|
494 | 0, |
---|
495 | 0, |
---|
496 | 0, |
---|
497 | (ternaryfunc)Py_{shortname}_do, |
---|
498 | 0, |
---|
499 | 0, |
---|
500 | 0, |
---|
501 | 0, |
---|
502 | Py_TPFLAGS_DEFAULT, |
---|
503 | Py_{shortname}_doc, |
---|
504 | 0, |
---|
505 | 0, |
---|
506 | 0, |
---|
507 | 0, |
---|
508 | 0, |
---|
509 | 0, |
---|
510 | Py_{shortname}_methods, |
---|
511 | Py_{shortname}_members, |
---|
512 | 0, |
---|
513 | 0, |
---|
514 | 0, |
---|
515 | 0, |
---|
516 | 0, |
---|
517 | 0, |
---|
518 | (initproc) Py_{shortname}_init, |
---|
519 | 0, |
---|
520 | Py_{shortname}_new, |
---|
521 | }}; |
---|
522 | """.format(**self.__dict__) |
---|