#NEWLINE# def _nonlin_wrapper( name , jac ) : #NEWLINE# #INDENT# '\n    Construct a solver wrapper with given name and jacobian approx.\n\n    It inspects the keyword arguments of ``jac.__init__``, and allows to\n    use the same arguments in the wrapper function, in addition to the\n    keyword arguments of `nonlin_solve`\n\n    ' #NEWLINE# ( args , varargs , varkw , defaults ) = _getargspec ( jac . __init__ ) #NEWLINE# kwargs = list ( zip ( args [ ( - len ( defaults ) ) : ] , defaults ) ) #NEWLINE# kw_str = ', ' . join ( [ ( '%s=%r' % ( k , v ) ) for ( k , v ) in kwargs ] ) #NEWLINE# if kw_str : #NEWLINE# #INDENT# kw_str = ( ', ' + kw_str ) #NEWLINE# #UNINDENT# kwkw_str = ', ' . join ( [ ( '%s=%s' % ( k , k ) ) for ( k , v ) in kwargs ] ) #NEWLINE# if kwkw_str : #NEWLINE# #INDENT# kwkw_str = ( kwkw_str + ', ' ) #NEWLINE# #UNINDENT# wrapper = "\ndef %(name)s(F, xin, iter=None %(kw)s, verbose=False, maxiter=None,\n             f_tol=None, f_rtol=None, x_tol=None, x_rtol=None,\n             tol_norm=None, line_search='armijo', callback=None, **kw):\n    jac = %(jac)s(%(kwkw)s **kw)\n    return nonlin_solve(F, xin, jac, iter, verbose, maxiter,\n                        f_tol, f_rtol, x_tol, x_rtol, tol_norm, line_search,\n                        callback)\n" #NEWLINE# wrapper = ( wrapper % dict ( name = name , kw = kw_str , jac = varargs . __name__ , kwkw = kwkw_str ) ) #NEWLINE# ns = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# ns . update ( globals ( ) ) #NEWLINE# exec_ ( wrapper , ns ) #NEWLINE# func = ns [ name ] #NEWLINE# func . __doc__ = jac . __doc__ #NEWLINE# _set_doc ( func ) #NEWLINE# return func