o
    Éôj"  ã                   @   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   ú_/var/www/html/academy/tools/voices/clone/cosy-venv/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)Ú	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__r3   r   r1   r   r   Ú_DeprecatedMetar   s    r6   )r$   )r'   r2   r)   Zinstancecheckr6   r   r1   r   Ú_deprecate_classm   s   	r7   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<   ÚAttributeErrorr9   r=   r   r   r   Ú_stringify_pathŠ   s   
ýrC   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   rK   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   rG   zarray data is non-contiguous)rK   Ú	enumerateÚ
ValueError)ÚshapeÚstridesÚitemsizeÚstartÚendÚiÚdimÚstrider   r   r   Úget_contiguous_span¡   s&   ó€rV   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   rG   )
ÚsocketÚAF_INETÚSOCK_STREAMÚ
contextlibÚclosingÚbindÚ
setsockoptÚ
SOL_SOCKETÚSO_REUSEADDRÚgetsockname)Úsockr   r   r   Úfind_free_portÅ   s   

$ýrb   c                  C   s   ddl m}  | ƒ jS )Nr   ©Úuuid4)Úuuidrd   Úhexrc   r   r   r   ÚguidÍ   s   rg   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)ÚframeZ
this_frameÚrefsr   r   r   Ú!_break_traceback_cycle_from_frameÒ   s   

€
òrq   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 sŒw   Y  W d  ƒ dS W d  ƒ dS 1 s¤w   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)rh   Úplatformr9   Útarfiler@   r>   Ú
expandvarsr   ÚmakedirsÚurllib.requestrt   ÚopenÚwriteÚreadÚexistsÚ
extractall)rw   Ztzdata_pathZtzdata_compressedrt   ÚresponseÚfZresponse_zonesr   r   r   Údownload_tzdata_on_windowsé   s,   

ÿ€ÿ
ÿÿ"ÿr‚   )T)r@   rZ   rH   rj   rW   rh   r   rl   r   r&   r   r.   r*   r7   r;   r?   rC   rK   rV   rb   rg   rq   r‚   r   r   r   r   Ú<module>   s0   ÿ@

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