§
    ¹³Ùg%M  ã                  óÔ   — 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	m
Z
 dddddd	d
œd9d„Zddddddddœd:d„Zefddœd;d#„Zd	efddœd<d%„Zd=d1„Zd>d4„Z eh d5£¦  «        Zd?d8„ZdS )@zDeprecation utilitiesé    )ÚannotationsN)ÚCallable)ÚAnyÚTypeFÚqiskitz/no earlier than 3 months after the release dateé   )Úadditional_msgÚpendingÚpackage_nameÚremoval_timelineÚis_propertyÚ
stacklevelÚsinceÚstrr	   ú
str | Noner
   Úboolr   r   r   r   Úintc                ó*   ‡ ‡‡‡‡‡‡— ˆˆˆˆˆˆ ˆfd„}|S )a”  Decorator to indicate a function has been deprecated.

    It should be placed beneath other decorators like `@staticmethod` and property decorators.

    When deprecating a class, set this decorator on its `__init__` function.

    Args:
        since: The version the deprecation started at. If the deprecation is pending, set
            the version to when that started; but later, when switching from pending to
            deprecated, update ``since`` to the new version.
        additional_msg: Put here any additional information, such as what to use instead.
            For example, "Instead, use the function ``new_func`` from the module
            ``<my_module>.<my_submodule>``, which is similar but uses GPU acceleration."
        pending: Set to ``True`` if the deprecation is still pending.
        package_name: The PyPI package name, e.g. "qiskit-nature".
        removal_timeline: How soon can this deprecation be removed? Expects a value
            like "no sooner than 6 months after the latest release" or "in release 9.99".
        is_property: If the deprecated function is a `@property`, set this to True so that the
            generated message correctly describes it as such. (This isn't necessary for
            property setters, as their docstring is ignored by Python.)
        stacklevel: Stack level passed to :func:`warnings.warn`.
    Returns:
        Callable: The decorated callable.
    c                ód  •‡ ‡‡— ‰ j         }‰ j        }‰	r
d|› d|› d�}nDd|v r7‰ j        dk    r"|d t          d¦  «         …         }d|› d|› d�}nd|› d|› d�}n	d	|› d|› d�}t	          |‰
‰‰‰‰¬
¦  «        \  ŠŠt          j        ‰ ¦  «        ˆˆ ˆˆfd„¦   «         }t          |‰‰‰¬¦  «         |S )NzThe property ``ú.ú``Ú__init__z	.__init__zThe class ``zThe method ``z()``zThe function ``©Údeprecated_entityr   r   r
   r	   r   c                 óB   •— t          j        ‰‰‰¬¦  «          ‰| i |¤ŽS ©N©Úcategoryr   ©ÚwarningsÚwarn©ÚargsÚkwargsr   ÚfuncÚmsgr   s     €€€€úN/granary/edev/quantum/lib/python3.11/site-packages/qiskit/utils/deprecation.pyÚwrapperz2deprecate_func.<locals>.decorator.<locals>.wrapper^   ó/   ø€ åŒM˜#¨¸ZÐHÑHÔHÐHØ�4˜Ð( Ð(Ð(Ð(ó    ©r   r
   )Ú__qualname__Ú
