a
    yn„f,	  ã                   @  sh   d dl mZ d dl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 )é    )ÚannotationsN)Úhigh_level_function)ÚHighLevelContext)ÚNumpyMetadata)Ú	with_nameT)Ú	highlevelÚbehaviorÚattrsc                c  s   | fV  t | ||||ƒS )ab  
    Args:
        array: Array-like data (anything #ak.to_layout recognizes).
        name (str or None): Name to give to the records or tuples; this assigns
            the `"__record__"` parameter. If None, any existing name is unset.
        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.

    Returns an #ak.Array or #ak.Record (or low-level equivalent, if
    `highlevel=False`) with a new name. This function does not change the
    array in-place. If the new name is None, then an array without a name is
    returned.

    The records or tuples may be nested within multiple levels of nested lists.
    If records are nested within records, only the outermost are affected.

    Setting the `"__record__"` parameter makes it possible to add behaviors
    to the data; see #ak.Array and #ak.behavior for a more complete
    description.
    )Ú_impl)ÚarrayÚnamer   r   r	   © r   úb/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/awkward/operations/ak_with_name.pyr      s    r   c           	        sd   t ||d�� }|j| ddd�}W d   ƒ n1 s20    Y  ‡ fdd„}tj ||¡}|j||d�S )N)r   r	   TÚerror)Zallow_recordZprimitive_policyc                   s>   t | tjjƒr6tjj| j| j| ji | j¥dˆ i¥d�S d S d S )NZ
__record__)Ú
parameters)Ú
isinstanceÚakÚcontentsZRecordArrayZ	_contentsÚ_fieldsÚ_lengthr   )ÚlayoutÚignore©r   r   r   Úaction4   s    üz_impl.<locals>.action)r   )r   Úunwrapr   Z_doZrecursively_applyÚwrap)	r   r   r   r   r	   Úctxr   r   Úoutr   r   r   r
   0   s
    .r
   )Ú
__future__r   Zawkwardr   Zawkward._dispatchr   Zawkward._layoutr   Zawkward._nplikes.numpy_liker   Ú__all__ÚinstanceÚnpr   r
   r   r   r   r   Ú<module>   s    