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

Function replace

numpy/f2py/auxfuncs.py:809–825  ·  view source on GitHub ↗
(str, d, defaultsep='')

Source from the content-addressed store, hash-verified

807
808
809def replace(str, d, defaultsep=''):
810 if isinstance(d, list):
811 return [replace(str, _m, defaultsep) for _m in d]
812 if isinstance(str, list):
813 return [replace(_m, d, defaultsep) for _m in str]
814 for k in 2 * list(d.keys()):
815 if k == 'separatorsfor':
816 continue
817 if 'separatorsfor' in d and k in d['separatorsfor']:
818 sep = d['separatorsfor'][k]
819 else:
820 sep = defaultsep
821 if isinstance(d[k], list):
822 str = str.replace(f'#{k}#', sep.join(flatlist(d[k])))
823 else:
824 str = str.replace(f'#{k}#', d[k])
825 return str
826
827
828def dictappend(rd, ar):

Callers 3

applyrulesFunction · 0.70
buildcallbackFunction · 0.70
buildapiFunction · 0.70

Calls 4

flatlistFunction · 0.85
replaceMethod · 0.80
joinMethod · 0.80
keysMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…