
    bi                    B    d Z ddlmZ ddlmZ ddlmZ  G d de      Zy)a,  
Copyright 2013 Steven Diamond

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
    )annotations)Callable)	Parameterc                  Z     e Zd ZdZdd fdZed        Zej                  d        Z xZS )CallbackParama  
    A parameter whose value is derived from a callback function.

    Enables writing replacing expression that would not be DPP
    by a new parameter that automatically updates its value.

    Example:
    With p and q parameters, p * q is not DPP, but
    pq = CallbackParameter(callback=lambda: p.value * q.value) is DPP.

    This is useful when only p and q should be exposed
    to the user, but pq is needed internally.
    c                <    || _         t        t        |   |fi | y)zM
        callback: function that returns the value of the parameter.
        N)	_callbacksuperr   __init__)selfcallbackshapekwargs	__class__s       e/home/cdr/jupyterlab/.venv/lib/python3.12/site-packages/cvxpy/expressions/constants/callback_param.pyr   zCallbackParam.__init__&   s     
 "mT+E<V<    c                @    | j                  | j                               S )z0Evaluate the callback to get the value.
        )_validate_valuer	   )r   s    r   valuezCallbackParam.value.   s     ##DNN$455r   c                    t        d      )Nz(Cannot set the value of a CallbackParam.)NotImplementedError)r   _vals     r   r   zCallbackParam.value4   s    !"LMMr   ) )r   r   r   zint | tuple[int, ...]returnNone)	__name__
__module____qualname____doc__r   propertyr   setter__classcell__)r   s   @r   r   r      s;    = 6 6
 \\N Nr   r   N)r   
__future__r   typingr   %cvxpy.expressions.constants.parameterr   r   r   r   r   <module>r&      s#    #  ;NI Nr   