o
    Óó·i­o  ã                   @  s   d Z ddlmZ g d¢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mZmZmZmZ dd	lmamZ dd
lmZmZ ddlmZ edƒZedƒZdZdd„ Zde_de_ de_!dd„ Z"dFdd„Z#dGdd„Z$dGdd„Z%dd„ Z&	dFdHd#d$„Z'	dFdHd%d&„Z(d'd(„ Z)d)d*„ Z*G d+d,„ d,ƒZ+G d-d.„ d.ƒZ,G d/d0„ d0ƒZ-d1d2„ Z.d3d4„ Z/d5d6„ Z0d7d8„ Z1d9d:„ Z2d;d<„ Z3ed=ed>ef d?�Z4	dFdIdDdE„Z5dS )JaÄ  
Deprecation framework for Twisted.

To mark a method, function, or class as being deprecated do this::

    from incremental import Version
    from twisted.python.deprecate import deprecated

    @deprecated(Version("Twisted", 22, 10, 0))
    def badAPI(self, first, second):
        '''
        Docstring for badAPI.
        '''
        ...

    @deprecated(Version("Twisted", 22, 10, 0))
    class BadClass:
        '''
        Docstring for BadClass.
        '''

The newly-decorated badAPI will issue a warning when called, and BadClass will
issue a warning when instantiated. Both will also have  a deprecation notice
appended to their docstring.

To deprecate properties you can use::

    from incremental import Version
    from twisted.python.deprecate import deprecatedProperty

    class OtherwiseUndeprecatedClass:

        @deprecatedProperty(Version("Twisted", 22, 10, 0))
        def badProperty(self):
            '''
            Docstring for badProperty.
            '''

        @badProperty.setter
        def badProperty(self, value):
            '''
            Setter sill also raise the deprecation warning.
            '''


While it's best to avoid this as it adds performance overhead to *any* usage of
the module, to mark module-level attributes as being deprecated you can use::

    badAttribute = "someValue"

    ...

    deprecatedModuleAttribute(
        Version("Twisted", 22, 10, 0),
        "Use goodAttribute instead.",
        "your.full.module.name",
        "badAttribute")

The deprecated attributes will issue a warning whenever they are accessed. If
the attributes being deprecated are in the same module as the
L{deprecatedModuleAttribute} call is being made from, the C{__name__} global
can be used as the C{moduleName} parameter.


To mark an optional, keyword parameter of a function or method as deprecated
without deprecating the function itself, you can use::

    @deprecatedKeywordParameter(Version("Twisted", 22, 10, 0), "baz")
    def someFunction(foo, bar=0, baz=None):
        ...

See also L{incremental.Version}.

@type DEPRECATION_WARNING_FORMAT: C{str}
@var DEPRECATION_WARNING_FORMAT: The default deprecation warning string format
    to use when one is not provided by the user.
é    )Úannotations)Ú
deprecatedÚdeprecatedPropertyÚgetDeprecationWarningStringÚgetWarningMethodÚsetWarningMethodÚdeprecatedModuleAttributeÚdeprecatedKeywordParameterN)Úfindlinestarts©Úwraps)Ú
ModuleType)ÚAnyÚCallableÚDictÚOptionalÚTypeVarÚcast)ÚwarnÚwarn_explicit)ÚVersionÚgetVersionString)Ú	ParamSpecÚ_PÚ_Rz&%(fqpn)s was deprecated in %(version)sc                 C  sl   z| j }W n ty   | j}Y nw t | ¡st | ¡r&| j}|› d|› �S t | ¡r4| j› d| j › �S |S )z¼
    Return the fully qualified name of a module, class, method or function.
    Classes and functions need to be module level ones to be correctly
    qualified.

    @rtype: C{str}.
    Ú.N)Ú__qualname__ÚAttributeErrorÚ__name__ÚinspectÚisclassÚ
isfunctionÚ
__module__Úismethod)ÚobjÚnameÚ
moduleName© r'   ú^C:\Users\psant\Downloads\PAF backend\school\venv\Lib\site-packages\twisted/python/deprecate.pyÚ_fullyQualifiedNamet   s   