__module__Ú__name__ÚlenÚ_write_deprecation_msgÚ	functoolsÚwrapsÚadd_deprecation_to_docstring)r%   ÚqualnameÚmod_namer   Úcls_namer(   r   r&   r	   r   r   r
   r   r   r   s   `     @@€€€€€€€r'   Ú	decoratorz!deprecate_func.<locals>.decorator;   sJ  øøøø€ ØÔ$ˆØ”?ˆð ð 	Lð !J°(Ð IÐ I¸XÐ IÐ IÐ IÐÐð �Hˆ_ˆ_ØŒ} 
Ò*Ð*Ø#Ð$7¥s¨;Ñ'7Ô'7Ð&7Ð$7Ô8�Ø$J°8Ð$JÐ$J¸hÐ$JÐ$JÐ$JÐ!Ð!à$M°HÐ$MÐ$M¸xÐ$MÐ$MÐ$MÐ!Ð!à K°(Ð KÐ K¸XÐ KÐ KÐ KÐå.Ø/Ø%ØØØ)Ø-ð
ñ 
ô 
‰ˆˆXõ 
Œ˜Ñ	Ô	ð	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ñ 
Ô	ð	)õ 	% W¨c¸ÈÐPÑPÔPÐPØˆr*   © )r   r	   r
   r   r   r   r   r7   s   ``````` r'   Údeprecate_funcr9      sJ   øøøøøøø€ ðF)ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ðV Ðr*   )r	   Údeprecation_descriptionr
   r   Ú	new_aliasÚ	predicater   Únamer:   r;   r<   úCallable[[Any], bool] | Nonec          	     ó2   ‡ ‡‡‡‡‡‡‡‡— ˆˆˆ ˆˆˆˆˆˆf	d„}	|	S )a¡  Decorator to indicate an argument has been deprecated in some way.

    This decorator may be used multiple times on the same function, once per deprecated argument.
    It should be placed beneath other decorators like ``@staticmethod`` and property decorators.

    Args:
        name: The name of the deprecated argument.
        since: The version the deprecation started at. If the deprecation is pending, set
            the version to when that started; but later, when switching from pending to
            deprecated, update `since` to the new version.
        deprecation_description: What is being deprecated? E.g. "Setting my_func()'s `my_arg`
            argument to `None`." If not set, will default to "{func_name}'s argument `{name}`".
        additional_msg: Put here any additional information, such as what to use instead
            (if new_alias is not set). For example, "Instead, use the argument `new_arg`,
            which is similar but does not impact the circuit's setup."
        pending: Set to `True` if the deprecation is still pending.
        package_name: The PyPI package name, e.g. "qiskit-nature".
        new_alias: If the arg has simply been renamed, set this to the new name. The decorator will
            dynamically update the `kwargs` so that when the user sets the old arg, it will be
            passed in as the `new_alias` arg.
        predicate: Only log the runtime warning if the predicate returns True. This is useful to
            deprecate certain values or types for an argument, e.g.
            `lambda my_arg: isinstance(my_arg, dict)`. Regardless of if a predicate is set, the
            runtime warning will only log when the user specifies the argument.
        removal_timeline: How soon can this deprecation be removed? Expects a value
            like "no sooner than 6 months after the latest release" or "in release 9.99".

    Returns:
        Callable: The decorated callable.
    c           	     ó&  •	‡ ‡‡‡‡— ‰ j         › d‰ j        › d�Š‰
pd‰› d‰› d�}‰rd‰› d�}‰	r|› d‰	› �}n|}n‰	}t          |‰‰‰|‰¬¦  «        \  ŠŠt          j        ‰ ¦  «        ˆˆ ˆˆˆˆˆˆfd	„¦   «         Št          ‰ d
¦  «        r‰ j        ‰_        nh‰ j        j        ‰_        d„ t          j
        ‰ ¦  «        j                             ¦   «         D ¦   «         }t          j        j        |v rt          d¦  «        ‚t!          ‰‰‰‰¬¦  «         ‰S )Nr   z()r   z``'s argument ``zInstead, use the argument ``z``, which behaves identically.z. r   c                 óN   •— t          | |‰‰	j        ‰‰‰‰‰¬¦	  «	          ‰| i |¤ŽS ©N)Ú	func_nameÚoriginal_func_co_varnamesÚold_arg_namer;   Úwarning_msgr   r<   )Ú_maybe_warn_and_rename_kwargÚ__original_func_co_varnames)
r#   r$   r   r%   rC   r&   r=   r;   r<   r(   s
     €€€€€€€€r'   r(   z1deprecate_arg.<locals>.decorator.<locals>.wrapper«   sO   ø€ å(ØØØ#Ø*1Ô*MØ!Ø#ØØ!Ø#ð
