class_docstr: Object to wrap/evaluate user defined constraints.
  
  Very similar in practice to `PreparedConstraint`, except that no evaluation
  of jac/hess is performed (explicit or implicit).
  
  If created successfully, it will contain the attributes listed below.
  
  Parameters
  ----------
  constraint : {`NonlinearConstraint`, `LinearConstraint`, `Bounds`}
      Constraint to check and prepare.
  x0 : array_like
      Initial vector of independent variables.
  
  Attributes
  ----------
  fun : callable
      Function defining the constraint wrapped by one of the convenience
      classes.
  bounds : 2-tuple
      Contains lower and upper bounds for the constraints --- lb and ub.
      These are converted to ndarray and have a size equal to the number of
      the constraints.
class_docstr_tok: ["Object","to","wrap\/evaluate","user","defined","constraints",".","Very","similar","in","practice","to","`","PreparedConstraint","`",",","except","that","no","evaluation","of","jac\/hess","is","performed","(","explicit","or","implicit",")",".","If","created","successfully",",","it","will","contain","the","attributes","listed","below",".","Parameters","--","--","--","--","--","constraint",":","{","`","NonlinearConstraint","`",",","`","LinearConstraint","`",",","`","Bounds","`","}","Constraint","to","check","and","prepare",".","x0",":","array_like","Initial","vector","of","independent","variables",".","Attributes","--","--","--","--","--","fun",":","callable","Function","defining","the","constraint","wrapped","by","one","of","the","convenience","classes",".","bounds",":","2-tuple","Contains","lower","and","upper","bounds","for","the","constraints","--","-","lb","and","ub",".","These","are","converted","to","ndarray","and","have","a","size","equal","to","the","number","of","the","constraints","."]
code: def __init__(self, constraint, x0):
      self.constraint = constraint
  
      if isinstance(constraint, NonlinearConstraint):
  
          def fun(x):
              return np.atleast_1d(constraint.fun(x))
  
      elif isinstance(constraint, LinearConstraint):
  
          def fun(x):
              if issparse(constraint.A):
                  A = constraint.A
              else:
                  A = np.atleast_2d(constraint.A)
              return A.dot(x)
  
      elif isinstance(constraint, Bounds):
  
          def fun(x):
              return x
  
      else:
          raise ValueError("`constraint` of an unknown type is passed.")
  
      self.fun = fun
  
      lb = np.asarray(constraint.lb, dtype=float)
      ub = np.asarray(constraint.ub, dtype=float)
  
      f0 = fun(x0)
      m = f0.size
  
      if lb.ndim == 0:
          lb = np.resize(lb, m)
      if ub.ndim == 0:
          ub = np.resize(ub, m)
  
      self.bounds = (lb, ub)
  
imports: import warnings
  import numpy
  from scipy.optimize import OptimizeResult, minimize
  from scipy.optimize.optimize import _status_message
  from scipy._lib._util import check_random_state, MapWrapper
  from scipy.optimize._constraints import Bounds, new_bounds_to_old, NonlinearConstraint, LinearConstraint
  from scipy.sparse import issparse
label_desc: Use image node_id 1 to create a new _ConstraintWrapper object  with example: obj = _ConstraintWrapper(constraint, x0)