ÿ
r)   ztwisted.python.reflectZfullyQualifiedNamec                 C  s   t | ƒrt| ƒ} d| › d�S )a
  
    Surround a replacement for a deprecated API with some polite text exhorting
    the user to consider it as an alternative.

    @type replacement: C{str} or callable

    @return: a string like "please use twisted.python.modules.getModule
        instead".
    zplease use z insteadN)Úcallabler)   ©Úreplacementr'   r'   r(   Ú_getReplacementString�   s   
r-   c                 C  s,   dt | ƒ› �}|r|› dt|ƒ› �}|d S )aœ  
    Generate an addition to a deprecated object's docstring that explains its
    deprecation.

    @param version: the version it was deprecated.
    @type version: L{incremental.Version}

    @param replacement: The replacement, if specified.
    @type replacement: C{str} or callable

    @return: a string like "Deprecated in Twisted 27.2.0; please use
        twisted.timestream.tachyon.flux instead."
    zDeprecated in ú; r   N)r   r-   )Úversionr,   Údocr'   r'   r(   Ú_getDeprecationDocstringž   s   r1   c                 C  s6   |du rt }|| t|ƒdœ }|rd |t|ƒ¡}|S )ag  
    Return a string indicating that the Python name was deprecated in the given
    version.

    @param fqpn: Fully qualified Python name of the thing being deprecated
    @type fqpn: C{str}

    @param version: Version that C{fqpn} was deprecated in.
    @type version: L{incremental.Version}

    @param format: A user-provided format to interpolate warning values into, or
        L{DEPRECATION_WARNING_FORMAT
        <twisted.python.deprecate.DEPRECATION_WARNING_FORMAT>} if L{None} is
        given.
    @type format: C{str}

    @param replacement: what should be used in place of C{fqpn}. Either pass in
        a string, which will be inserted into the warning message, or a
        callable, which will be expanded to its full import path.
    @type replacement: C{str} or callable

    @return: A textual description of the deprecation
    @rtype: C{str}
    N)Úfqpnr/   z{}; {})ÚDEPRECATION_WARNING_FORMATr   Úformatr-   )r2   r/   r4   r,   ÚwarningStringr'   r'   r(   Ú_getDeprecationWarningString²   s   ÿr6   c                 C  s   t t| ƒ|||ƒS )ak  
    Return a string indicating that the callable was deprecated in the given
    version.

    @type callableThing: C{callable}
    @param callableThing: Callable object to be deprecated

    @type version: L{incremental.Version}
    @param version: Version that C{callableThing} was deprecated in.

    @type format: C{str}
    @param format: A user-provided format to interpolate warning values into,
        or L{DEPRECATION_WARNING_FORMAT
        <twisted.python.deprecate.DEPRECATION_WARNING_FORMAT>} if L{None} is
        given

    @param replacement: what should be used in place of the callable. Either
        pass in a string, which will be inserted into the warning message,
        or a callable, which will be expanded to its full import path.
    @type replacement: C{str} or callable

    @return: A string describing the deprecation.
    @rtype: C{str}
    N)r6   r)   )ZcallableThingr/   r4   r,   r'   r'   r(   r   Õ   s   ÿr   c                 C  sš   | j r	| j  ¡ }ng }t|ƒdkr| |¡ n.t|ƒdkr&| d|dg¡ n|d }d}| ¡ s4| ¡ }| d|| |g¡ dd„ |D ƒ}d |¡| _ dS )	av  
    Append the given text to the docstring of C{thingWithDoc}.

    If C{thingWithDoc} has no docstring, then the text just replaces the
    docstring. If it has a single-line docstring then it appends a blank line
    and the message text. If it has a multi-line docstring, then in appends a
    blank line a the message text, and also does the indentation correctly.
    r   é   Ú éÿÿÿÿc                 S  s   g | ]}|  d ¡‘qS )ú )Úlstrip)Ú.0Úlr'   r'   r(   Ú
<listcomp>  s    z&_appendToDocstring.<locals>.<listcomp>Ú
N)Ú__doc__Ú
splitlinesÚlenÚappendÚextendÚstripÚpopÚjoin)ZthingWithDocZtextToAppendZdocstringLinesÚtrailerÚspacesr'   r'   r(   Ú_appendToDocstringó   s   	rJ   r/   r   r,   ú"str | Callable[..., object] | NoneÚreturnú.Callable[[Callable[_P, _R]], Callable[_P, _R]]c                   s   d‡ ‡fdd„}|S )a—  
    Return a decorator that marks callables as deprecated. To deprecate a
    property, see L{deprecatedProperty}.

    @type version: L{incremental.Version}
    @param version: The version in which the callable will be marked as
        having been deprecated.  The decorated function will be annotated
        with this version, having it set as its C{deprecatedVersion}
        attribute.

    @param replacement: what should be used in place of the callable. Either
        pass in a string, which will be inserted into the warning message,
        or a callable, which will be expanded to its full import path.
    @type replacement: C{str} or callable
    ÚfunctionúCallable[_P, _R]rL   c                   s@   t ˆ ˆdˆƒ‰tˆ ƒd
‡ ‡fdd	„ƒ}t|tˆˆƒƒ ˆ|_|S )zA
        Decorator that marks C{function} as deprecated.
        NÚargsú_P.argsÚkwargsú	_P.kwargsrL   r   c                    ó   t ˆtdd� ˆ | i |¤ŽS ©Né   ©Ú
