o
    ~îj“  ã                   @  sþ   U d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ ddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZ dZG dd„ deƒZdaded< edejd�Ze	d7dd„ƒZ		d8d9d%d&„Z d:d'd(„Z!ddd)d*d+œd;d5d6„Z"dS )<zN
A module that implements tooling to enable easy warnings about deprecations.
é    )ÚannotationsN)Ú	Generator)Úcontextmanager)Ú
ContextVar)ÚAnyÚTextIO)Úparse)ÚBuildBackendWarning)ÚText)Ú__version__zDEPRECATION: c                   @  s   e Zd ZU dZded< dS )ÚPipDeprecationWarningFÚboolÚinclude_sourceN)Ú__name__Ú
__module__Ú__qualname__r   Ú__annotations__© r   r   úi/raid/bulk_storage/M2HATS/real-image-venv/lib/python3.10/site-packages/pip/_internal/utils/deprecation.pyr      s   
 r   r   Ú_original_showwarningÚbuild_backend_warning_level)ÚdefaultÚlevelÚintÚreturnúGenerator[None, None, None]c              	   c  s0   � t  | ¡}zdV  W t  |¡ dS t  |¡ w )z@Set the logging level for warnings from this build backend call.N)Ú_build_backend_warning_levelÚsetÚreset)r   Útokenr   r   r   Úbuild_backend_warnings"   s
   €
r    ÚmessageúWarning | strÚcategoryútype[Warning]ÚfilenameÚstrÚlinenoÚfileúTextIO | NoneÚlineú
str | NoneÚNonec                 C  sÒ   |d urt d urt | |||||ƒ d S d S t|tƒr8t d¡}t| tƒr1| jr1| d| ||¡ d S | | ¡ d S t|tƒr^t d¡}t	 
| ||||¡}|jt ¡ dt| ¡ ƒddid� d S t | |||||ƒ d S )Nzpip._internal.deprecationsz
%s (%s:%s)zpip._internal.build_backendz%sÚrichT)Úextra)r   Ú
issubclassr   ÚloggingÚ	getLoggerÚ
isinstancer   Úwarningr	   ÚwarningsÚformatwarningÚlogr   Úgetr
   Úrstrip)r!   r#   r%   r'   r(   r*   ÚloggerÚ	formattedr   r   r   Ú_showwarning-   s&   ÿ





ür;   c                   C  sH   t j dd ¡rt dt¡ ntjdtdd� td u r"tjatt_d S d S )NÚ_PIP_TEST_ENVÚerrorr   T)Úappend)	ÚosÚenvironr7   r4   Úsimplefilterr   r   Úshowwarningr;   r   r   r   r   Úinstall_warning_loggerM   s   
þrC   é   F)Úfeature_flagÚissueÚ
stacklevelr   ÚreasonÚreplacementÚgone_inrE   rF   ú
int | NonerG   r   r   c                 C  s�   |duot tƒt |ƒk}| t› d�f||sdndf|df||s!dndf|dfg}d d	d
„ |D ƒ¡}	|r8t|	ƒ‚t|	ƒ}
||
_tj|
|d� dS )a2  Helper to deprecate existing functionality.

    reason:
        Textual reason shown to the user about why this functionality has
        been deprecated. Should be a complete sentence.
    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 an error if pip's current version is greater than or equal to
        this.
    feature_flag:
        Command-line flag of the form --use-feature={feature_flag} for testing
        upcoming functionality.
    issue:
        Issue number on the tracker that would serve as a useful place for
        users to find related discussion and provide feedback.
    stacklevel:
        How many frames up the call stack to attribute the warning to.
        Defaults to 2 (the caller of deprecated()).
    include_source:
        If True, include the source filename and line number in the warning
        output. Useful when the warning originates from external code.
    Nz{}z*pip {} will enforce this behaviour change.z*Since pip {}, this is no longer supported.zA possible replacement is {}.zEYou can use the flag --use-feature={} to test the upcoming behaviour.z@Discussion can be found at https://github.com/pypa/pip/issues/{}ú c                 s  s.   � | ]\}}|d ur|d ur|  |¡V  qd S )N)Úformat)Ú.0ÚvalueÚ
format_strr   r   r   Ú	<genexpr>Ÿ   s   € þýzdeprecated.<locals>.<genexpr>)rG   )r   Úcurrent_versionÚDEPRECATION_MSG_PREFIXÚjoinr   r   r4   Úwarn)rH   rI   rJ   rE   rF   rG   r   Úis_goneÚmessage_partsr!   r3   r   r   r   Ú
deprecated\   s6   %ÿû	þÿû	þê
þrX   )r   r   r   r   )NN)r!   r"   r#   r$   r%   r&   r'   r   r(   r)   r*   r+   r   r,   )r   r,   )rH   r&   rI   r+   rJ   r+   rE   r+   rF   rK   rG   r   r   r   r   r,   )#Ú__doc__Ú
__future__r   r0   r?   r4   Úcollections.abcr   Ú
contextlibr   Úcontextvarsr   Útypingr   r   Úpip._vendor.packaging.versionr   Úpip._vendor.pyproject_hooksr	   Úpip._vendor.rich.textr
   Úpipr   rR   rS   ÚWarningr   r   r   ÚDEBUGr   r    r;   rC   rX   r   r   r   r   Ú<module>   s<    ÿú
 ø