ñ 
ô 
ð 
ð �4˜Ð( Ð(Ð(Ð(r*   rH   c                ó   — h | ]	}|j         ’Œ
S r8   ©Úkind©Ú.0Úparams     r'   ú	<setcomp>z3deprecate_arg.<locals>.decorator.<locals>.<setcomp>Ã   ó   € Ð_Ð_Ð_¨%˜5œ:Ð_Ð_Ð_r*   úl@deprecate_arg cannot be used with functions that take variable *args. Use warnings.warn() directly instead.r+   )r-   r,   r0   r1   r2   ÚhasattrrH   Ú__code__Úco_varnamesÚinspectÚ	signatureÚ
parametersÚvaluesÚ	ParameterÚVAR_POSITIONALÚ
ValueErrorr3   )r%   r   Ú	alias_msgÚfinal_additional_msgÚparam_kindsr   rC   r&   r(   r	   r:   r=   r;   r   r
   r<   r   r   s   `    @@@@€€€€€€€€€r'   r7   z deprecate_arg.<locals>.decorator”   s©  øøøøøø€ à”Ð>Ð>¨Ô):Ð>Ð>Ð>ˆ	Ø3Ð_Ð7_¸IÐ7_Ð7_ÐW[Ð7_Ð7_Ð7_Ðàð 	2Ø`°yÐ`Ð`Ð`ˆIØð 1Ø*3Ð'GÐ'G°~Ð'GÐ'GÐ$Ð$à'0Ð$Ð$à#1Ð å.Ø/Ø%ØØØ/Ø-ð
ñ 
ô 
‰ˆˆXõ 
Œ˜Ñ	Ô	ð	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ñ 
Ô	ð	)õ& �4Ð6Ñ7Ô7ð 		Ø26Ô2RˆGÔ/Ð/à26´-Ô2KˆGÔ/Ø_Ð_µ7Ô3DÀTÑ3JÔ3JÔ3U×3\Ò3\Ñ3^Ô3^Ð_Ñ_Ô_ˆKÝÔ Ô/°;Ð>Ð>Ý ð8ñô ð õ
 	% W¨c¸ÈÐPÑPÔPÐPØˆr*   r8   )
r=   r   r	   r:   r
   r   r;   r<   r   r7   s
   ````````` r'   Údeprecate_argr_   i   sV   øøøøøøøøø€ ðV7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ð 7ðr Ðr*   )r   Ú	kwarg_mapúdict[str, str | None]r   úType[Warning]c               ó   ‡ ‡‡— ˆˆ ˆfd„}|S )aN  Deprecated. Instead, use `@deprecate_arg`.

    Args:
        kwarg_map: A dictionary of the old argument name to the new name.
        category: Usually either DeprecationWarning or PendingDeprecationWarning.
        since: The version the deprecation started at. Only Optional for backwards
            compatibility - this should always be set. If the deprecation is pending, set
            the version to when that started; but later, when switching from pending to
            deprecated, update `since` to the new version.

    Returns:
        Callable: The decorated callable.
    c           
     óP  •‡ ‡‡‡— ‰ j         Ši Š‰
                     ¦   «         D ]\  }}|€dnd|› d�}‰› d|› d|› �‰|<   Œt          j        ‰ ¦  «        ˆ	ˆ ˆˆ
ˆˆfd„¦   «         Št	          ‰ d¦  «        r‰ j        ‰_        nh‰ j        j        ‰_        d„ t          j	        ‰ ¦  «        j
                             ¦   «         D ¦   «         }t          j        j        |v rt          d	¦  «        ‚‰                     ¦   «         D ](}t          ‰|‰t!          ‰	t"          ¦  «        ¬
¦  «         Œ)‰S )Nzwill in the future be removed.zreplaced with r   z keyword argument z is deprecated and c                 óŽ   •— ‰                      ¦   «         D ](\  }}t          | |‰‰	j        ||‰|         ‰d ¬¦	  «	         Œ) ‰| i |¤ŽS rB   )ÚitemsrG   rH   )
r#   r$   ÚoldÚnewr   r%   rC   r`   Úold_kwarg_to_msgr(   s
       €€€€€€r'   r(   z7deprecate_arguments.<locals>.decorator.<locals>.wrapperï   sv   ø€ à%ŸOšOÑ-Ô-ð ð ‘��SÝ,ØØØ'Ø.5Ô.QØ!$Ø!Ø 0°Ô 5Ø%Ø"ð
ñ 
ô 
ð 
ð 
ð �4˜Ð( Ð(Ð(Ð(r*   rH   c                ó   — h | ]	}|j         ’Œ
S r8   rJ   rL   s     r'   rO   z9deprecate_arguments.<locals>.decorator.<locals>.<setcomp>  rP   r*   rQ   r+   )r,   rf   r1   r2   rR   rH   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r3   Ú
issubclassÚPendingDeprecationWarning)r%   Úold_argÚnew_argÚ
msg_suffixr^   r&   rC   ri   r(   r   r`   r   s   `     @@@€€€r'   r7   z&deprecate_arguments.<locals>.decoratorä   sœ  øøøøø€ ØÔ%ˆ	ØÐØ )§¢Ñ 1Ô 1ð 	ð 	ÑˆG�Wà4;°OÐ0Ð0ÐIdÐZaÐIdÐIdÐIdð ð ÐXÐX°ÐXÐXÈJÐXÐXð ˜WÑ%Ð%õ 
Œ˜Ñ	Ô	ð	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ñ 
Ô	ð	)õ( �4Ð6Ñ7Ô7ð 		Ø26Ô2RˆGÔ/Ð/à26´-Ô2KˆGÔ/Ø_Ð_µ7Ô3DÀTÑ3JÔ3JÔ3U×3\Ò3\Ñ3^Ô3^Ð_Ñ_Ô_ˆKÝÔ Ô/°;Ð>Ð>Ý ð8ñô ð ð
 $×*Ò*Ñ,Ô,ð 	ð 	ˆCÝ(Ø˜ Eµ:¸hÕHaÑ3bÔ3bðñ ô ð ð ð ˆr*   r8   )r`   r   r   r7   s   ``` r'   Údeprecate_argumentsrp   Ð   s1   øøø€ ð(/ð /ð /ð /ð /ð /ð /ðb Ðr*   r&   c               ó   ‡ ‡‡‡— ˆˆ ˆˆfd„}|S )ay  Deprecated. Instead, use `@deprecate_func`.

    Args:
        msg: Warning message to emit.
        stacklevel: The warning stacklevel to use, defaults to 2.
        category: Usually either DeprecationWarning or PendingDeprecationWarning.
        since: The version the deprecation started at. Only Optional for backwards
            compatibility - this should always be set. If the deprecation is pending, set
            the version to when that started; but later, when switching from pending to
            deprecated, update `since` to the new version.

    Returns:
        Callable: The decorated, deprecated callable.
    c           	     óš   •‡ — t          j        ‰ ¦  «        ˆˆ ˆˆfd„¦   «         }t          |‰‰t          ‰t          ¦  «        ¬¦  «         |S )Nc                 óB   •— t          j        ‰‰‰¬¦  «          ‰| i |¤ŽS r   r   r"   s     €€€€r'   r(   z6deprecate_function.<locals>.decorator.<locals>.wrapper/  r)   r*   r+   )r1   r2   r3   rk   rl   )r%   r(   r   r&   r   r   s   ` €€€€r'   r7   z%deprecate_function.<locals>.decorator.  su   øø€ Ý	Œ˜Ñ	Ô	ð	)ð 	)ð 	)ð 	)ð 	)ð 	)ð 	)ñ 