stacklevel©r   ÚDeprecationWarning©rP   rR   ©rN   r5   r'   r(   ÚdeprecatedFunction+  ó   zDdeprecated.<locals>.deprecationDecorator.<locals>.deprecatedFunction)rP   rQ   rR   rS   rL   r   )r   r   rJ   r1   ÚdeprecatedVersion)rN   r]   ©r,   r/   r\   r(   ÚdeprecationDecorator#  s   ÿ
ÿz(deprecated.<locals>.deprecationDecoratorN)rN   rO   rL   rO   r'   ©r/   r,   ra   r'   r`   r(   r     s   r   c                   s$   G dd„ dt ƒ‰ ‡ ‡‡fdd„}|S )a  
    Return a decorator that marks a property as deprecated. To deprecate a
    regular callable or class, see L{deprecated}.

    @type version: L{incremental.Version}
    @param version: The version in which the callable will be marked as
        having been deprecated.  The decorated function will be annotated
        with this version, having it set as its C{deprecatedVersion}
        attribute.

    @param replacement: what should be used in place of the callable.
        Either pass in a string, which will be inserted into the warning
        message, or a callable, which will be expanded to its full import
        path.
    @type replacement: C{str} or callable

    @return: A new property with deprecated setter and getter.
    @rtype: C{property}

    @since: 16.1.0
    c                   @  ó    e Zd ZdZdd„ Zdd„ ZdS )z/deprecatedProperty.<locals>._DeprecatedPropertyzQ
        Extension of the build-in property to allow deprecated setters.
        c                   s   t ˆ ƒ‡ ‡fdd„ƒ}|S )Nc                    s   t ˆjtdd� ˆ | i |¤ŽS rU   )r   r5   rZ   r[   ©rN   Úselfr'   r(   r]   X  s   ýz^deprecatedProperty.<locals>._DeprecatedProperty._deprecatedWrapper.<locals>.deprecatedFunctionr   )re   rN   r]   r'   rd   r(   Ú_deprecatedWrapperW  s   zBdeprecatedProperty.<locals>._DeprecatedProperty._deprecatedWrapperc                 S  s   t  | |  |¡¡S ©N)ÚpropertyÚsetterrf   )re   rN   r'   r'   r(   ri   c  ó   z6deprecatedProperty.<locals>._DeprecatedProperty.setterN)r   r"   r   r@   rf   ri   r'   r'   r'   r(   Ú_DeprecatedPropertyR  s    rk   c                   sL   t ˆ ˆd ˆƒ‰tˆ ƒ‡ ‡fdd„ƒ}t|tˆˆƒƒ ˆ|_ˆ|ƒ}ˆ|_|S )Nc                    rT   rU   rY   r[   r\   r'   r(   r]   k  r^   zLdeprecatedProperty.<locals>.deprecationDecorator.<locals>.deprecatedFunction)r   r   rJ   r1   r_   r5   )rN   r]   Úresult©rk   r,   r/   r\   r(   ra   f  s   ÿ
ÿz0deprecatedProperty.<locals>.deprecationDecoratorN)rh   rb   r'   rm   r(   r   9  s   r   c                   C  s   t S )zR
    Return the warning method currently used to record deprecation warnings.
    N©r   r'   r'   r'   r(   r   |  s   r   c                 C  s   | a dS )z¨
    Set the warning method to use to record deprecation warnings.

    The callable should take message, category and stacklevel. The return
    value is ignored.
    Nrn   )Z	newMethodr'   r'   r(   r   ƒ  s   r   c                   @  s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	Ú_InternalStatezò
    An L{_InternalState} is a helper object for a L{_ModuleProxy}, so that it
    can easily access its own attributes, bypassing its logic for delegating to
    another object that it's proxying for.

    @ivar proxy: a L{_ModuleProxy}
    c                 C  s   t  | d|¡ d S ©NÚproxy)ÚobjectÚ__setattr__)re   rq   r'   r'   r(   Ú__init__—  rj   z_InternalState.__init__c                 C  s   t  t  | d¡|¡S rp   )rr   Ú__getattribute__)re   r%   r'   r'   r(   ru   š  s   z_InternalState.__getattribute__c                 C  s   t  t  | d¡||¡S rp   )rr   rs   ru   )re   r%   Úvaluer'   r'   r(   rs   �  s   z_InternalState.__setattr__N)r   r"   r   r@   rt   ru   rs   r'   r'   r'   r(   ro   Ž  s
    ro   c                   @  s2   e Zd ZdZdd„ Zddd„Zdd	„ Zd
d„ ZdS )Ú_ModuleProxya¬  
    Python module wrapper to hook module-level attribute access.

    Access to deprecated attributes first checks
    L{_ModuleProxy._deprecatedAttributes}, if the attribute does not appear
    there then access falls through to L{_ModuleProxy._module}, the wrapped
    module object.

    @ivar _module: Module on which to hook attribute access.
    @type _module: C{module}

    @ivar _deprecatedAttributes: Mapping of attribute names to objects that
        retrieve the module attribute's original value.
    @type _deprecatedAttributes: C{dict} mapping C{str} to
        L{_DeprecatedAttribute}

    @ivar _lastWasPath: Heuristic guess as to whether warnings about this
        package should be ignored for the next call.  If the last attribute
        access of this module was a C{getattr} of C{__path__}, we will assume
        that it was the import system doing it and we won't emit a warning for
        the next access, even if it is to a deprecated attribute.  The CPython
        import system always tries to access C{__path__}, then the attribute
        itself, then the attribute itself again, in both successful and failed
        cases.
    @type _lastWasPath: C{bool}
    c                 C  s   t | ƒ}||_i |_d|_d S )NF)ro   Ú_moduleÚ_deprecatedAttributesÚ_lastWasPath)re   ÚmoduleÚstater'   r'   r(   rt   ½  s   
z_ModuleProxy.__init__rL   Ústrc                 C  s"   t | ƒ}dt| ƒj› d|j›d�S )z�
        Get a string containing the type of the module proxy and a
        representation of the wrapped module object.
        ú<z module=ú>N)ro   Útyper   rx   )re   r|   r'   r'   r(   Ú__repr__Ã  s   z_ModuleProxy.__repr__c                 C  s    t | ƒ}d|_t|j||ƒ dS )z@
        Set an attribute on the wrapped module object.
        FN)ro   rz   Úsetattrrx   )re   r%   rv   r|   r'   r'   r(   rs   Ë  s   z_ModuleProxy.__setattr__c                 C  sZ   t | ƒ}|jr
d}n|j |¡}|dur| ¡ }nt|j|ƒ}|dkr(d|_|S d|_|S )aG  
        Get an attribute from the module object, possibly emitting a warning.

        If the specified name has been deprecated, then a warning is issued.
        (Unless certain obscure conditions are met; see
        L{_ModuleProxy._lastWasPath} for more information about what might quash
        such a warning.)
        NÚ__path__TF)ro   rz   ry   ÚgetÚgetattrrx   )re   r%   r|   ZdeprecatedAttributerv   r'   r'   r(   ru   Ó  s   	
ÿz_ModuleProxy.__getattribute__N)rL   r}   )r   r"   r   r@   rt   r�   rs   ru   r'   r'   r'   r(   rw   ¡  s    
rw   c                   @  rc   )Ú_DeprecatedAttributeaE  
    Wrapper for deprecated attributes.

    This is intended to be used by L{_ModuleProxy}. Calling
    L{_DeprecatedAttribute.get} will issue a warning and retrieve the
    underlying attribute's value.

    @type module: C{module}
    @ivar module: The original module instance containing this attribute

    @type fqpn: C{str}
    @ivar fqpn: Fully qualified Python name for the deprecated attribute

    @type version: L{incremental.Version}
    @ivar version: Version that the attribute was deprecated in

    @type message: C{str}
    @ivar message: Deprecation message
    c                 C  s,   || _ || _|jd | | _|| _|| _dS )z7
        Initialise a deprecated name wrapper.
        r   N)r{   r   r2   r/   Úmessage)re   r{   r%   r/   r‡   r'   r'   r(   rt     s
   
z_DeprecatedAttribute.__init__c                 C  s:   t | j| jƒ}t| j| jtd | j ƒ}t|t	dd� |S )zU
        Get the underlying attribute value and issue a deprecation warning.
        z: é   rW   N)
r…   r{   r   r6   r2   r/   r3   r‡   r   rZ   )re   rl   r‡   r'   r'   r(   r„     s   ÿz_DeprecatedAttribute.getN)r   r"   r   r@   rt   r„   r'   r'   r'   r(   r†   ñ  s    
r†   c                 C  s2   t  | d¡}t||||ƒ}t  | d¡}|||< dS )a”  
    Mark a module-level attribute as being deprecated.

    @type proxy: L{_ModuleProxy}
    @param proxy: The module proxy instance proxying the deprecated attributes

    @type name: C{str}
    @param name: Attribute name

    @type version: L{incremental.Version}
    @param version: Version that the attribute was deprecated in

    @type message: C{str}
    @param message: Deprecation message
    rx   ry   N)rr   ru   r†   )rq   r%   r/   r‡   rx   Úattrry   r'   r'   r(   Ú_deprecateAttribute   s   rŠ   c                 C  s>   t j| }t|tƒsttt|ƒƒ}|t j|< t||| |ƒ dS )aE  
    Declare a module-level attribute as being deprecated.

    @type version: L{incremental.Version}
    @param version: Version that the attribute was deprecated in

    @type message: C{str}
    @param message: Deprecation message

    @type moduleName: C{str}
    @param moduleName: Fully-qualified Python name of the module containing
        the deprecated attribute; if called from the same module as the
        attributes are being deprecated in, using the C{__name__} global can
        be helpful

    @type name: C{str}
    @param name: Attribute name to deprecate
    N)ÚsysÚmodulesÚ
isinstancerw   r   r   rŠ   )r/   r‡   r&   r%   r{   r'   r'   r(   r   8  s
   


r   c              
   C  sL   t j| j }t|tt |¡tdd„ t| j	ƒD ƒƒ|j
| j di ¡dd� dS )aß  
    Issue a warning string, identifying C{offender} as the responsible code.

    This function is used to deprecate some behavior of a function.  It differs
    from L{warnings.warn} in that it is not limited to deprecating the behavior
    of a function currently on the call stack.

    @param offender: The function that is being deprecated.

    @param warningString: The string that should be emitted by this warning.
    @type warningString: C{str}

    @since: 11.0
    c                 s  s    � | ]\}}|d ur|V  qd S rg   r'   )r<   Ú_Z
lineNumberr'   r'   r(   Ú	<genexpr>l  s   € ý
ÿz$warnAboutFunction.<locals>.<genexpr>Ú__warningregistry__N)ÚcategoryÚfilenameÚlinenor{   ÚregistryÚmodule_globals)r‹   rŒ   r"   r   rZ   r   Ú
getabsfileÚmaxr
   Ú__code__r   Ú__globals__Ú
setdefault)Zoffenderr5   ZoffenderModuler'   r'   r(   ÚwarnAboutFunctionS  s   þ
õr›   c                 C  sÒ   i }t | jƒt |ƒ }| jduri  }|| j< |dk r0| jdu r$tdƒ‚|t | jƒd… || j< t| j|ƒD ]\}}|||< q6| ¡ D ]#\}}|| jv rY||v rTtdƒ‚|||< qC| jdurc|||< qCtdƒ‚|S )a¬  
    Take an I{inspect.ArgSpec}, a tuple of positional arguments, and a dict of
    keyword arguments, and return a mapping of arguments that were actually
    passed to their passed values.

    @param argspec: The argument specification for the function to inspect.
    @type argspec: I{inspect.ArgSpec}

    @param positional: The positional arguments that were passed.
    @type positional: L{tuple}

    @param keyword: The keyword arguments that were passed.
    @type keyword: L{dict}

    @return: A dictionary mapping argument names (those declared in C{argspec})
        to values that were passed explicitly by the user.
    @rtype: L{dict} mapping L{str} to L{object}
    Nr   úToo many arguments.úAlready passed.úno such param)rB   rP   ÚkeywordsÚvarargsÚ	TypeErrorÚzipÚitems)ZargspecÚ
positionalÚkeywordrl   ZunpassedrR   r%   rv   r'   r'   r(   Ú_passedArgSpecw  s&   






r¦   c           
      C  sh  i }d}d}t | j ¡ ƒD ]q\}\}}|jtjjkr+||d… ||< t|| ƒd }q|jtjjkr9i  }||< q|jtjj	tjj
fv rU|t|ƒk rT|| ||< |d7 }q|jtjjkrt||vrs|jtjjkrntd|› �ƒ‚|j||< qtd|› d|j› �ƒ‚t|ƒ|kr‰tdƒ‚| ¡ D ]$\}}	|| j ¡ v r¥||v r tdƒ‚|	||< q�|dur®|	||< q�td	ƒ‚|S )
a¨  
    Take an L{inspect.Signature}, a tuple of positional arguments, and a dict of
    keyword arguments, and return a mapping of arguments that were actually
    passed to their passed values.

    @param signature: The signature of the function to inspect.
    @type signature: L{inspect.Signature}

    @param positional: The positional arguments that were passed.
    @type positional: L{tuple}

    @param keyword: The keyword arguments that were passed.
    @type keyword: L{dict}

    @return: A dictionary mapping argument names (those declared in
        C{signature}) to values that were passed explicitly by the user.
    @rtype: L{dict} mapping L{str} to L{object}
    Nr   r7   zmissing keyword arg ú'z' parameter is invalid kind: rœ   r�   rž   )Ú	enumerateÚ
parametersr£   Úkindr   Ú	ParameterÚVAR_POSITIONALrB   ÚVAR_KEYWORDÚPOSITIONAL_OR_KEYWORDÚPOSITIONAL_ONLYÚKEYWORD_ONLYÚdefaultÚemptyr¡   Úkeys)
Ú	signaturer¤   r¥   rl   rR   ZnumPositionalÚnr%   Úparamrv   r'   r'   r(   Ú_passedSignature¡  sF   þ€
€

r·   c                   s   ‡ fdd„}|S )a—  
    Decorator which causes its decoratee to raise a L{TypeError} if two of the
    given arguments are passed at the same time.

    @param argumentPairs: pairs of argument identifiers, each pair indicating
        an argument that may not be passed in conjunction with another.
    @type argumentPairs: sequence of 2-sequences of L{str}

    @return: A decorator, used like so::

            @_mutuallyExclusiveArguments([["tweedledum", "tweedledee"]])
            def function(tweedledum=1, tweedledee=2):
                "Don't pass tweedledum and tweedledee at the same time."

    @rtype: 1-argument callable taking a callable and returning a callable.
    c                   s,   t  ˆ¡‰t‰ tˆƒ‡ ‡‡‡fdd„ƒ}|S )Nc                    sN   ˆ ˆ| |ƒ}ˆD ]\}}||v r||v rt d||tˆƒf ƒ‚qˆ| i |¤ŽS )Nz5The %r and %r arguments to %s are mutually exclusive.)r¡   r)   )rP   rR   Ú	argumentsÚthisÚthat)Ú_passedÚargumentPairsÚspecÚwrappeer'   r(   Úwrappedó  s   ÿÿ€z=_mutuallyExclusiveArguments.<locals>.wrapper.<locals>.wrapped)r   r´   r·   r   )r¾   r¿   ©r¼   )r»   r½   r¾   r(   Úwrapperï  s
   

z,_mutuallyExclusiveArguments.<locals>.wrapperNr'   )r¼   rÁ   r'   rÀ   r(   Ú_mutuallyExclusiveArgumentsÝ  s   rÂ   Ú_Tc.)Úboundr%   r}   úOptional[str]úCallable[[_Tc], _Tc]c                   s   d‡ ‡‡fdd„}|S )aw  
    Return a decorator that marks a keyword parameter of a callable
    as deprecated. A warning will be emitted if a caller supplies
    a value for the parameter, whether the caller uses a keyword or
    positional syntax.

    @type version: L{incremental.Version}
    @param version: The version in which the parameter will be marked as
        having been deprecated.

    @type name: L{str}
    @param name: The name of the deprecated parameter.

    @type replacement: L{str}
    @param replacement: Optional text indicating what should be used in
        place of the deprecated parameter.

    @since: Twisted 21.2.0
    r¾   rÃ   rL   c                   sÂ   t dˆ›dtˆƒ› �ˆˆd�‰d ˆtˆƒ¡}ˆr!|d tˆƒ }|d7 }t ˆ¡j}ˆ|v rI|ˆ jtj	j
krIt|ƒ ˆ¡‰ ‡‡ ‡‡fdd„}n‡‡‡fd	d„}tttˆƒ|ƒƒ}t||ƒ |S )
NzThe z parameter to r+   z'The {!r} parameter was deprecated in {}r.   r   c                    s0   t | ƒˆks
ˆ |v rtˆtdd� ˆ| i |¤ŽS rU   )rB   r   rZ   r[   )r%   ÚparameterIndexr5   r¾   r'   r(   ÚcheckDeprecatedParameter3  s   zMdeprecatedKeywordParameter.<locals>.wrapper.<locals>.checkDeprecatedParameterc                    s$   ˆ |v rt ˆtdd� ˆ| i |¤ŽS rU   rY   r[   )r%   r5   r¾   r'   r(   rÈ   :  s   )r6   r)   r4   r   r-   r   r´   r©   rª   r«   r®   ÚlistÚindexr   rÃ   r   rJ   )r¾   r0   ÚparamsrÈ   Z	decorated©r%   r,   r/   )rÇ   r5   r¾   r(   rÁ     s.   ýþÿþ
z+deprecatedKeywordParameter.<locals>.wrapperN)r¾   rÃ   rL   rÃ   r'   )r/   r%   r,   rÁ   r'   rÌ   r(   r	     s   &r	   rg   )NN)r/   r   r,   rK   rL   rM   )r/   r   r%   r}   r,   rÅ   rL   rÆ   )6r@   Ú
__future__r   Ú__all__r   r‹   Údisr
   Ú	functoolsr   Útypesr   Útypingr   r   r   r   r   r   Úwarningsr   r   Úincrementalr   r   Ztyping_extensionsr   r   r   r3   r)   r"   r   r   r-   r1   r6   r   rJ   r   r   r   r   ro   rw   r†   rŠ   r   r›   r¦   r·   rÂ   rÃ   r	   r'   r'   r'   r(   Ú<module>   sT   M 


#ÿ*ÿCP/$*<&ÿ