o
    $if"                     @   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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   E/var/www/html/corbot_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)	decorateddocstring_components	docstring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__r5   r   r3   r   r   _DeprecatedMetar   s    r8   )r&   )r)   r4   r+   instancecheckr8   r   r3   r   _deprecate_classm   s   	r:   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   rB   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   osrA   
expanduserr?   AttributeErrorr<   r@   r   r   r   _stringify_path   s   
rF   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   rN   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   rJ   zarray data is non-contiguous)rN   	enumerate
ValueError)shapestridesitemsizestartendidimstrider   r   r   get_contiguous_span   s&   rY   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   rJ   )
socketAF_INETSOCK_STREAM
contextlibclosingbind
setsockopt
SOL_SOCKETSO_REUSEADDRgetsockname)sockr   r   r   find_free_port   s   

$re   c                  C   s   ddl m}  |  jS )Nr   uuid4)uuidrg   hexrf   r   r   r   guid   s   rj   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gcget_referrersr   types	FrameTypeclear)frame
this_framerefsr   r   r   !_break_traceback_cycle_from_frame   s   


ru   c               	   C   sV  t jdkrtdt j ddl} tjd}tj|d}tj|dd dd	l	m
} |d
$}t|d}||  W d   n1 sGw   Y  W d   n1 sVw   Y  tj|scJ | || |d2}ttj|dd}||  W d   n1 sw   Y  W d   dS W d   dS 1 sw   Y  dS )z
    Download and extract latest IANA timezone database into the
    location expected by Arrow which is %USERPROFILE%\Downloads\tzdata.
    win32z)Timezone database is already provided by r   Nz%USERPROFILE%\Downloads\tzdataztzdata.tar.gzT)exist_ok)urlopenz5https://data.iana.org/time-zones/tzdata-latest.tar.gzwbz^https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xmlzwindowsZones.xml)rk   platformr<   tarfilerC   rA   
expandvarsr   makedirsurllib.requestrx   openwritereadexists
extractall)r{   tzdata_pathtzdata_compressedrx   responsefresponse_zonesr   r   r   download_tzdata_on_windows   s,   


"r   )T)rC   r]   rK   rm   rZ   rk   r   ro   r   r(   r   r0   r,   r:   r>   rB   rF   rN   rY   re   rj   ru   r   r   r   r   r   <module>   s0   @

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