Get function from the module. Parameters ---------- name : str The name of the function query_imports : bool Whether also query modules imported by this module. Returns ------- f : Function The result func
(self, name, query_imports=False)
| 94 | return self._entry |
| 95 | |
| 96 | def get_function(self, name, query_imports=False): |
| 97 | """Get function from the module. |
| 98 | |
| 99 | Parameters |
| 100 | ---------- |
| 101 | name : str |
| 102 | The name of the function |
| 103 | |
| 104 | query_imports : bool |
| 105 | Whether also query modules imported by this module. |
| 106 | |
| 107 | Returns |
| 108 | ------- |
| 109 | f : Function |
| 110 | The result function. |
| 111 | """ |
| 112 | ret_handle = FunctionHandle() |
| 113 | check_call( |
| 114 | _LIB.DGLModGetFunction( |
| 115 | self.handle, |
| 116 | c_str(name), |
| 117 | ctypes.c_int(query_imports), |
| 118 | ctypes.byref(ret_handle), |
| 119 | ) |
| 120 | ) |
| 121 | if not ret_handle.value: |
| 122 | raise AttributeError("Module has no function '%s'" % name) |
| 123 | return Function(ret_handle, False) |
| 124 | |
| 125 | def import_module(self, module): |
| 126 | """Add module to the import list of current one. |
no test coverage detected