allow systems to accept named args via `kwargs`.
swallow_extra_kwargs
is used to wrap value functions that are passed by the user.
Finalized Builders maintain a set valid_parameters
that contains the names of all the parameters accepted by value functions
(excluding the names for the site
parameters), as well as a flag accepts_kwargs
that is True/False if any of the value
functions accepts **kwargs
.
~~Finalized Builders subclass hamiltonian_submatrix
and validate the kwargs
that are passed by checking if there are any
keys in kwargs
that are not present in valid_parameters
. If accepts_kwargs
then this checking is not done. ~~
Currently there is no kwarg
checking in operator
, as it is not clear what "correct" behaviour would be in this case, as the an operator's onsite
can in principle take parameters that are not present in the system.
EDIT
we restrict the scope of this MR to not include keyword argument validation, as it is not clear what the behaviour should be wrt. args that are different for a central system and its leads for example (see comments below).