Changeset 21067f9 for python/lib


Ignore:
Timestamp:
Nov 17, 2018, 3:15:28 PM (6 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master
Children:
c879811
Parents:
da01353
Message:

[py] generate code for setters with no parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/lib/gen_code.py

    rda01353 r21067f9  
    471471            refs = ", ".join(["&%s" % p['name'] for p in params])
    472472            paramlist = ", ".join(["%s" % p['name'] for p in params])
     473            if len(params):
     474                paramlist = "," + paramlist
    473475            pyparamtypes = ''.join([pyargparse_chars[p['type']] for p in params])
    474476            out += """
     
    478480  uint_t err = 0;
    479481  {paramdecls}
     482""".format(param = param, paramdecls = paramdecls, **self.__dict__)
     483
     484            if len(refs) and len(pyparamtypes):
     485                out += """
    480486
    481487  if (!PyArg_ParseTuple (args, "{pyparamtypes}", {refs})) {{
    482488    return NULL;
    483489  }}
    484   err = aubio_{shortname}_set_{param} (self->o, {paramlist});
     490""".format(pyparamtypes = pyparamtypes, refs = refs)
     491
     492            out += """
     493  err = aubio_{shortname}_set_{param} (self->o {paramlist});
    485494
    486495  if (err > 0) {{
Note: See TracChangeset for help on using the changeset viewer.