Ô	ð	)õ 	%Ø�S ­z¸(ÕD]Ñ/^Ô/^ð	
ñ 	
ô 	
ð 	
ð ˆr*   r8   )r&   r   r   r   r7   s   ```` r'   Údeprecate_functionrt     s6   øøøø€ ð,	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð Ðr*   r#   útuple[Any, ...]r$   údict[str, Any]rC   rD   útuple[str, ...]rE   rF   ÚreturnÚNonec               ó  — d„ t          | |¦  «        D ¦   «         }	|	                     |¦  «         ||	vrd S |r||	v rt          |› d|› d|› d�¦  «        ‚|	|         }
|r ||
¦  «        sd S t          j        ||d¬¦  «         |�|
||<   d S d S )Nc                ó   — i | ]\  }}||“Œ	S r8   r8   )rM   Úvalr=   s      r'   ú
<dictcomp>z0_maybe_warn_and_rename_kwarg.<locals>.<dictcomp>K  s   € Ð[Ð[Ð[©¨¨d˜4 Ð[Ð[Ð[r*   z received both z and z (deprecated).é   r   )ÚzipÚupdateÚ	TypeErrorr    r!   )r#   r$   rC   rD   rE   r;   rF   r   r<   Úarg_names_to_valuesr|   s              r'   rG   rG   <  sá   € ð \Ð[µc¸$Ð@YÑ6ZÔ6ZÐ[Ñ[Ô[ÐØ×Ò˜vÑ&Ô&Ð&àÐ.Ð.Ð.ØˆØð c�YÐ"5Ð5Ð5Ý˜9ÐaÐa°YÐaÐaÀ\ÐaÐaÐaÑbÔbÐbà
˜lÔ
+€CØð ˜˜ 3™œð ØˆÝ„M�+¨¸QÐ?Ñ?Ô?Ð?ð ÐØˆˆyÑÐÐð Ðr*   r   úFtuple[str, Type[DeprecationWarning] | Type[PendingDeprecationWarning]]c           
     ó~   — |rt           }d}d|› �}nt          }d}d|› �}| › d|› d|› d|› d|› d	�
}	|r|	d|› �z  }	|	|fS )
Nzpending deprecationz8marked deprecated in a future release, and then removed Ú
deprecatedzremoved z is z as of ú z. It will be r   )rl   ÚDeprecationWarning)
r   r   r   r
   r	   r   r   Údeprecation_statusÚremoval_descr&   s
             r'   r0   r0   ^  s·   € ð ð 	5å%ð 	ð 3ÐØdÐRbÐdÐdˆˆå%ˆØ)ÐØ4Ð"2Ð4Ð4ˆð ð 	&ð 	&Ð"4ð 	&ð 	&¸\ð 	&ð 	&ÈEð 	&ð 	&Ø"ð	&ð 	&ð 	&ð ð ð $ØÐ#�>Ð#Ð#Ñ#ˆØ�ˆ=Ðr*   >   útip:úargs:úhint:únote:útodo:úwarn:úerror:únotes:úwarns:úyield:údanger:úraises:úreturn:úyields:úcaution:úexample:úreturns:úwarning:ú	examples:ú	see also:ú	warnings:ú
arguments:ú
attention:ú
important:úattributes:úparameters:úreferences:úkeyword args:úother parameters:úkeyword arguments:r%   r   c               ó’  — d|v rt          d| j        › d�¦  «        ‚|€d}n	|r|› d�n|}d}d}| j        rÀ| j                             ¦   «         }d}t	          |¦  «        D ]”\  }	}
|
                     ¦   «         }|s@|	d	k    r:|r8t          |
¦  «        t          |
                     ¦   «         ¦  «        z
  }d
|z  }d}|                     ¦   «         t          v r|	}|st          d| j        › d�¦  «        ‚ nŒ•ng }||› d|› �|› d|› �|g}|r|||dz
  |dz
  …<   n| 
                    |¦  «         d                     |¦  «        | _        dS )a  Dynamically insert the deprecation message into ``func``'s docstring.

    Args:
        func: The function to modify.
        msg: The full deprecation message.
        since: The version the deprecation started at.
        pending: Is the deprecation still pending?
    ú
