MCPcopy Index your code
hub / github.com/ZeroIntensity/pointers.py / binding_base

Function binding_base

src/pointers/bindings.py:346–394  ·  view source on GitHub ↗
(
    fn: "ctypes._NamedFuncPointer",
    *simple_args,
    map_extra: Optional[StructMap] = None,
)

Source from the content-addressed store, hash-verified

344
345@handle
346def binding_base(
347 fn: "ctypes._NamedFuncPointer",
348 *simple_args,
349 map_extra: Optional[StructMap] = None,
350) -> Any:
351 smap = {**STRUCT_MAP, **(map_extra or {})}
352
353 args = [i if i is not NULL else None for i in simple_args]
354
355 validator_args = [
356 arg
357 if (
358 (not isinstance(arg, FunctionType))
359 and (not isinstance(arg, PyCFuncPtrType))
360 )
361 else _solve_func(
362 arg, # type: ignore
363 typ, # type: ignore
364 smap,
365 )
366 for arg, typ in zip(
367 args,
368 fn.argtypes or [None for _ in args], # type: ignore
369 )
370 ]
371
372 _validate_args(
373 validator_args,
374 fn,
375 smap,
376 )
377
378 res = fn(
379 *[
380 i
381 if not isinstance(
382 i,
383 _CFuncTransport,
384 )
385 else i.c_func
386 for i in validator_args
387 ]
388 )
389
390 return _decode_response(
391 res,
392 smap,
393 fn,
394 )
395
396@handle
397def make_string(data: StringLike) -> Union[bytes, ctypes.c_char_p]:

Callers 15

wrapperFunction · 0.85
api_binding_baseFunction · 0.85
isalnumFunction · 0.85
isalphaFunction · 0.85
iscntrlFunction · 0.85
isdigitFunction · 0.85
isgraphFunction · 0.85
islowerFunction · 0.85
isprintFunction · 0.85
ispunctFunction · 0.85
isspaceFunction · 0.85
isupperFunction · 0.85

Calls 3

_solve_funcFunction · 0.85
_validate_argsFunction · 0.85
_decode_responseFunction · 0.85

Tested by

no test coverage detected