Skip to content

Commit

Permalink
feat(bindgen): python dispatch function output file support
Browse files Browse the repository at this point in the history
  • Loading branch information
thewtex committed Sep 29, 2023
1 parent ce05163 commit e171721
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/bindgen/python/dispatch-function-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import functionModuleImports from './function-module-imports.js'
import functionModuleArgs from './function-module-args.js'
import functionModuleDocstring from './function-module-docstring.js'
import functionModuleReturnType from './function-module-return-type.js'
import interfaceJsonTypeToInterfaceType from '../interface-json-type-to-interface-type.js'

function dispatchFunctionModule(interfaceJson, pypackage, modulePath) {
const functionName = snakeCase(interfaceJson.name)
Expand All @@ -24,9 +25,22 @@ from itkwasm import (
const docstring = functionModuleDocstring(interfaceJson)

let functionArgsToPass = ""
interfaceJson['inputs'].forEach((value) => {
interfaceJson.inputs.forEach((value) => {
functionArgsToPass += `${snakeCase(value.name)}, `
})
interfaceJson.outputs.forEach((output) => {
if (interfaceJsonTypeToInterfaceType.has(output.type)) {
const interfaceType = interfaceJsonTypeToInterfaceType.get(output.type)
switch (interfaceType) {
case "TextFile":
case "BinaryFile":
functionArgsToPass += `${snakeCase(output.name)}, `
break
default:
//
}
}
})
interfaceJson['parameters'].forEach((value) => {
if (value.name === "memory-io" || value.name === "version") {
return
Expand Down

0 comments on commit e171721

Please sign in to comment.