Created
December 10, 2016 16:00
-
-
Save Yardanico/a7264f64a5a1be09c062108eff163a63 to your computer and use it in GitHub Desktop.
test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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