nvalchemi.distributed.FunctionAdapter#
- class nvalchemi.distributed.FunctionAdapter(func, replacement=None)[source]#
Adapt a module-level function named by the real function object.
Ergonomic constructor for
PythonAdapter: derives the import path fromfuncitself, so callers writeFunctionAdapter(mol_sum, _owned_mol_sum)instead of spelling the module path and attribute name as strings. Returns aPythonAdapter, so install / restore / serialization are unchanged.Safe by construction: the target is resolved as
func.__module__+func.__name__and verified to be that exact object. A re-exported name (the same function bound under more than one module — e.g. fairchem’sreduce_node_to_system) can’t be distinguished from the resolved object, so it raises and asks for an explicitPythonAdapter(module_path=..., attr_name=...)naming the binding.- Parameters:
func (Any)
replacement (Callable[[...], Any] | None)
- Return type: