Skip to content

Instantly share code, notes, and snippets.

@Yardanico
Created December 10, 2016 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Yardanico/a7264f64a5a1be09c062108eff163a63 to your computer and use it in GitHub Desktop.
Save Yardanico/a7264f64a5a1be09c062108eff163a63 to your computer and use it in GitHub Desktop.
test
class PythonFunction:
def __init__(self, args):
self.rtype, self.name, self.params = args
def generate_python(self):
pure_arguments = []
arguments = []
for param in self.params:
name, type = param
if name == 'callback':
# Don't process them for now
continue
# Get python type corresponding to C type
py_type = c_to_python.get(type, type)
pure_arguments.append(name)
arguments.append(name + ": " + py_type)
pure_args = ', '.join(pure_arguments)
args = ', '.join(arguments)
print(FUNCTION_TEMPLATE.format(fname=self.name,
args=args,
extra='',
pure_args=pure_args))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment