Ë
    ojõm  ã                  óÖ  — 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„ Zde_        de_        de_         d„ Z!d+d„Z"d,d„Z#d,d„Z$d„ Z%	 d+	 	 	 	 	 d-d„Z&d+d„Z'd„ Z(d„ Z) G d„ d«      Z* G d„ d«      Z+ G d„ d «      Z,d!„ Z-d"„ Z.d#„ Z/d$„ Z0d%„ Z1d&„ Z2 ed'ed(ef   ¬)«      Z3	 d+	 	 	 	 	 	 	 d.d*„Z4y)/ah  
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.
            '''


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                ó0  — 	 | j                   }t        j                  | «      st        j
                  | «      r| j                  }|› d|› �S t        j                  | «      r| j                  › d| j                   › �S |S # t        $ r | j                  }Y Œ†w xY w)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}.
    ú.)Ú__qualname__ÚAttributeErrorÚ__name__ÚinspectÚisclassÚ
isfunctionÚ
__module__Úismethod)ÚobjÚnameÚ
moduleNames      ú:/usr/lib/python3/dist-packages/twisted/python/deprecate.pyÚ_fullyQualifiedNamer*   s   s‘   € ðØ×Ñˆô ‡��sÔœw×1Ñ1°#Ô6Ø—^‘^ˆ
Ø�˜Q˜t˜fÐ%Ð%Ü	×	Ñ	˜#Ô	Ø—.‘.Ð!  3×#3Ñ#3Ð"4Ð5Ð5Ø€Køô ò Ø�|‰|Šðús   ‚A= Á=BÂBztwisted.python.reflectÚfullyQualifiedNamec                ó:   — 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 instead)Úcallabler*   ©Úreplacements    r)   Ú_getReplacementStringr0   Ž   s%   € ô �ÔÜ)¨+Ó6ˆØ˜˜ XÐ.Ð.ó    c                óL   — dt        | «      › �}|r|› dt        |«      › �}|dz   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   )r   r0   )Úversionr/   Údocs      r)   Ú_getDeprecationDocstringr6   �   s;   € ð Ô+¨GÓ4Ð5Ð
6€CÙØ��RÔ-¨kÓ:Ð;Ð<ˆØ�‰9Ðr1   c                ór   — |€t         }|| t        |«      dœz  }|rdj                  |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}
    )Úfqpnr4   z{}; {})ÚDEPRECATION_WARNING_FORMATr   Úformatr0   )r8   r4   r:   r/   ÚwarningStrings        r)   Ú_getDeprecationWarningStringr<   ±   sG   € ð2 €~Ü+ˆØ dÔ7GÈÓ7PÑQÑQ€MÙØ Ÿ™ØÔ0°Ó=ó
ˆð Ðr1   c                ó0   — 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}
    )r<   r*   )ÚcallableThingr4   r:   r/   s       r)   r   r   Ô   s   € ô2 (Ü˜MÓ*¨G°V¸[óð r1   c                óV  — | j                   r| j                   j                  «       }ng }t        |«      dk(  r|j                  |«       nJt        |«      dk(  r|j	                  d|dg«       n'|j                  «       }|j	                  d||z   |g«       dj                  |«      | _         y)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   é   Ú ú
N)Ú__doc__Ú
splitlinesÚlenÚappendÚextendÚpopÚjoin)ÚthingWithDocÚtextToAppendÚdocstringLinesÚspacess       r)   Ú_appendToDocstringrN   ò   sœ   € ð ×ÒØ%×-Ñ-×8Ñ8Ó:‰àˆä
ˆ>Ó˜aÒØ×Ñ˜lÕ+Ü	ˆ^Ó	 Ò	!Ø×Ñ˜r <°Ð4Õ5à×#Ñ#Ó%ˆØ×Ñ˜r 6¨LÑ#8¸&ÐAÔBØŸ9™9 ^Ó4€LÕr1   c                ó   ‡ ‡— dˆˆ f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
    c                óŒ   •‡ ‡— t        ‰ ‰d‰«      Št        ‰ «      dˆ ˆfd„«       }t        |t        ‰‰«      «       ‰|_        |S )zA
        Decorator that marks C{function} as deprecated.
        Nc                 ó8   •— t        ‰t        d¬«        ‰| i |¤ŽS ©Né   ©Ú
stacklevel©r   ÚDeprecationWarning©ÚargsÚkwargsÚfunctionr;   s     €€r)   ÚdeprecatedFunctionzDdeprecated.<locals>.deprecationDecorator.<locals>.deprecatedFunction%  ó    ø€ ä�Ô 2¸qÕAÙ˜TÐ, VÑ,Ð,r1   )rY   z_P.argsrZ   z	_P.kwargsÚreturnr   )r   r   rN   r6   ÚdeprecatedVersion)r[   r\   r;   r/   r4   s   ` @€€r)   ÚdeprecationDecoratorz(deprecated.<locals>.deprecationDecorator  sX   ú€ ô 4Ø�g˜t [ó
ˆô 
ˆx‹õ	-ó 
ð	-ô 	ØÔ 8¸À+Ó Nô	
ð 07ÐÔ,Ø!Ð!r1   )r[   úCallable[_P, _R]r^   ra   © )r4   r/   r`   s   `` r)   r   r   
  s   ù€ ö&"ð&  Ðr1   c                ó8   ‡ ‡‡—  G d„ dt         «      Šˆˆˆ f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„ Zd„ Zy)ú/deprecatedProperty.<locals>._DeprecatedPropertyzQ
        Extension of the build-in property to allow deprecated setters.
        c                ó2   ‡ ‡— t        ‰«      ˆˆ fd„«       }|S )Nc                 óL   •— t        ‰j                  t        d¬«        ‰| i |¤ŽS rR   )r   r;   rW   )rY   rZ   r[   Úselfs     €€r)   r\   z^deprecatedProperty.<locals>._DeprecatedProperty._deprecatedWrapper.<locals>.deprecatedFunctionP  s,   ø€ äØ×&Ñ&Ü&Ø õñ
   Ð0¨Ñ0Ð0r1   r   )rh   r[   r\   s   `` r)   Ú_deprecatedWrapperzBdeprecatedProperty.<locals>._DeprecatedProperty._deprecatedWrapperO  s!   ù€ Ü�8‹_ô1ó ð1ð &Ð%r1   c                óL   — t         j                  | | j                  |«      «      S ©N)ÚpropertyÚsetterri   )rh   r[   s     r)   rm   z6deprecatedProperty.<locals>._DeprecatedProperty.setter[  s   € Ü—?‘? 4¨×)@Ñ)@ÀÓ)JÓKÐKr1   N)r    r$   r   rC   ri   rm   rb   r1   r)   Ú_DeprecatedPropertyre   J  s   „ ñ	ò
	&ó	Lr1   rn   c                ó¨   •‡ ‡— t        ‰ ‰d ‰«      Št        ‰ «      ˆ ˆfd„«       }t        |t        ‰‰«      «       ‰|_         ‰|«      }‰|_        |S )Nc                 ó8   •— t        ‰t        d¬«        ‰| i |¤ŽS rR   rV   rX   s     €€r)   r\   zLdeprecatedProperty.<locals>.deprecationDecorator.<locals>.deprecatedFunctionc  r]   r1   )r   r   rN   r6   r_   r;   )r[   r\   Úresultr;   rn   r/   r4   s   `  @€€€r)   r`   z0deprecatedProperty.<locals>.deprecationDecorator^  sh   ú€ Ü3Ø�g˜t [ó
ˆô 
ˆx‹ô	-ó 
ð	-ô 	ØÔ 8¸À+Ó Nô	
ð 07ÐÔ,á$Ð%7Ó8ˆØ,ˆÔØˆr1   )rl   )r4   r/   r`   rn   s   `` @r)   r   r   3  s   ú€ ô.Lœhô Lö(ð&  Ðr1   c                 ó   — t         S )zR
    Return the warning method currently used to record deprecation warnings.
    ©r   rb   r1   r)   r   r   t  s	   € ô €Kr1   c                ó   — | a y)z¨
    Set the warning method to use to record deprecation warnings.

    The callable should take message, category and stacklevel. The return
    value is ignored.
    Nrs   )Ú	newMethods    r)   r   r   {  s	   € ð �Dr1   c                  ó"   — e Zd ZdZd„ Zd„ Zd„ Zy)Ú_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                ó2   — t         j                  | d|«       y ©NÚproxy)ÚobjectÚ__setattr__)rh   rz   s     r)   Ú__init__z_InternalState.__init__�  s   € Ü×Ñ˜4 ¨%Õ0r1   c                óV   — t         j                  t         j                  | d«      |«      S ry   )r{   Ú__getattribute__)rh   r'   s     r)   r   z_InternalState.__getattribute__’  s"   € Ü×&Ñ&¤v×'>Ñ'>¸tÀWÓ'MÈtÓTÐTr1   c                óX   — t         j                  t         j                  | d«      ||«      S ry   )r{   r|   r   )rh   r'   Úvalues      r)   r|   z_InternalState.__setattr__•  s%   € Ü×!Ñ!¤&×"9Ñ"9¸$ÀÓ"HÈ$ÐPUÓVÐVr1   N)r    r$   r   rC   r}   r   r|   rb   r1   r)   rw   rw   †  s   „ ñò1òUóWr1   rw   c                  ó*   — e Zd ZdZd„ Zdd„Zd„ Zd„ Zy)Ú_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                óD   — t        | «      }||_        i |_        d|_        y )NF)rw   Ú_moduleÚ_deprecatedAttributesÚ_lastWasPath)rh   ÚmoduleÚstates      r)   r}   z_ModuleProxy.__init__µ  s#   € Ü˜tÓ$ˆØˆŒØ&(ˆÔ#Ø"ˆÕr1   c                ód   — 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=ú>)rw   Útyper    r…   )rh   r‰   s     r)   Ú__repr__z_ModuleProxy.__repr__»  s3   € ô
 ˜tÓ$ˆØ”4˜“:×&Ñ&Ð' x°·±Ð/@ÀÐBÐBr1   c                óV   — t        | «      }d|_        t        |j                  ||«       y)z@
        Set an attribute on the wrapped module object.
        FN)rw   r‡   Úsetattrr…   )rh   r'   r�   r‰   s       r)   r|   z_ModuleProxy.__setattr__Ã  s&   € ô ˜tÓ$ˆØ"ˆÔÜ�—‘˜t UÕ+r1   c                óì   — t        | «      }|j                  rd}n|j                  j                  |«      }|�|j                  «       }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)rw   r‡   r†   ÚgetÚgetattrr…   )rh   r'   r‰   ÚdeprecatedAttributer�   s        r)   r   z_ModuleProxy.__getattribute__Ë  s‚   € ô ˜tÓ$ˆØ×ÒØ"&Ñà"'×"=Ñ"=×"AÑ"AÀ$Ó"GÐàÐ*ð (×+Ñ+Ó-‰Eô ˜EŸM™M¨4Ó0ˆEØ�:ÒØ!%ˆEÔð ˆð "'ˆEÔØˆr1   N)r^   Ústr)r    r$   r   rC   r}   rŽ   r|   r   rb   r1   r)   rƒ   rƒ   ™  s   „ ñò6#óCò,ór1   rƒ   c                  ó   — e Zd ZdZd„ Zd„ Zy)Ú_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                ój   — || _         || _        |j                  dz   |z   | _        || _        || _        y)z7
        Initialise a deprecated name wrapper.
        r   N)rˆ   r    r8   r4   Úmessage)rh   rˆ   r'   r4   rš   s        r)   r}   z_DeprecatedAttribute.__init__þ  s5   € ð ˆŒØˆŒØ—O‘O cÑ)¨DÑ0ˆŒ	ØˆŒØˆ�r1   c                óÔ   — t        | j                  | j                  «      }t        | j                  | j
                  t        dz   | j                  z   «      }t        |t        d¬«       |S )zU
        Get the underlying attribute value and issue a deprecation warning.
        z: é   rT   )
r”   rˆ   r    r<   r8   r4   r9   rš   r   rW   )rh   rq   rš   s      r)   r“   z_DeprecatedAttribute.get  sT   € ô ˜Ÿ™ d§m¡mÓ4ˆÜ.Ø�I‰I�t—|‘|Ô%?À$Ñ%FÈÏÉÑ%Uó
ˆô 	ˆWÔ(°QÕ7Øˆr1   N)r    r$   r   rC   r}   r“   rb   r1   r)   r˜   r˜   é  s   „ ñò(ór1   r˜   c                ó‚   — t         j                  | d«      }t        ||||«      }t         j                  | d«      }|||<   y)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
    r…   r†   N)r{   r   r˜   )rz   r'   r4   rš   r…   Úattrr†   s          r)   Ú_deprecateAttributerŸ     sG   € ô  ×%Ñ% e¨YÓ7€GÜ ¨¨w¸Ó@€Dô #×3Ñ3°EÐ;RÓSÐØ"&Ð˜$Òr1   c                ó¾   — t         j                  |   }t        |t        «      s,t	        t
        t        |«      «      }|t         j                  |<   t        ||| |«       y)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Ú
isinstancerƒ   r   r   rŸ   )r4   rš   r(   r'   rˆ   s        r)   r	   r	   0  sI   € ô& �[‰[˜Ñ$€FÜ�fœlÔ+Ü”j¤,¨vÓ"6Ó7ˆØ"(Œ�‰�JÑä˜  g¨wÕ7r1   c                ó  — t         j                  | j                     }t        |t        t        j                  |«      t        d„ t        | j                  «      D «       «      |j                  | j                  j                  di «      d¬«       y)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              3  ó*   K  — | ]  \  }}|�|–— Œ y ­wrk   rb   )Ú.0Ú_Ú
lineNumbers      r)   ú	<genexpr>z$warnAboutFunction.<locals>.<genexpr>d  s"   è ø€ ò 
á��:ØÐ%ô ñ
ùs   ‚Ú__warningregistry__N)ÚcategoryÚfilenameÚlinenorˆ   ÚregistryÚmodule_globals)r¡   r¢   r$   r   rW   r!   Ú
getabsfileÚmaxr   Ú__code__r    Ú__globals__Ú
setdefault)Úoffenderr;   ÚoffenderModules      r)   ÚwarnAboutFunctionr·   K  sy   € ô( —[‘[ ×!4Ñ!4Ñ5€NÜØÜ#Ü×#Ñ# NÓ3Üñ 
ä!/°×0AÑ0AÓ!Bô
ó 
ð
 ×&Ñ&Ø×%Ñ%×0Ñ0Ð1FÈÓKØör1   c                óü  — i }t        | j                  «      t        |«      z
  }| j                  �i x}|| j                  <   |dk  r<| j                  €t	        d«      ‚|t        | j                  «      d || j                  <   t        | j                  |«      D ]
  \  }}|||<   Œ |j                  «       D ]D  \  }}|| j                  v r||v rt	        d«      ‚|||<   Œ)| j                  �||<   Œ;t	        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)rE   rY   ÚkeywordsÚvarargsÚ	TypeErrorÚzipÚitems)ÚargspecÚ
positionalÚkeywordrq   ÚunpassedrZ   r'   r�   s           r)   Ú_passedArgSpecrÅ   o  s  € ð& !#€FÜ�7—<‘<Ó ¤3 z£?Ñ2€HØ×ÑÐ#Ø,.Ð.ˆ�˜×(Ñ(Ñ)Ø�!‚|Ø�?‰?Ð"ÜÐ1Ó2Ð2à&0´°W·\±\Ó1BÐ1DÐ&EˆF�7—?‘?Ñ#Ü˜7Ÿ<™<¨Ó4ò ‰ˆˆeØˆˆtŠðà—}‘}“ò -‰ˆˆeØ�7—<‘<ÑØ�v‰~ÜÐ 1Ó2Ð2Ø ˆF�4ŠLØ×ÑÐ)Ø ˆF�4ŠLä˜OÓ,Ð,ð-ð €Mr1   c                ó  — i }d}d}t        | j                  j                  «       «      D �]b  \  }\  }}|j                  t        j
                  j                  k(  r||d ||<   t        ||   «      dz   }ŒK|j                  t        j
                  j                  k(  ri x}||<   Œz|j                  t        j
                  j                  t        j
                  j                  fv r|t        |«      k  sŒÉ||   ||<   |dz  }Œ×|j                  t        j
                  j                  k(  rL||vs�Œ|j                  t        j
                  j                  k(  rt        d|› �«      ‚|j                  ||<   �ŒJt        d|› d|j                  › �«      ‚ t        |«      |kD  rt        d«      ‚|j                  «       D ]H  \  }}	|| j                  j                  «       v r||v rt        d«      ‚|	||<   Œ7|�|	||<   Œ?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   r@   zmissing keyword arg ú'z' parameter is invalid kind: r¹   rº   r»   )Ú	enumerateÚ
parametersrÀ   Úkindr!   Ú	ParameterÚVAR_POSITIONALrE   ÚVAR_KEYWORDÚPOSITIONAL_OR_KEYWORDÚPOSITIONAL_ONLYÚKEYWORD_ONLYÚdefaultÚemptyr¾   Úkeys)
Ú	signaturerÂ   rÃ   rq   rZ   ÚnumPositionalÚnr'   Úparamr�   s
             r)   Ú_passedSignaturerØ   ™  sñ  € ð& €FØ€FØ€MÜ% i×&:Ñ&:×&@Ñ&@Ó&BÓCó QÑˆ‰=ˆD�%Ø�:‰:œ×*Ñ*×9Ñ9Ò9à% a b˜>ˆF�4‰LÜ  t¡Ó-°Ñ1‰MØ�Z‰Zœ7×,Ñ,×8Ñ8Ò8à$&Ð&ˆF�V˜D’\Ø�Z‰ZÜ×Ñ×3Ñ3Ü×Ñ×-Ñ-ð
ñ 
ð ”3�z“?Ó"Ø)¨!™}��t‘Ø Ñ"‘Ø�Z‰Zœ7×,Ñ,×9Ñ9Ò9Ø˜7Ó"Ø—=‘=¤G×$5Ñ$5×$;Ñ$;Ò;Ü#Ð&:¸4¸&Ð$AÓBÐBà#(§=¡=�F˜4“Lä˜a ˜vÐ%BÀ5Ç:Á:À,ÐOÓPÐPð-Qô0 ˆ:ƒ˜Ò&ÜÐ-Ó.Ð.Ø—}‘}“ò -‰ˆˆeØ�9×'Ñ'×,Ñ,Ó.Ñ.Ø�v‰~ÜÐ 1Ó2Ð2Ø ˆF�4ŠLØÐØ ˆF�4ŠLä˜OÓ,Ð,ð-ð €Mr1   c                ó   ‡ — ˆ f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                óp   •‡ ‡‡— t        j                  ‰ «      Št        Št        ‰ «      ˆˆˆˆ fd„«       }|S )Nc                 óŠ   •—  ‰‰| |«      }‰D ],  \  }}||v sŒ||v sŒt        d|›d|›dt        ‰«      ›d�«      ‚  ‰| i |¤ŽS )NúThe z and z arguments to z are mutually exclusive.)r¾   r*   )	rY   rZ   Ú	argumentsÚthisÚthatÚ_passedÚargumentPairsÚspecÚwrappees	        €€€€r)   Úwrappedz=_mutuallyExclusiveArguments.<locals>.wrapper.<locals>.wrappedë  se   ø€ á  d¨FÓ3ˆIØ+ò ‘
��dØ˜9Ò$¨°Ò):Ý#â¢Ô':¸7Õ'CðEóð ðñ ˜DÐ+ FÑ+Ð+r1   )r!   rÔ   rØ   r   )rã   rä   rà   râ   rá   s   ` @@€r)   Úwrapperz,_mutuallyExclusiveArguments.<locals>.wrapperç  s5   û€ Ü× Ñ  Ó)ˆÜ"ˆä	ˆw‹ö	,ó 
ð	,ð ˆr1   rb   )rá   rå   s   ` r)   Ú_mutuallyExclusiveArgumentsræ   Õ  s   ø€ ô$ð" €Nr1   Ú_Tc.)Úboundc                ó   ‡ ‡‡— dˆˆˆ f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
    c                óò  •‡ ‡‡— t        d‰›dt        ‰ «      › �‰	‰¬«      Šdj                  ‰t        ‰	«      «      }‰r|dz   t	        ‰«      z   }|dz  }t        j                  ‰ «      j                  }‰|v rM|‰   j                  t
        j                  j                  k(  r#t        |«      j                  ‰«      Šˆˆˆˆ fd„}nˆˆˆ fd„}t        t         t        ‰ «      |«      «      }t!        ||«       |S )	NrÜ   z parameter to r.   z'The {!r} parameter was deprecated in {}r3   r   c                 ó\   •— t        | «      ‰kD  s‰|v rt        ‰t        d¬«        ‰| i |¤ŽS rR   )rE   r   rW   )rY   rZ   r'   ÚparameterIndexr;   rã   s     €€€€r)   ÚcheckDeprecatedParameterzMdeprecatedKeywordParameter.<locals>.wrapper.<locals>.checkDeprecatedParameter+  s2   ø€ Ü�t“9˜~Ò-°¸±Ü˜Ô(:ÀqÕIÙ Ð/¨Ñ/Ð/r1   c                 ó@   •— ‰|v rt        ‰t        d¬«        ‰| i |¤ŽS rR   rV   )rY   rZ   r'   r;   rã   s     €€€r)   rí   zMdeprecatedKeywordParameter.<locals>.wrapper.<locals>.checkDeprecatedParameter2  s'   ø€ Ø˜6‘>Ü˜Ô(:ÀqÕIÙ Ð/¨Ñ/Ð/r1   )r<   r*   r:   r   r0   r!   rÔ   rÉ   rÊ   rË   rÎ   ÚlistÚindexr   rç   r   rN   )
rã   r5   Úparamsrí   Ú	decoratedrì   r;   r'   r/   r4   s
   `    @@€€€r)   rå   z+deprecatedKeywordParameter.<locals>.wrapper  sñ   û€ Ü4Ø�4�(˜.Ô)<¸WÓ)EÐ(FÐGØØ#ô
ˆð 8×>Ñ>ØÜ˜WÓ%ó
ˆñ Ø˜‘*Ô4°[ÓAÑAˆCØˆs‰
ˆä×"Ñ" 7Ó+×6Ñ6ˆà�F‰NØ�t‘×!Ñ!¤W×%6Ñ%6×%LÑ%LÒLä! &›\×/Ñ/°Ó5ˆN÷0ð 0ö0ô
 œ˜nœe G›nÐ-EÓFÓGˆ	Ü˜9 cÔ*ØÐr1   )rã   rç   r^   rç   rb   )r4   r'   r/   rå   s   ``` r)   r
   r
   þ  s   ú€ ÷.$ðL €Nr1   rk   )NN)r4   r   r/   z"str | Callable[..., object] | Noner^   z.Callable[[Callable[_P, _R]], Callable[_P, _R]])r4   r   r'   r–   r/   zOptional[str]r^   zCallable[[_Tc], _Tc])5rC   Ú
__future__r   Ú__all__r!   r¡   Údisr   Ú	functoolsr   Útypesr   Útypingr   r   r   r   r   r   Úwarningsr   r   Úincrementalr   r   r   r   r   r9   r*   r$   r    r   r0   r6   r<   r   rN   r   r   r   r   rw   rƒ   r˜   rŸ   r	   r·   rÅ   rØ   ræ   rç   r
   rb   r1   r)   ú<module>rû      sI  ðñ
KõX #ò€ó Û 
Ý Ý Ý ß ?× ?ß (ç 1Ý áˆtƒ_€ÙˆTƒ]€àEÐ òð, ":Ð Ô Ø3Ð Ô Ø#7Ð Ô  ò/óó( óFò<5ð2 IMð& Øð& Ø#Eð& à3ó& óR> òBò÷Wñ W÷&Mñ M÷`,ñ ,ò^'ò08ò6!òH'òT9òx#ñL ˆe˜8 C¨ HÑ-Ô.€ð ?Cð=Øð=Øð=Ø.;ð=àô=r1   