§
    º³Ùg;  ã                  ó|   — d 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  G d„ d	ej        ¦  «        Zd
S )z;Reference instruction that is a placeholder for subroutine.é    )Úannotations)ÚParameterExpression)ÚChannel)Ú
PulseErrorÚUnassignedReferenceError)Úinstruction)Údeprecate_pulse_funcc                  óª   ‡ — e Zd ZdZdZdZedˆ fd„¦   «         Zd„ Ze	dd„¦   «         Z
e	dd„¦   «         Ze	dd„¦   «         Ze	dd„¦   «         Zdd„Zˆ xZS )Ú	Referencea¾  Pulse compiler directive that refers to a subroutine.

    If a pulse program uses the same subset of instructions multiple times, then
    using the :class:`~.Reference` class may significantly reduce the memory footprint of
    the program. This instruction only stores the set of strings to identify the subroutine.

    The actual pulse program can be stored in the :attr:`ScheduleBlock.references` of the
    :class:`.ScheduleBlock` that this reference instruction belongs to.

    You can later assign schedules with the :meth:`ScheduleBlock.assign_references` method.
    This allows you to build the main program without knowing the actual subroutine,
    that is supplied at a later time.
    z::ú,ÚnameÚstrÚ
extra_keysc                ót   •— |ft          |¦  «        z   }t          ¦   «                              ||¬¦  «         dS )a–  Create new reference.

        Args:
            name: Name of subroutine.
            extra_keys: Optional. A set of string keys that may be necessary to
                refer to a particular subroutine. For example, when we use
                "sx" as a name to refer to the subroutine of an sx pulse,
                this name might be used among schedules for different qubits.
                In this example, you may specify "q0" in the extra keys
                to distinguish the sx schedule for qubit 0 from others.
                The user can use an arbitrary number of extra string keys to
                uniquely determine the subroutine.
        )Úoperandsr   N)ÚtupleÚsuperÚ__init__)Úselfr   r   Úref_keysÚ	__class__s       €úY/granary/edev/quantum/lib/python3.11/site-packages/qiskit/pulse/instructions/reference.pyr   zReference.__init__,   s<   ø€ ð  �7�U :Ñ.Ô.Ñ.ˆÝ‰Œ×Ò (°ÐÑ6Ô6Ð6Ð6Ð6ó    c           
     óî   — | j         D ]l}t          |t          ¦  «        s t          dt	          |¦  «        › d�¦  «        ‚| j        |v s	| j        |v r#t          d| j        › d| j        › d|› d�¦  «        ‚ŒmdS )zØCalled after initialization to validate instruction data.

        Raises:
            PulseError: When a key is not a string.
            PulseError: When a key in ``ref_keys`` contains the scope delimiter.
        zKeys must be strings. 'z' is not a valid object.ú'z' and 'z' are reserved. 'z' is not a valid key string.N)r   Ú
isinstancer   r   ÚreprÚscope_delimiterÚkey_delimiter)r   Úkeys     r   Ú	_validatezReference._validate?   sº   € ð ”=ð 	ð 	ˆCÝ˜c¥3Ñ'Ô'ð `Ý Ð!^½4À¹9¼9Ð!^Ð!^Ð!^Ñ_Ô_Ð_ØÔ# sÐ*Ð*¨dÔ.@ÀCÐ.GÐ.GÝ ð:˜Ô,ð :ð :°TÔ5Gð :ð :Øð:ð :ð :ñô ð ð /Hð	ð 	r   Úreturnútuple[str, ...]c                ó   — | j         S )z%Returns unique key of the subroutine.)r   ©r   s    r   r   zReference.ref_keysO   s   € ð Œ}Ðr   úint | ParameterExpressionc                ó2   — t          d| j        › d�¦  «        ‚)zDuration of this instruction.úSubroutine is not assigned to ú.©r   r   r%   s    r   ÚdurationzReference.durationT   ó    € õ 'Ð'XÈÌÐ'XÐ'XÐ'XÑYÔYÐYr   útuple[Channel, ...]c                ó2   — t          d| j        › d�¦  «        ‚)z-Returns the channels that this schedule uses.r(   r)   r*   r%   s    r   ÚchannelszReference.channelsY   r,   r   Úsetc                ó   — t          ¦   «         S )z4Parameters which determine the instruction behavior.)r0   r%   s    r   Ú
parameterszReference.parameters^   s   € õ ‰uŒuˆr   c                ó`   — | j         j        › d| j                             | j        ¦  «        › d�S )Nú(ú))r   Ú__name__r   Újoinr   r%   s    r   Ú__repr__zReference.__repr__c   s1   € Ø”.Ô)ÐUÐU¨DÔ,>×,CÒ,CÀDÄMÑ,RÔ,RÐUÐUÐUÐUr   )r   r   r   r   )r"   r#   )r"   r&   )r"   r-   )r"   r0   )r"   r   )r6   Ú
__module__Ú__qualname__Ú__doc__r   r   r	   r   r!   Úpropertyr   r+   r/   r2   r8   Ú__classcell__)r   s   @r   r   r      s  ø€ € € € € ðð ð €Oð €Màð7ð 7ð 7ð 7ð 7ñ Ôð7ð$ð ð ð  ðð ð ñ „Xðð ðZð Zð Zñ „XðZð ðZð Zð Zñ „XðZð ðð ð ñ „XððVð Vð Vð Vð Vð Vð Vð Vr   r   N)r;   Ú
__future__r   Ú"qiskit.circuit.parameterexpressionr   Úqiskit.pulse.channelsr   Úqiskit.pulse.exceptionsr   r   Úqiskit.pulse.instructionsr   Úqiskit.utils.deprecate_pulser	   ÚInstructionr   © r   r   ú<module>rF      sË   ðð BÐ AØ "Ð "Ð "Ð "Ð "Ð "à BÐ BÐ BÐ BÐ BÐ BØ )Ð )Ð )Ð )Ð )Ð )Ø HÐ HÐ HÐ HÐ HÐ HÐ HÐ HØ 1Ð 1Ð 1Ð 1Ð 1Ð 1Ø =Ð =Ð =Ð =Ð =Ð =ðMVð MVð MVð MVð MV�Ô'ñ MVô MVð MVð MVð MVr   