MCPcopy Create free account
hub / github.com/numpy/numpy / buildapi

Function buildapi

numpy/f2py/rules.py:1450–1565  ·  view source on GitHub ↗
(rout)

Source from the content-addressed store, hash-verified

1448
1449
1450def buildapi(rout):
1451 rout, wrap = func2subr.assubr(rout)
1452 args, depargs = getargs2(rout)
1453 capi_maps.depargs = depargs
1454 var = rout['vars']
1455
1456 if ismoduleroutine(rout):
1457 outmess(' Constructing wrapper function "%s.%s"...\n' %
1458 (rout['modulename'], rout['name']))
1459 else:
1460 outmess(' Constructing wrapper function "%s"...\n' % (rout['name']))
1461 # Routine
1462 vrd = capi_maps.routsign2map(rout)
1463 rd = dictappend({}, vrd)
1464 for r in rout_rules:
1465 if ('_check' in r and r['_check'](rout)) or ('_check' not in r):
1466 ar = applyrules(r, vrd, rout)
1467 rd = dictappend(rd, ar)
1468
1469 # Args
1470 nth, nthk = 0, 0
1471 savevrd = {}
1472 for a in args:
1473 vrd = capi_maps.sign2map(a, var[a])
1474 if isintent_aux(var[a]):
1475 _rules = aux_rules
1476 else:
1477 _rules = arg_rules
1478 if not isintent_hide(var[a]):
1479 if not isoptional(var[a]):
1480 nth = nth + 1
1481 vrd['nth'] = repr(nth) + stnd[nth % 10] + ' argument'
1482 else:
1483 nthk = nthk + 1
1484 vrd['nth'] = repr(nthk) + stnd[nthk % 10] + ' keyword'
1485 else:
1486 vrd['nth'] = 'hidden'
1487 savevrd[a] = vrd
1488 for r in _rules:
1489 if '_depend' in r:
1490 continue
1491 if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
1492 ar = applyrules(r, vrd, var[a])
1493 rd = dictappend(rd, ar)
1494 if '_break' in r:
1495 break
1496 for a in depargs:
1497 if isintent_aux(var[a]):
1498 _rules = aux_rules
1499 else:
1500 _rules = arg_rules
1501 vrd = savevrd[a]
1502 for r in _rules:
1503 if '_depend' not in r:
1504 continue
1505 if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
1506 ar = applyrules(r, vrd, var[a])
1507 rd = dictappend(rd, ar)

Callers 1

buildmoduleFunction · 0.85

Calls 11

getargs2Function · 0.85
ismoduleroutineFunction · 0.85
dictappendFunction · 0.85
applyrulesFunction · 0.85
isintent_auxFunction · 0.85
isintent_hideFunction · 0.85
isoptionalFunction · 0.85
stripcommaFunction · 0.85
replaceMethod · 0.80
outmessFunction · 0.70
replaceFunction · 0.70

Tested by

no test coverage detected