a
    yn„fÐ  ã                
   @  s~   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 dl
mZ dZe	 ¡ Zeƒ dd	dddd
dddœdd„ƒZdd„ ZdS )é    )ÚannotationsN)Úhigh_level_function)ÚHighLevelContext)ÚNumpyMetadata)Úregularize_axis)ÚargcombinationsFé   T)ÚreplacementÚaxisÚfieldsÚ
parametersÚ	with_nameÚ	highlevelÚbehaviorÚattrsc          
      c  s"   | fV  t | |||||||||	ƒ
S )a²  
    Args:
        array: Array-like data (anything #ak.to_layout recognizes).
        n (int): The number of items to choose from each list: `2` chooses
            unique pairs, `3` chooses unique triples, etc.
        replacement (bool): If True, combinations that include the same
            item more than once are allowed; otherwise each item in a
            combinations is strictly unique.
        axis (int): The dimension at which this operation is applied. The
            outermost dimension is `0`, followed by `1`, etc., and negative
            values count backward from the innermost: `-1` is the innermost
            dimension, `-2` is the next level up, etc.
        fields (None or list of str): If None, the pairs/triples/etc. are
            tuples with unnamed fields; otherwise, these `fields` name the
            fields. The number of `fields` must be equal to `n`.
        parameters (None or dict): Parameters for the new
            #ak.contents.RecordArray node that is created by this operation.
        with_name (None or str): Assigns a `"__record__"` name to the new
            #ak.contents.RecordArray node that is created by this operation
            (overriding `parameters`, if necessary).
        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.

    Computes a Cartesian product (i.e. cross product) of `array` with itself
    that is restricted to combinations sampled without replacement,
    like #ak.combinations, but returning integer indexes for
    #ak.Array.__getitem__.

    The motivation and uses of this function are similar to those of
    #ak.argcartesian. See #ak.combinations and #ak.argcartesian for a more
    complete description.
    )Ú_impl)
ÚarrayÚnr	   r
   r   r   r   r   r   r   © r   úh/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/awkward/operations/ak_argcombinations.pyr      s    3ör   c
                 C  s°   t |ƒ}|d u ri }nt|ƒ}|d ur.||d< |dk r@tdƒ‚nlt||	d��*}
tj |
j| ddd�|¡}W d   ƒ n1 s|0    Y  tjj||||||d�}|
j	||d	�S d S )
NZ
__record__r   z3the 'axis' for argcombinations must be non-negative)r   r   FÚerror)Zallow_recordZprimitive_policy)r	   r
   r   r   )r   )
r   ÚdictÚ
ValueErrorr   ÚakZ_doZlocal_indexÚunwrapÚcombinationsÚwrap)r   r   r	   r
   r   r   r   r   r   r   ÚctxZlayoutÚoutr   r   r   r   T   s,    
þ"úr   )Ú
__future__r   Zawkwardr   Zawkward._dispatchr   Zawkward._layoutr   Zawkward._nplikes.numpy_liker   Zawkward._regularizer   Ú__all__ÚinstanceÚnpr   r   r   r   r   r   Ú<module>   s$   õC