o
    Zh                     @   s   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZdZ	dd Z
efddZ	ddd	Zd
d Zdd Zdd Zdd Zdd Zdd Zdd Zdd ZdS )    NzApyarrow.{} is deprecated as of {}, please use pyarrow.{} instead.c                     s    fdd}|S )a  
    A decorator that takes docstring templates, concatenates them, and finally
    performs string substitution on them.
    This decorator will add a variable "_docstring_components" to the wrapped
    callable to keep track of the original docstring template for potential future use.
    If the docstring is a template, it will be saved as a string.
    Otherwise, it will be saved as a callable and the docstring will be obtained via
    the __doc__ attribute.
    This decorator cannot be used on Cython classes due to a CPython constraint,
    which enforces the __doc__ attribute to be read-only.
    See https://github.com/python/cpython/issues/91309

    Parameters
    ----------
    *docstrings : None, str, or callable
        The string / docstring / docstring template to be prepended in order
        before the default docstring under the callable.
    **params
        The key/value pairs used to format the docstring template.
    c                    s   g } D ] }|d u rqt |dr||j qt|ts|jr$|| q| jr1|t| j fdd|D }d	dd |D | _|| _| S )N_docstring_componentsc                    s6   g | ]}t |trt d kr|jdi  n|qS )r    )
isinstancestrlenformat.0	component)paramsr   C/var/www/html/lang_env/lib/python3.10/site-packages/pyarrow/util.py
<listcomp>L   s    z*doc.<locals>.decorator.<locals>.<listcomp> c                 S   s*   g | ]}t |tr|nt|jpd qS )r   )r   r   textwrapdedent__doc__r   r   r   r   r   T   s    )
hasattrextendr   r   r   r   appendr   r   join)Z	decoratedZdocstring_components	docstringZparams_applied
docstringsr   r   r   	decorator:   s0   



zdoc.<locals>.decoratorr   )r   r   r   r   r   r   doc$   s   'r   c                    s"   t | || fdd}|S )Nc                     s   t   | i |S N)warningswarn)argskwargsapimsgtyper   r   wrapperg   s   z_deprecate_api.<locals>.wrapper)	_DEPR_MSGr   )old_namenew_namer!   next_versionr#   r$   r   r    r   _deprecate_apid   s   r)   Tc                    s&   G  fdddt }| fi S )zM
    Raise warning if a deprecated class is used in an isinstance check.
    c                       s   e Zd Z fddZdS )z)_deprecate_class.<locals>._DeprecatedMetac                    s&   t jt jtdd t| S )N   )
stacklevel)r   r   r%   r   __name__FutureWarningr   )selfother	new_classr(   r&   r   r   __instancecheck__s   s   
z;_deprecate_class.<locals>._DeprecatedMeta.__instancecheck__N)r,   
__module____qualname__r2   r   r0   r   r   _DeprecatedMetar   s    r5   )r#   )r&   r1   r(   Zinstancecheckr5   r   r0   r   _deprecate_classm   s   	r6   c                 C   s$   zt |  W dS  ty   Y dS w )NTF)iter	TypeError)objr   r   r   _is_iterable~   s   r:   c                 C   s   t | tp	t| dS )N
__fspath__)r   r   r   pathr   r   r   _is_path_like   s   r>   c                 C   sB   t | trtj| S z	tj|  W S  ty    Y tdw )zA
    Convert *path* to a string or unicode path if possible.
    znot a path-like object)r   r   osr=   
expanduserr;   AttributeErrorr8   r<   r   r   r   _stringify_path   s   
rB   c                 C   s   t dd | dS )z-
    Return a product of sequence items.
    c                 S   s   | | S r   r   )abr   r   r   <lambda>   s    zproduct.<locals>.<lambda>   )	functoolsreduce)seqr   r   r   product   s   rJ   c                 C   s   |sd}|t |  }||fS d}|}t| D ]+\}}|dkr$d }} n|| }|dkr5|||d  7 }q|dk rA|||d  7 }q|| |t |  krPtd||fS )z
    Return a contiguous span of N-D array data.

    Parameters
    ----------
    shape : tuple
    strides : tuple
    itemsize : int
      Specify array shape data

    Returns
    -------
    start, end : int
      The span end points.
    r   rF   zarray data is non-contiguous)rJ   	enumerate
ValueError)shapestridesitemsizestartendidimZstrider   r   r   get_contiguous_span   s&   rT   c                  C   sf   t  t jt j} t| } | d | t jt jd | 	 d W  d    S 1 s,w   Y  d S )N)r   r   rF   )
socketAF_INETSOCK_STREAM
contextlibclosingbind
setsockopt
SOL_SOCKETSO_REUSEADDRgetsockname)sockr   r   r   find_free_port   s   

$r`   c                  C   s   ddl m}  |  jS )Nr   uuid4)uuidrb   hexra   r   r   r   guid   s   re   c                 C   sf   t d}t| }|r+|D ]} | |urt| tjr nqnd }|   t| }|sd  } } }d S )Nr   )sys	_getframegcZget_referrersr   types	FrameTypeclear)frameZ
this_framerefsr   r   r   !_break_traceback_cycle_from_frame   s   


rn   )T)r?   rX   rG   rh   rU   rf   r   ri   r   r%   r   r-   r)   r6   r:   r>   rB   rJ   rT   r`   re   rn   r   r   r   r   <module>   s.   @

$