a
    xdT                     @   s   d dl Z d dlmZ d dlmZ d dlZd dlZG dd deZdd Z	dd	 Z
d
dddZddddZdd ZejddG dd dZG dd deZdd ZdS )    N)wraps)
ModuleTypec                   @   s   e Zd ZdZdS )TrioDeprecationWarninga  Warning emitted if you use deprecated Trio functionality.

    As a young project, Trio is currently quite aggressive about deprecating
    and/or removing functionality that we realize was a bad idea. If you use
    Trio, you should subscribe to `issue #1
    <https://github.com/python-trio/trio/issues/1>`__ to get information about
    upcoming deprecations and other backwards compatibility breaking changes.

    Despite the name, this class currently inherits from
    :class:`FutureWarning`, not :class:`DeprecationWarning`, because while
    we're in young-and-aggressive mode we want these warnings to be visible by
    default. You can hide them by installing a filter or with the ``-W``
    switch: see the :mod:`warnings` documentation for details.

    N)__name__
__module____qualname____doc__ r	   r	   G/var/www/html/Ranjet/env/lib/python3.9/site-packages/trio/_deprecate.pyr      s   r   c                 C   s
   d | S )Nz-https://github.com/python-trio/trio/issues/{})format)issuer	   r	   r
   _url_for_issue    s    r   c                 C   s,   t | dr$t | dr$d| j| jS t| S )Nr   r   {}.{})hasattrr   r   r   strthingr	   r	   r
   
_stringify$   s    r      
stacklevelc                C   sl   |d7 }d t| |}|d u r*|d7 }n|d t|7 }|d urV|d t|7 }tjt||d d S )N   z{} is deprecated since Trio {}z with no replacementz; use {} insteadz ({})r   )r   r   r   warningswarnr   )r   versionr   insteadr   msgr	   r	   r
   warn_deprecated*   s    
r   r   c                   s    fdd}|S )Nc                    s   t   fdd}d u r(||jd ur|j}| }|d7 }|d7 }d urp|dt7 }d ur|dt7 }|d7 }||_|S )Nc                     s   t d  | i |S )N)r   r   )r   argskwargs)fnr   r   r   r   r	   r
   wrapper<   s    z,deprecated.<locals>.do_wrap.<locals>.wrapperz

z.. deprecated:: {}
z   Use {} instead.
z(   For details, see `issue #{} <{}>`__.

)r   r   rstripr   r   r   )r!   r"   docr   r   r   r   )r!   r
   do_wrap9   s$    
zdeprecated.<locals>.do_wrapr	   )r   r   r   r   r'   r	   r&   r
   
deprecated8   s    r(   c                   s@   t || dt dd fdd}| |_| dd |_|S )Nr   r   )r   __annotations__)assignedc                     s    | i |S )zDeprecated alias.r	   r   new_fnr	   r
   r"   [   s    z!deprecated_alias.<locals>.wrapper.)r(   r   r   
rpartitionr   )Zold_qualnamer-   r   r   r"   r	   r,   r
   deprecated_aliasZ   s    
r1   T)frozenc                   @   s6   e Zd Ze Ze Ze Ze Z	ejedZ
dS )DeprecatedAttribute)defaultN)r   r   r   object_not_setattribvaluer   r   r   r	   r	   r	   r
   r3   f   s
   r3   c                   @   s   e Zd Zdd ZdS )_ModuleWithDeprecationsc                 C   sl   || j v rR| j | }|j}|tju r*|j}d| j|}t||j|j	|d |jS d}t
|| j|d S )Nr   r)   z!module '{}' has no attribute '{}')__deprecated_attributes__r   r3   r6   r9   r   r   r   r   r   AttributeError)selfnameinfor   r   r   r	   r	   r
   __getattr__q   s    


z#_ModuleWithDeprecations.__getattr__N)r   r   r   r@   r	   r	   r	   r
   r:   p   s   r:   c                 C   s   t j|  }t|_i |_d S )N)sysmodulesr:   	__class__r;   )module_namemoduler	   r	   r
   enable_attribute_deprecations   s    
rF   )rA   	functoolsr   typesr   r   r7   FutureWarningr   r   r   r   r(   r1   sr3   r:   rF   r	   r	   r	   r
   <module>   s   "
	