a
    yn„f  ã                   @  s`   d dl mZ d dlmZ d dlmZ d dlmZ dZe 	¡ Z
eƒ ddddœd	d
„ƒZdd„ ZdS )é    )Úannotations)Úhigh_level_function)ÚHighLevelContext)ÚNumpyMetadata)Úwith_parameterTN)Ú	highlevelÚbehaviorÚattrsc                c  s   | fV  t | |||||ƒS )a  
    Args:
        array: Array-like data (anything #ak.to_layout recognizes).
        parameter (str): Name of the parameter to set on that array.
        value (JSON): Value of the parameter to set on that array.
        highlevel (bool): If True, return an #ak.Array; otherwise, return
            a low-level #ak.contents.Content subclass.
        behavior (None or dict): Custom #ak.behavior for the output array, if
            high-level.
        attrs (None or dict): Custom attributes for the output array, if
            high-level.

    This function returns a new array with a parameter set on the outermost
    node of its #ak.Array.layout.

    Note that a "new array" is a lightweight shallow copy, not a duplication
    of large data buffers.

    You can also remove a single parameter with this function, since setting
    a parameter to None is equivalent to removing it.
    )Ú_impl)ÚarrayÚ	parameterÚvaluer   r   r	   © r   úg/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/awkward/operations/ak_with_parameter.pyr      s    r   c           	      C  sV   t ||d�� }|j| ddd�}W d   ƒ n1 s20    Y  | ||¡}|j||d�S )N)r   r	   TÚerror)Zallow_recordZprimitive_policy)r   )r   Úunwrapr   Úwrap)	r   r   r   r   r   r	   ÚctxZlayoutÚoutr   r   r   r
   .   s    .r
   )Ú
__future__r   Zawkward._dispatchr   Zawkward._layoutr   Zawkward._nplikes.numpy_liker   Ú__all__ÚinstanceÚnpr   r
   r   r   r   r   Ú<module>   s   ÿ