U
    -e                     @   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 can not 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 krqt |dr.||j qt|ts>|jr|| q| jrb|t| j fdd|D }d	dd |D | _|| _| S )N_docstring_componentsc                    s2   g | ]*}t |tr*t d kr*|jf  n|qS )r   )
isinstancestrlenformat.0	component)params M/var/www/html/Darija-Ai-Train/env/lib/python3.8/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_componentsZ	docstringZparams_applied
docstringsr
   r   r   	decorator:   s.    


zdoc.<locals>.decoratorr   )r   r
   r   r   r   r   doc$   s    'r   c                    s"   t | || fdd}|S )Nc                     s   t   | |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__r1   r   r/   r   r   _DeprecatedMetar   s   r4   )r"   )r%   r0   r'   Zinstancecheckr4   r   r/   r   _deprecate_classm   s    	r5   c                 C   s*   zt |  W dS  tk
r$   Y dS X d S )NTF)iter	TypeError)objr   r   r   _is_iterable~   s
    r9   c                 C   s   t | tpt| dS )N
__fspath__)r   r   r   pathr   r   r   _is_path_like   s    r=   c                 C   sJ   t | trtj| S ztj|  W S  tk
r<   Y nX tddS )zA
    Convert *path* to a string or unicode path if possible.
    znot a path-like objectN)r   r   osr<   
expanduserr:   AttributeErrorr7   r;   r   r   r   _stringify_path   s    
rA   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>       zproduct.<locals>.<lambda>   )	functoolsreduce)seqr   r   r   product   s    rJ   c                 C   s   |sd}|t |  }nd}|}t| D ]V\}}|dkrBd }} q~|| }|dkrd|||d  7 }q&|dk r&|||d  7 }q&|| |t |  krt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   sZ   t  t jt j} t| 6} | d | t jt jd | 	 d W  5 Q R  S Q R X 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   sd   t d}t| }|rT|D ]} | |k	rt| tjr q<qqTd }|   t| }q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(   r5   r9   r=   rA   rJ   rT   r`   re   rn   r   r   r   r   <module>   s,   @
 
$