zNDeprecation messages cannot contain new lines (`\n`), but the deprecation for aY   had them. Usually this happens when using `"""` multiline strings; instead, use string concatenation.

This is a simplification to facilitate deprecation messages being added to the documentation. If you have a compelling reason to need new lines, feel free to improve this function or open a request at https://github.com/Qiskit/qiskit/issues.NÚunknownÚ_pendingÚ Fr   r†   Tz«add_deprecation_to_docstring cannot currently handle when a Napoleon metadata line like 'Args' is the very first line of docstring, e.g. `"""Args:`. So, it cannot process zF. Instead, move the metadata line to the second line, e.g.:

"""
Args:z.. deprecated:: z  é   )r[   r,   Ú__doc__Ú
splitlinesÚ	enumerateÚstripr/   ÚlstripÚlowerÚ_NAPOLEON_META_LINESÚextendÚjoin)r%   r&   r   r
   Úversion_strÚindentÚ
meta_indexÚoriginal_linesÚcontent_encounteredÚiÚlineÚstrippedÚnum_leading_spacesÚ	new_liness                 r'   r3   r3   ¢  sã  € ð ˆs€{€{Ýð7ØÔ ð7ð 7ð 7ñ
ô 
ð 	
ð €}Øˆˆà,3Ð>˜Ð(Ð(Ð(Ð(¸ˆà€FØ€JØ„|ð Øœ×0Ò0Ñ2Ô2ˆØ#ÐÝ  Ñ0Ô0ð 	ð 	‰GˆAˆtØ—z’z‘|”|ˆHð
 'ð +¨1°ª6¨6°h¨6Ý%(¨¡Y¤Yµ°T·[²[±]´]Ñ1CÔ1CÑ%CÐ"ØÐ1Ñ1�Ø&*Ð#à�~Š~ÑÔÕ#7Ð7Ð7Ø�
Ø*ð Ý$ðZàBFÔBSðZð Zð Zñô ð ð �ð 8øð ˆð 	ØÐ0Ð0 ;Ð0Ð0ØÐÐ�SÐÐØð	€Ið ð )Ø:Cˆ�z A‘~¨
°Q©Ð6Ñ7Ð7à×Ò˜iÑ(Ô(Ð(Ø—9’9˜^Ñ,Ô,€D„L€L€Lr*   )r   r   r	   r   r
   r   r   r   r   r   r   r   r   r   )r=   r   r   r   r	   r   r:   r   r
   r   r   r   r;   r   r<   r>   r   r   )r`   ra   r   rb   r   r   )r&   r   r   r   r   rb   r   r   )r#   ru   r$   rv   rC   r   rD   rw   rE   r   r;   r   rF   r   r   rb   r<   r>   rx   ry   )r   r   r   r   r   r   r
   r   r	   r   r   r   rx   rƒ   )
r%   r   r&   r   r   r   r
   r   rx   ry   )r®   Ú
__future__r   r1   rU   r    Úcollections.abcr   Útypingr   r   r9   r_   r‡   rp   rt   rG   r0   Ú	frozensetr´   r3   r8   r*   r'   ú<module>rÅ      s´  ðð Ð à "Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ø €€€Ø €€€Ø $Ð $Ð $Ð $Ð $Ð $Ø Ð Ð Ð Ð Ð Ð Ð ð "&ØØ ØMØØðNð Nð Nð Nð Nð Nðj "&Ø*.ØØ Ø Ø.2ØMðdð dð dð dð dð dðR 1ðEð ð	Eð Eð Eð Eð Eð EðT Ø0ð!ð
 ð!ð !ð !ð !ð !ð !ðH ð  ð  ð  ðDð ð ð ð@ !�yðð ð ñ!ô !Ð ðHH-ð H-ð H-ð H-ð H-ð H-r*   