B
    ãUvgÍ  ã               @   sŒ   d Z ddlmZ ddlZddlZddlmZ ddlmZ	 ddl
mZ erXddlmZmZ G dd	„ d	eƒZdadd
d„Zdd„ Zddd„ZdS )zN
A module that implements tooling to enable easy warnings about deprecations.
é    )Úabsolute_importN)Úparse)Ú__version__)ÚMYPY_CHECK_RUNNING)ÚAnyÚOptionalc               @   s   e Zd ZdS )ÚPipDeprecationWarningN)Ú__name__Ú
__module__Ú__qualname__© r   r   ú@/tmp/pip-install-r_9ig3yj/pip/pip/_internal/utils/deprecation.pyr      s   r   c             C   sZ   |d k	r$t d k	rVt | |||||ƒ n2t|tƒrDt d¡}| | ¡ nt | |||||ƒ d S )Nzpip._internal.deprecations)Ú_original_showwarningÚ
issubclassr   ÚloggingÚ	getLoggerÚwarning)ÚmessageÚcategoryÚfilenameÚlinenoÚfileÚlineÚloggerr   r   r   Ú_showwarning   s    

r   c               C   s(   t jdtdd� td kr$t jatt _d S )NÚdefaultT)Úappend)ÚwarningsÚsimplefilterr   r   Úshowwarningr   r   r   r   r   Úinstall_warning_logger+   s    r    c             C   st   d|  }|dk	r|d  |¡7 }|dk	r@dt|ƒ }|d  |¡7 }|dk	r`ttƒt|ƒkr`t|ƒ‚tj|tdd� dS )aÅ  Helper to deprecate existing functionality.

    reason:
        Textual reason shown to the user about why this functionality has
        been deprecated.
    replacement:
        Textual suggestion shown to the user about what alternative
        functionality they can use.
    gone_in:
        The version of pip does this functionality should get removed in.
        Raises errors if pip's current version is greater than or equal to
        this.
    issue:
        Issue number on the tracker that would serve as a useful place for
        users to find related discussion and provide feedback.

    Always pass replacement, gone_in and issue as keyword arguments for clarity
    at the call site.
    zDEPRECATION: Nz A possible replacement is {}.z#https://github.com/pypa/pip/issues/z. You can find discussion regarding this at {}.é   )r   Ú
stacklevel)ÚformatÚstrr   Úcurrent_versionr   r   Úwarn)ÚreasonÚreplacementÚgone_inÚissuer   Úurlr   r   r   Ú
deprecated6   s    r,   )NN)N)Ú__doc__Ú
__future__r   r   r   Zpip._vendor.packaging.versionr   Úpipr   r%   Úpip._internal.utils.typingr   Útypingr   r   ÚWarningr   r   r   r    r,   r   r   r   r   Ú<module>   s   
