a
    yn„fa  ã                   @  sX   d dl mZ d dlZd dlmZ d dlmZ dZedd�dddd	œd
d„ƒZ	dd„ Z
dS )é    )ÚannotationsN)Úhigh_level_function)ÚHighLevelContext)Úreversezak.str)ÚmoduleT)Ú	highlevelÚbehaviorÚattrsc                c  s   | fV  t | |||ƒS )a’  
    Args:
        array: Array-like data (anything #ak.to_layout recognizes).
        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.

    Reverses the order of Unicode characters in any string-valued data.
    (This function operates on Unicode codepoints, not grapheme clusters.
    Hence, it will not correctly reverse grapheme clusters composed of
    multiple codepoints.)

    Reverses the order of bytes in any bytestring-valued data.

    Note: this function does not raise an error if the `array` does not
    contain any string or bytestring data.

    Requires the pyarrow library and calls
    [pyarrow.compute.utf8_reverse](https://arrow.apache.org/docs/python/generated/pyarrow.compute.utf8_reverse.html)
    or
    [pyarrow.compute.binary_reverse](https://arrow.apache.org/docs/python/generated/pyarrow.compute.binary_reverse.html)
    on strings and bytestrings, respectively.
    )Ú_impl)Úarrayr   r   r	   © r   úg/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/awkward/operations/str/akstr_reverse.pyr      s    r   c           	      C  sz   ddl m} |dƒ}t||d��}| | ¡}W d   ƒ n1 s@0    Y  tj |tjjj	|j
|jdd�¡}|j||d�S )Nr   )Úimport_pyarrow_computeÚe)r   r	   F)Zbytestring_to_string)r   )Zawkward._connect.pyarrowr   r   ÚunwrapÚakZ_doZrecursively_applyÚ
operationsÚstrZ_get_ufunc_actionZutf8_reverseZbinary_reverseÚwrap)	r   r   r   r	   r   ZpcÚctxZlayoutÚoutr   r   r   r
   /   s    (
ÿþr
   )Ú
__future__r   Zawkwardr   Zawkward._dispatchr   Zawkward._layoutr   Ú__all__r   r
   r   r   r   r   Ú<module>   s   "