iqm.cpc.compiler.compiler.compiler_pass#
- iqm.cpc.compiler.compiler.compiler_pass(function)#
Convenience wrapper to create a valid compiler pass.
When the wrapped function is called, the compilation data (e.g. circuits) is passed as the first argument. If
function
has any other arguments, the wrapper takes their values from thecontext
dict. If no matching key is found for a required argument, an error is raised.function` must return either a tuple of ``(data, ctx)
wheredata
is the compilation result andctx
is a dict with any new context data, or onlydata
. The contents ofctx
will be merged to the input context. Note the difference to a plain, unwrapped CompilationPass: not returningctx
is valid.