MCPcopy Create free account
hub / github.com/biometrics/openbr / _var_string_args_func

Function _var_string_args_func

scripts/brpy/__init__.py:21–33  ·  view source on GitHub ↗

Translates the C functions that are (int, char**, n char*, and optional extra types in *args) to a more pythonic version that wraps the char** arg in the appropriate type.

(func, n, *args)

Source from the content-addressed store, hash-verified

19 return [c_char_p]*n
20
21def _var_string_args_func(func, n, *args):
22 '''
23 Translates the C functions that are
24 (int, char**, n char*, and optional extra types in *args)
25 to a more pythonic version that wraps the char** arg in
26 the appropriate type.
27 '''
28 def call_func(one, two, *rest):
29 arr_type = c_char_p*len(two)
30 func.argtypes = [c_int, arr_type] + _string_args(n) + list(args)
31 arr = arr_type(*map(c_char_p, two))
32 return func(one, arr, *rest)
33 return call_func
34
35def _handle_string_func(func, *moretypes):
36 '''

Callers 1

init_brpyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected