HEX
Server: Apache
System: Linux infong-uk86 4.4.400-icpu-106 #2 SMP Mon Sep 15 08:23:40 UTC 2025 x86_64
User: u44115835 (4976590)
PHP: 8.4.17
Disabled: NONE
Upload Files
File: //kunden/lib/python3/dist-packages/breezy/__pycache__/symbol_versioning.cpython-39.pyc
a

�*�^�6�@s�dZddlmZgd�ZddlZddlmaddlZdZdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�Zdd�Zdd�ZGdd�de�Zd&dd�Zdd�Zdd �Zd'd"d#�Zd(d$d%�ZdS))zESymbol versioning

The methods here allow for api symbol versioning.
�)�absolute_import)�deprecated_function�
deprecated_in�deprecated_list�deprecated_method�DEPRECATED_PARAMETER�deprecated_passed�set_warning_method�warnN�r
zA deprecated parameter marker.cCsdt�|�S)z�Generate a message that something was deprecated in a release.

    >>> deprecated_in((1, 4, 0))
    '%s was deprecated in version 1.4.0.'
    z!%%s was deprecated in version %s.)�breezyZ_format_version_tuple)Z
version_tuple�r
�:/usr/lib/python3/dist-packages/breezy/symbol_versioning.pyr-s�rcCs|adS)z�Set the warning method to be used by this module.

    It should take a message and a warning category as warnings.warn does.
    Nr)�methodr
r
rr	7sr	cCsrt|dd�dur.d|jjj|jjj|jf}n<t|dd�durZd|jvrZd|j|jf}nd|j|jf}||S)aoGenerate an automatic deprecation string for a_callable.

    :param a_callable: The callable to substitute into deprecation_version.
    :param deprecation_version: A deprecation format warning string. This
        should have a single %s operator in it. a_callable will be turned into
        a nice python symbol and then substituted into deprecation_version.
    �__self__N�%s.%s.%s�__qualname__�<�%s.%s)�getattrr�	__class__�
__module__�__name__r)Z
a_callable�deprecation_version�symbolr
r
r�deprecation_stringFs
���rcs�fdd�}|S)z=Decorate a function so that use of it will trigger a warning.cs ��fdd�}t��d|�|S)�<This is the function python calls to perform the decoration.cs:ddlm}|�dd�tt���tdd��|i|��S)zThis is the decorated function.���trace�zDeprecated function called���
stacklevel)�r�mutter_callsiter
r�DeprecationWarning)�args�kwargsr��callablerr
r�decorated_functionas
�zKdeprecated_function.<locals>.function_decorator.<locals>.decorated_functionZfunction��_populate_decorated)r*r+�r�r*r�function_decorator^s
�z/deprecated_function.<locals>.function_decoratorr
)rr0r
r.rr[s
rcs�fdd�}|S)z�Decorate a method so that use of it will trigger a warning.

    To deprecate a static or class method, use

        @staticmethod
        @deprecated_function
        def ...

    To deprecate an entire class, decorate __init__.
    cs ��fdd�}t��d|�|S)rcsxddlm}�jdkr,d|jj|jjf}nd|jj|jj�jf}|�dd�t�|tdd	��|g|�Ri|��S)
zThis is the decorated method.rr�__init__rrr zDeprecated method calledr!r")r$rrrrr%r
r&)�selfr'r(rrr)r
r�decorated_method}s 
����zEdeprecated_method.<locals>.method_decorator.<locals>.decorated_methodrr,)r*r3r.r/r�method_decoratorzs
�z+deprecated_method.<locals>.method_decoratorr
)rr4r
r.rrnsrcCs|tuS)z(Return True if parameter_value was used.)r)Zparameter_valuer
r
rr�srcCs�|jr|j�d�}ng}t|�dkr4|d||_nvt|�dkrb|jdd|d|d|_nHt|d�}|j}|dd|7}||d|7}|dd|7}||_dS)N�
rzThis r���� )�__doc__�split�len)r*r�label�decorated_callableZdocstring_lines�spacesZnew_docr
r
r�_decorate_docstring�s$
���r>cCs(t||||�|j|_|j|_d|_dS)zMPopulate attributes like __name__ and __doc__ on the decorated callable.
    TN)r>rr�
is_deprecated)r*rr;r<r
r
rr-�s�r-cs�fdd�}|S)z?Returns a closure that emits a warning and calls the superclasscsPd|jf}|j|f}|jr,|d|j7}t|tdd��|g|�Ri|��S)Nzaccess to %sr7r!r")�_variable_name�_deprecation_version�_advicer
r&)Zdep_dictr'r(�msg��wrapped_methodr
r�cb�sz%_dict_deprecation_wrapper.<locals>.cbr
)rErFr
rDr�_dict_deprecation_wrapper�srGc@sXeZdZdZdZdd�Zeej�Zeej	�Z	eej
�Z
eej�Zeej�Zeej
�Z
dS)�DeprecatedDictz1A dictionary that complains when read or written.TcCs"||_||_||_t�||�dS)a�Create a dict that warns when read or modified.

        :param deprecation_version: string for the warning format to raise,
            typically from deprecated_in()
        :param initial_value: The contents of the dict
        :param variable_name: This allows better warnings to be printed
        :param advice: String of advice on what callers should do instead
            of using this variable.
        N)rAr@rB�dictr1)r2r�
