ó
Ð²Ebc           @@  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 r} d d l m Z m Z n  d Z d	 e f d
 „  ƒ  YZ d a d d d „ Z d „  Z d d „ Z d S(   sN   
A module that implements tooling to enable easy warnings about deprecations.
i    (   t   absolute_importN(   t   parse(   t   __version__(   t   MYPY_CHECK_RUNNING(   t   Anyt   Optionals   DEPRECATION: t   PipDeprecationWarningc           B@  s   e  Z RS(    (   t   __name__t
   __module__(    (    (    s<   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/deprecation.pyR      s   c         C@  s‚   | d  k	 r7 t d  k	 r~ t |  | | | | | ƒ q~ nG t | t ƒ re t j d ƒ } | j |  ƒ n t |  | | | | | ƒ d  S(   Ns   pip._internal.deprecations(   t   Nonet   _original_showwarningt
   issubclassR   t   loggingt	   getLoggert   warning(   t   messaget   categoryt   filenamet   linenot   filet   linet   logger(    (    s<   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/deprecation.pyt   _showwarning!   s    c           C@  s;   t  j d t d t ƒt d  k r7 t  j a t t  _ n  d  S(   Nt   defaultt   append(   t   warningst   simplefilterR   t   TrueR
   R	   t   showwarningR   (    (    (    s<   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/deprecation.pyt   install_warning_logger2   s    	c         C@  s—   |  t  d f | d f | d f | d f g } d j d „  | Dƒ ƒ } | d
 k	 rz t t ƒ t | ƒ k rz t | ƒ ‚ n  t j | d t d d	 ƒd
 S(   sÅ  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.
    s   {}s2   pip {} will remove support for this functionality.s   A possible replacement is {}.sP   You can find discussion regarding this at https://github.com/pypa/pip/issues/{}.t    c         s@  s0   |  ]& \ } } | d  k	 r | j | ƒ Vq d  S(   N(   R	   t   format(   t   .0t   valt   template(    (    s<   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/deprecation.pys	   <genexpr>a   s    R   t
   stackleveli   N(   t   DEPRECATION_MSG_PREFIXt   joinR	   R   t   current_versionR   R   t   warn(   t   reasont   replacementt   gone_int   issuet	   sentencesR   (    (    s<   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/deprecation.pyt
   deprecated>   s    		$(   t   __doc__t
   __future__R    R   R   t   pip._vendor.packaging.versionR   t   pipR   R&   t   pip._internal.utils.typingR   t   typingR   R   R$   t   WarningR   R	   R
   R   R   R-   (    (    (    s<   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/deprecation.pyt   <module>   s   	