MCPcopy Index your code
hub / github.com/numpy/numpy / buildapi

Function buildapi

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

Source from the content-addressed store, hash-verified

1519
1520
1521def buildapi(rout):
1522 rout, wrap = func2subr.assubr(rout)
1523 args, depargs = getargs2(rout)
1524 capi_maps.depargs = depargs
1525 var = rout['vars']
1526
1527 if ismoduleroutine(rout):
1528 module_name = rout['modulename']
1529 name = rout['name']
1530 outmess(' Constructing wrapper function '
1531 f'"{module_name}.{name}"...\n')
1532 else:
1533 outmess(f" Constructing wrapper function \"{rout['name']}\"...\n")
1534 # Routine
1535 vrd = capi_maps.routsign2map(rout)
1536 rd = dictappend({}, vrd)
1537 for r in rout_rules:
1538 if ('_check' in r and r['_check'](rout)) or ('_check' not in r):
1539 ar = applyrules(r, vrd, rout)
1540 rd = dictappend(rd, ar)
1541
1542 # Args
1543 nth, nthk = 0, 0
1544 savevrd = {}
1545 for a in args:
1546 vrd = capi_maps.sign2map(a, var[a])
1547 if isintent_aux(var[a]):
1548 _rules = aux_rules
1549 else:
1550 _rules = arg_rules
1551 if not isintent_hide(var[a]):
1552 if not isoptional(var[a]):
1553 nth = nth + 1
1554 vrd['nth'] = repr(nth) + stnd[nth % 10] + ' argument'
1555 else:
1556 nthk = nthk + 1
1557 vrd['nth'] = repr(nthk) + stnd[nthk % 10] + ' keyword'
1558 else:
1559 vrd['nth'] = 'hidden'
1560 savevrd[a] = vrd
1561 for r in _rules:
1562 if '_depend' in r:
1563 continue
1564 if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):
1565 ar = applyrules(r, vrd, var[a])
1566 rd = dictappend(rd, ar)
1567 if '_break' in r:
1568 break
1569 for a in depargs:
1570 if isintent_aux(var[a]):
1571 _rules = aux_rules
1572 else:
1573 _rules = arg_rules
1574 vrd = savevrd[a]
1575 for r in _rules:
1576 if '_depend' not in r:
1577 continue
1578 if ('_check' in r and r['_check'](var[a])) or ('_check' not in r):

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…