variable_name�
initial_valueZadvicer
r
rr1�szDeprecatedDict.__init__N)rrrr8r?r1rGrI�__len__�__getitem__�__setitem__�__delitem__�keys�__contains__r
r
r
rrH�s




rHcsBd�f}||f�|r$�d|7�G��fdd�dt�}||�S)aPCreate a list that warns when modified

    :param deprecation_version: string for the warning format to raise,
        typically from deprecated_in()
    :param initial_value: The contents of the list
    :param variable_name: This allows better warnings to be printed
    :param extra: Extra info to print when printing a warning
    zModifying %sr7csdeZdZej�ZdZ�fdd�Z�fdd�Z�fdd�Z�fdd	�Z	�fd
d�Z
d�fd
d�	ZdS)z(deprecated_list.<locals>._DeprecatedListTcs$t�tdd�||g|�Ri|��S)N�r")r
r&)r2�funcr'r()rCr
r�_warn_deprecated
sz9deprecated_list.<locals>._DeprecatedList._warn_deprecatedcsd�f|�tj|�S)Nzappending to %s is deprecated)rT�list�append)r2�obj�rJr
rrVs
z/deprecated_list.<locals>._DeprecatedList.appendcsd�f|�tj||�S)Nzinserting to %s is deprecated)rTrU�insert)r2�indexrWrXr
rrYs
z/deprecated_list.<locals>._DeprecatedList.insertcsd�f|�tj|�S)Nzextending %s is deprecated)rTrU�extend)r2�iterablerXr
rr[s
z/deprecated_list.<locals>._DeprecatedList.extendcsd�f|�tj|�S)Nzremoving from %s is deprecated)rTrU�remove)r2�valuerXr
rr]s
z/deprecated_list.<locals>._DeprecatedList.removeNcs,d�f|r|�tj|�S|�tj�SdS)Nzpop'ing from %s is deprecated)rTrU�pop)r2rZrXr
rr_s
z,deprecated_list.<locals>._DeprecatedList.pop)N)rrrrUr8r?rTrVrYr[r]r_r
�rCrJr
r�_DeprecatedLists
ra)rU)rrJrKZextraZ
subst_textrar
r`rr�s

!rcCs4tjD](}tt|d�r|r(|ddkrdSqdS)z�Check if there is already a filter for deprecation warnings.

    :param error_only: Only match an 'error' filter
    :return: True if a filter is found, False otherwise
    r!r�errorTF)�warnings�filters�
issubclassr&)�
error_only�filterr
r
r�_check_for_filter)s

rhcs�fdd�}|S)z�Build and returns a callable removing filter from the warnings.

    :param filter: The filter to remove (can be None).

    :return: A callable that will remove filter from warnings.filters.
    c	s0�r,ztj���Wnttfy*Yn0dS)N)rcrdr]�
ValueError�
IndexErrorr
�rgr
r�cleanup>s
z(_remove_filter_callable.<locals>.cleanupr
)rgrlr
rkr�_remove_filter_callable7srmTcCs4|stdd�rd}ntjdtd�tjd}t|�S)a�Call this function to suppress all deprecation warnings.

    When this is a final release version, we don't want to annoy users with
    lots of deprecation warnings. We only want the deprecation warnings when
    running a dev or release candidate.

    :param override: If True, always set the ignore, if False, only set the
        ignore if there isn't already a filter.

    :return: A callable to remove the new warnings this added.
    F�rfN�ignore��categoryr�rhrc�filterwarningsr&rdrm��overridergr
r
r�suppress_deprecation_warningsGs

rvcCs4|stdd�rd}ntjdtd�tjd}t|�S)a�Call this function to activate deprecation warnings.

    When running in a 'final' release we suppress deprecation warnings.
    However, the test suite wants to see them. So when running selftest, we
    re-enable the deprecation warnings.

    Note: warnings that have already been issued under 'ignore' will not be
    reported after this point. The 'warnings' module has already marked them as
    handled, so they don't get issued again.

    :param override: If False, only add a filter if there isn't an error filter
        already. (This slightly differs from suppress_deprecation_warnings, in
        because it always overrides everything but -Werror).

    :return: A callable to remove the new warnings this added.
    TrnN�defaultrprrrrtr
r
r�activate_deprecation_warnings]s

rx)N)T)T)r8Z
__future__r�__all__rcr
rrrr	rrrrr>r-rGrIrHrrhrmrvrxr
r
r
r�<module>s,
%$�
4