MCPcopy
hub / github.com/dmlc/dgl / _init_api_prefix

Function _init_api_prefix

python/dgl/_ffi/function.py:305–330  ·  view source on GitHub ↗
(module_name, prefix)

Source from the content-addressed store, hash-verified

303
304
305def _init_api_prefix(module_name, prefix):
306 module = sys.modules[module_name]
307 name_list = []
308
309 for name in list_global_func_names():
310 if name.startswith("_") and not name.startswith("_deprecate"):
311 # internal APIs are ignored
312 continue
313 name_split = name.rsplit(".", 1)
314 if name_split[0] != prefix:
315 continue
316
317 if len(name_split) == 1:
318 print('Warning: invalid API name "%s".' % name)
319 continue
320 fname = name_split[1]
321 target_module = module
322
323 f = get_global_func(name)
324 ff = _get_api(f)
325 ff.__name__ = fname
326 ff.__doc__ = "DGL PackedFunc %s. " % fname
327 setattr(target_module, ff.__name__, ff)
328 name_list.append(fname)
329
330 return name_list
331
332
333def _init_internal_api():

Callers 1

_init_apiFunction · 0.85

Calls 4

list_global_func_namesFunction · 0.85
get_global_funcFunction · 0.85
_get_apiFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected