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_py_fvec', |
---|
52 | 'fmat_t*': 'new_py_fmat', |
---|
53 | 'cvec_t*': 'new_py_cvec', |
---|
54 | } |
---|
55 | |
---|
56 | delfromtype_fn = { |
---|
57 | 'fvec_t*': 'Py_DECREF', |
---|
58 | 'fmat_t*': 'Py_DECREF', |
---|
59 | 'cvec_t*': 'Py_DECREF', |
---|
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 | struct_output_str = ["PyObject *{0[name]}; {1} c_{0[name]}".format(i, i['type'][:-1]) for i in self.do_outputs] |
---|
172 | self.struct_outputs = ";\n ".join(struct_output_str) |
---|
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 | {struct_outputs}; |
---|
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 input_param in input_params: |
---|
383 | out += """ |
---|
384 | |
---|
385 | if (!{pytoaubio}(py_{0[name]}, &(self->{0[name]}))) {{ |
---|
386 | return NULL; |
---|
387 | }}""".format(input_param, pytoaubio = pytoaubio_fn[input_param['type']]) |
---|
388 | out += """ |
---|
389 | |
---|
390 | // TODO: check input sizes""" |
---|
391 | for output_param in output_params: |
---|
392 | out += """ |
---|
393 | |
---|
394 | Py_INCREF(self->{0[name]}); |
---|
395 | if (!{pytoaubio}(self->{0[name]}, &(self->c_{0[name]}))) {{ |
---|
396 | return NULL; |
---|
397 | }}""".format(output_param, pytoaubio = pytoaubio_fn[output_param['type']]) |
---|
398 | do_fn = get_name(self.do_proto) |
---|
399 | inputs = ", ".join(['&(self->'+p['name']+')' for p in input_params]) |
---|
400 | c_outputs = ", ".join(["&(self->c_%s)" % p['name'] for p in self.do_outputs]) |
---|
401 | outputs = ", ".join(["self->%s" % p['name'] for p in self.do_outputs]) |
---|
402 | out += """ |
---|
403 | |
---|
404 | {do_fn}(self->o, {inputs}, {c_outputs}); |
---|
405 | |
---|
406 | return {outputs}; |
---|
407 | }} |
---|
408 | """.format( |
---|
409 | do_fn = do_fn, |
---|
410 | inputs = inputs, outputs = outputs, c_outputs = c_outputs, |
---|
411 | ) |
---|
412 | return out |
---|
413 | |
---|
414 | def gen_set(self): |
---|
415 | out = """ |
---|
416 | // {shortname} setters |
---|
417 | """.format(**self.__dict__) |
---|
418 | for set_param in self.prototypes['set']: |
---|
419 | params = get_params_types_names(set_param)[1] |
---|
420 | paramtype = params['type'] |
---|
421 | method_name = get_name(set_param) |
---|
422 | param = method_name.split('aubio_'+self.shortname+'_set_')[-1] |
---|
423 | pyparamtype = pyargparse_chars[paramtype] |
---|
424 | out += """ |
---|
425 | static PyObject * |
---|
426 | Pyaubio_{shortname}_set_{param} (Py_{shortname} *self, PyObject *args) |
---|
427 | {{ |
---|
428 | uint_t err = 0; |
---|
429 | {paramtype} {param}; |
---|
430 | |
---|
431 | if (!PyArg_ParseTuple (args, "{pyparamtype}", &{param})) {{ |
---|
432 | return NULL; |
---|
433 | }} |
---|
434 | err = aubio_{shortname}_set_{param} (self->o, {param}); |
---|
435 | |
---|
436 | if (err > 0) {{ |
---|
437 | PyErr_SetString (PyExc_ValueError, "error running aubio_{shortname}_set_{param}"); |
---|
438 | return NULL; |
---|
439 | }} |
---|
440 | Py_RETURN_NONE; |
---|
441 | }} |
---|
442 | """.format(param = param, paramtype = paramtype, pyparamtype = pyparamtype, **self.__dict__) |
---|
443 | return out |
---|
444 | |
---|
445 | def gen_get(self): |
---|
446 | out = """ |
---|
447 | // {shortname} getters |
---|
448 | """.format(**self.__dict__) |
---|
449 | for method in self.prototypes['get']: |
---|
450 | params = get_params_types_names(method) |
---|
451 | method_name = get_name(method) |
---|
452 | assert len(params) == 1, \ |
---|
453 | "get method has more than one parameter %s" % params |
---|
454 | param = method_name.split('aubio_'+self.shortname+'_get_')[-1] |
---|
455 | paramtype = get_return_type(method) |
---|
456 | ptypeconv = pyfromtype_fn[paramtype] |
---|
457 | out += """ |
---|
458 | static PyObject * |
---|
459 | Pyaubio_{shortname}_get_{param} (Py_{shortname} *self, PyObject *unused) |
---|
460 | {{ |
---|
461 | {ptype} {param} = aubio_{shortname}_get_{param} (self->o); |
---|
462 | return (PyObject *){ptypeconv} ({param}); |
---|
463 | }} |
---|
464 | """.format(param = param, ptype = paramtype, ptypeconv = ptypeconv, |
---|
465 | **self.__dict__) |
---|
466 | return out |
---|
467 | |
---|
468 | def gen_methodef(self): |
---|
469 | out = """ |
---|
470 | static PyMethodDef Py_{shortname}_methods[] = {{""".format(**self.__dict__) |
---|
471 | for m in self.prototypes['set']: |
---|
472 | name = get_name(m) |
---|
473 | shortname = name.replace('aubio_%s_' % self.shortname, '') |
---|
474 | out += """ |
---|
475 | {{"{shortname}", (PyCFunction) Py{name}, |
---|
476 | METH_VARARGS, ""}},""".format(name = name, shortname = shortname) |
---|
477 | for m in self.prototypes['get']: |
---|
478 | name = get_name(m) |
---|
479 | shortname = name.replace('aubio_%s_' % self.shortname, '') |
---|
480 | out += """ |
---|
481 | {{"{shortname}", (PyCFunction) Py{name}, |
---|
482 | METH_NOARGS, ""}},""".format(name = name, shortname = shortname) |
---|
483 | out += """ |
---|
484 | {NULL} /* sentinel */ |
---|
485 | }; |
---|
486 | """ |
---|
487 | return out |
---|
488 | |
---|
489 | def gen_typeobject(self): |
---|
490 | return """ |
---|
491 | PyTypeObject Py_{shortname}Type = {{ |
---|
492 | //PyObject_HEAD_INIT (NULL) |
---|
493 | //0, |
---|
494 | PyVarObject_HEAD_INIT (NULL, 0) |
---|
495 | "aubio.{shortname}", |
---|
496 | sizeof (Py_{shortname}), |
---|
497 | 0, |
---|
498 | (destructor) Py_{shortname}_del, |
---|
499 | 0, |
---|
500 | 0, |
---|
501 | 0, |
---|
502 | 0, |
---|
503 | 0, |
---|
504 | 0, |
---|
505 | 0, |
---|
506 | 0, |
---|
507 | 0, |
---|
508 | (ternaryfunc)Py_{shortname}_do, |
---|
509 | 0, |
---|
510 | 0, |
---|
511 | 0, |
---|
512 | 0, |
---|
513 | Py_TPFLAGS_DEFAULT, |
---|
514 | Py_{shortname}_doc, |
---|
515 | 0, |
---|
516 | 0, |
---|
517 | 0, |
---|
518 | 0, |
---|
519 | 0, |
---|
520 | 0, |
---|
521 | Py_{shortname}_methods, |
---|
522 | Py_{shortname}_members, |
---|
523 | 0, |
---|
524 | 0, |
---|
525 | 0, |
---|
526 | 0, |
---|
527 | 0, |
---|
528 | 0, |
---|
529 | (initproc) Py_{shortname}_init, |
---|
530 | 0, |
---|
531 | Py_{shortname}_new, |
---|
532 | }}; |
---|
533 | """.format(**self.__dict__) |
---|