
    iJ                         S r SSKrSSKrSSKJrJrJrJrJr  SSK	J
r
  \" SSS9r\" SS	S9r\" S
SS9r " S S5      r " S S	5      r " S S5      r " S S\5      rg)zBackend Configuration Classes.    N)DictListAnyTypeVarType)QiskitErrorGateConfigT
GateConfig)boundUchannelLOT
UchannelLOQasmBackendConfigurationTQasmBackendConfigurationc                       \ rS rSrSr    SS\S\\   S\S\S\S	\S
\4S jjr	\
S\\   S\\\4   S\4S j5       rS\\\4   4S jrS\S\4S jrS\4S jrSrg)r
      a  Class representing a Gate Configuration

Attributes:
    name: the gate name as it will be referred to in OpenQASM.
    parameters: variable names for the gate parameters (if any).
    qasm_def: definition of this gate in terms of OpenQASM 2 primitives U
              and CX.
Nname
parametersqasm_defcoupling_maplatency_mapconditionaldescriptionc                     Xl         X l        X0l        U(       a  X@l        U(       a  XPl        Ub  X`l        Ub  Xpl        gg)a?  Initialize a GateConfig object

Args:
    name (str): the gate name as it will be referred to in OpenQASM.
    parameters (list): variable names for the gate parameters (if any)
                       as a list of strings.
    qasm_def (str): definition of this gate in terms of OpenQASM 2 primitives U and CX.
    coupling_map (list): An optional coupling map for the gate. In
        the form of a list of lists of integers representing the qubit
        groupings which are coupled by this gate.
    latency_map (list): An optional map of latency for the gate. In the
        the form of a list of lists of integers of either 0 or 1
        representing an array of dimension
        len(coupling_map) X n_registers that specifies the register
        latency (1: fast, 0: slow) conditional operations on the gate
    conditional (bool): Optionally specify whether this gate supports
        conditional operations (true/false). If this is not specified,
        then the gate inherits the conditional property of the backend.
    description (str): Description of the gate operation
N)r   r   r   r   r   r   r   )selfr   r   r   r   r   r   r   s           i/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_ibm_runtime/models/backend_configuration.py__init__GateConfig.__init__$   sB    > 	$  ,*"*"* #    clsdatareturnc                     U " S0 UD6$ )a   Create a new GateConfig object from a dictionary.

Args:
    data (dict): A dictionary representing the GateConfig to create.
                 It will be in the same format as output by
                 :func:`to_dict`.

Returns:
    GateConfig: The GateConfig from the input dictionary.
 r#   r   r    s     r   	from_dictGateConfig.from_dictQ        {T{r   c                 N   U R                   U R                  U R                  S.n[        U S5      (       a  U R                  US'   [        U S5      (       a  U R
                  US'   [        U S5      (       a  U R                  US'   [        U S5      (       a  U R                  US'   U$ )xReturn a dictionary format representation of the GateConfig.

Returns:
    dict: The dictionary form of the GateConfig.
)r   r   r   r   r   r   r   )r   r   r   hasattrr   r   r   r   r   out_dicts     r   to_dictGateConfig.to_dict_   s     II//$

 4(('+'8'8H^$4''&*&6&6H]#4''&*&6&6H]#4''&*&6&6H]#r   otherc                 t    [        U[        5      (       a#  U R                  5       UR                  5       :X  a  ggNTF)
isinstancer
   r-   r   r/   s     r   __eq__GateConfig.__eq__t   )    eZ((||~0r   c           	          SU R                    SU R                   SU R                   3nS H/  n[        X5      (       d  M  US[	        [        X5      5      -   -  nM1     US-  nU$ )NzGateConfig(, )r   r   r   r   ))r   r   r   r*   reprgetattr)r   out_stris      r   __repr__GateConfig.__repr__z   sf    		{"T__,=RONAt4$wt'7"888 O 	3r   )r   r   r   r   r   r   r   )NNNN)__name__
__module____qualname____firstlineno____doc__strr   listboolr   classmethodr   r	   r   r   r%   r-   r4   r>   __static_attributes__r#   r   r   r
   r
      s     "  ++++ I++ 	++
 ++ ++ ++ ++Z tK( S#X ;  c3h *C D # r   c                       \ rS rSrSrS\S\SS4S jr\S\	\
   S	\\\4   S\
4S
 j5       rS\\\4   4S jrS\S\4S jrS\4S jrSrg)r      zClass representing a U Channel LO

Attributes:
    q: Qubit that scale corresponds too.
    scale: Scale factor for qubit frequency.
qscaler!   Nc                 >    US:  a  [        S5      eXl        X l        g)zInitialize a UchannelLOSchema object

Args:
    q (int): Qubit that scale corresponds too. Must be >= 0.
    scale (complex): Scale factor for qubit frequency.

Raises:
    QiskitError: If q is < 0
r   zq must be >=0N)r   rL   rM   )r   rL   rM   s      r   r   UchannelLO.__init__   s      q5o..
r   r   r    c                     U " S0 UD6$ )a  Create a new UchannelLO object from a dictionary.

Args:
    data (dict): A dictionary representing the UChannelLO to
        create. It will be in the same format as output by
        :func:`to_dict`.

Returns:
    UchannelLO: The UchannelLO from the input dictionary.
r#   r#   r$   s     r   r%   UchannelLO.from_dict   r'   r   c                 8    U R                   U R                  S.nU$ )zxReturn a dictionary format representation of the UChannelLO.

Returns:
    dict: The dictionary form of the UChannelLO.
rL   rM   rS   r+   s     r   r-   UchannelLO.to_dict   s      ZZ$
 r   r/   c                 t    [        U[        5      (       a#  U R                  5       UR                  5       :X  a  ggr1   )r2   r   r-   r3   s     r   r4   UchannelLO.__eq__   r6   r   c                 <    SU R                    SU R                   S3$ )NzUchannelLO(r8   r9   rS   r   s    r   r>   UchannelLO.__repr__   s    TVVHBtzzl!44r   rS   )r@   rA   rB   rC   rD   intcomplexr   rH   r   r   r   rE   r   r%   r-   rG   r4   r>   rI   r#   r   r   r   r      s    # g $  tK( S#X ;  
c3h 
C D 5# 5r   c            C          \ rS rSr% Sr0 r\\\4   \S'                        S4S\	S\	S\
S\S	\S
\S\S\S\S\S\S\\
   S\\	   S\\	   S\S\\	   S\S\\   S\S\	S\
S\S\S\S\R                  S\	S\	S \S!\S"\S#\S$\S%\4BS& jjrS'\	S(\4S) jr\S*\\   S+\\	\4   S(\4S, j5       rS(\\	\4   4S- jr\S(\
4S. j5       rS/\S(\4S0 jrS1\	S(\4S2 jrS3rg)5r      a  Class representing an OpenQASM 2.0 Backend Configuration.

Attributes:
    backend_name: backend name.
    backend_version: backend version in the form X.Y.Z.
    n_qubits: number of qubits.
    basis_gates: list of basis gates names on the backend.
    gates: list of basis gates on the backend.
    local: backend is local or remote.
    simulator: backend is a simulator.
    conditional: backend supports conditional operations.
    open_pulse: backend supports open pulse.
    memory: backend supports memory.
_dataNbackend_namebackend_versionn_qubitsbasis_gatesgateslocal	simulatorr   
open_pulsememoryr   meas_levelsmeas_kernelsdiscriminatorsmeas_mapsupported_instructionsdynamic_reprate_enabledrep_delay_rangedefault_rep_delaysample_namen_registersregister_mapconfigurablecredits_requiredonline_datedisplay_namer   tagsdtdtmprocessor_typeparametric_pulseskwargsc!                    0 U l         Xl        X l        X0l        X@l        XPl        X`l        Xpl        Xl        Xl	        Xl
        Xl        Xl        Xl        Xl        Ub  Xl        U(       a  UU l        UU l        U(       a  U V"s/ s H  n"U"S-  PM
     sn"U l        Ub
  US-  U l        Ub  UU l        U(       a  SU l        U(       a  UU l        Ub  UU l        Ub  UU l        Ub  UU l        Ub  UU l        Ub  UU l        Ub  UU l        Ub
  US-  U l        Ub
  US-  U l        Ub  UU l        U b  U U l         SU!;   a&  U!S    V#V$s/ s H  u  n#n$U#S-  U$S-  /PM     sn$n#U!S'   SU!;   a&  U!S    V#V$s/ s H  u  n#n$U#S-  U$S-  /PM     sn$n#U!S'   SU!;   a  U!S    V%s/ s H  n%U%S-  PM
     sn%U!S'   U R                   RC                  U!5        gs  sn"f s  sn$n#f s  sn$n#f s  sn%f )	u	  Initialize a QasmBackendConfiguration Object

Args:
    backend_name (str): The backend name
    backend_version (str): The backend version in the form X.Y.Z
    n_qubits (int): the number of qubits for the backend
    basis_gates (list): The list of strings for the basis gates of the
        backends
    gates (list): The list of GateConfig objects for the basis gates of
        the backend
    local (bool): True if the backend is local or False if remote
    simulator (bool): True if the backend is a simulator
    conditional (bool): True if the backend supports conditional
        operations
    open_pulse (bool): True if the backend supports OpenPulse
    memory (bool): True if the backend supports memory
    coupling_map (list): The coupling map for the device
    meas_levels: Supported measurement levels.
    meas_kernels: Supported measurement kernels.
    discriminators: Supported discriminators.
    meas_map (list): Grouping of measurement which are multiplexed
    supported_instructions (List[str]): Instructions supported by the backend.
    dynamic_reprate_enabled (bool): whether delay between programs can be set dynamically
        (ie via ``rep_delay``). Defaults to False.
    rep_delay_range (List[float]): 2d list defining supported range of repetition
        delays for backend in μs. First entry is lower end of the range, second entry is
        higher end of the range. Optional, but will be specified when
        ``dynamic_reprate_enabled=True``.
    default_rep_delay (float): Value of ``rep_delay`` if not specified by user and
        ``dynamic_reprate_enabled=True``.
    sample_name (str): Sample name for the backend
    n_registers (int): Number of register slots available for feedback
        (if conditional is True)
    register_map (list): An array of dimension n_qubits X
        n_registers that specifies whether a qubit can store a
        measurement in a certain register slot.
    configurable (bool): True if the backend is configurable, if the
        backend is a simulator
    credits_required (bool): True if backend requires credits to run a
        job.
    online_date (datetime.datetime): The date that the device went online
    display_name (str): Alternate name field for the backend
    description (str): A description for the backend
    tags (list): A list of string tags to describe the backend
    dt (float): Qubit drive channel timestep in nanoseconds.
    dtm (float): Measurement drive channel timestep in nanoseconds.
    processor_type (dict): Processor type for this backend. A dictionary of the
        form ``{"family": <str>, "revision": <str>, segment: <str>}`` such as
        ``{"family": "Canary", "revision": "1.0", segment: "A"}``.

        - family: Processor family of this backend.
        - revision: Revision version of this processor.
        - segment: Segment this processor belongs to within a larger chip.
    parametric_pulses (list): A list of pulse shapes which are supported on the backend.
        For example: ``['gaussian', 'constant']``

    **kwargs: optional fields
Ngư>   &.>qubit_lo_range    eAmeas_lo_range	rep_times)"r^   r_   r`   ra   rb   rc   rd   re   r   rf   rg   r   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   r   rw   rx   ry   rz   r{   update)&r   r_   r`   ra   rb   rc   rd   re   r   rf   rg   r   rh   ri   rj   rk   rl   rm   rn   ro   rp   rq   rr   rs   rt   ru   rv   r   rw   rx   ry   rz   r{   r|   _rd	min_range	max_range_rts&                                         r   r   !QasmBackendConfiguration.__init__   sB   | 
(. &

"&$(&(,$M!*@D''>$:I#J/3C$J/#JD (%6%=D""*D D ,D# ,D'$4D!"*D# ,D"*DDI >4iDG?TzDH%"0D(%6D" v% /55E.F(.F*Y	 S)c/2.F(F#$
 f$ /5_.E'.E*Y	 S)c/2.E'F?# & 9?9L"M9L#3:9L"MF;

&!i $KJ(' #Ns   GG3GG r   r!   c                 f     U R                   U   $ ! [         a  n[        SU S35      UeS nAff = f)Nz
Attribute z is not defined)r^   KeyErrorAttributeError)r   r   exs      r   __getattr__$QasmBackendConfiguration.__getattr__{  s?    	M::d## 	M :dV?!CD"L	Ms    
0+0r   r    c                     [         R                   " U5      nUR                  S5       Vs/ s H  n[        R                  U5      PM     nnXBS'   U " S0 UD6$ s  snf )a  Create a new GateConfig object from a dictionary.

Args:
    data (dict): A dictionary representing the GateConfig to create.
                 It will be in the same format as output by
                 :func:`to_dict`.
Returns:
    GateConfig: The GateConfig from the input dictionary.
rc   r#   )copypopr
   r%   )r   r    in_dataxrc   s        r   r%   "QasmBackendConfiguration.from_dict  sU     #'))D/29++g2FG2FQ%%a(2FG ~W~ Hs   Ac                    U R                   U R                  U R                  U R                  U R                   Vs/ s H  oR                  5       PM     snU R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  U R                  S.n[!        U S5      (       a  U R"                  US'   [!        U S5      (       a  U R$                  US'   [!        U S5      (       a"  U R&                   Vs/ s H  o3S-  PM	     snUS'   [!        U S5      (       a  U R(                  S-  US'   S H"  n[!        X5      (       d  M  [+        X5      X$'   M$     UR-                  U R.                  5        SU;   a  US==   S	-  ss'   S
U;   a  US
==   S	-  ss'   SU;   a%  US    VVs/ s H  u  pVUS-  US-  /PM     snnUS'   SU;   a%  US    VVs/ s H  u  pVUS-  US-  /PM     snnUS'   SU;   a  US    Vs/ s H  owS-  PM	     snUS'   U$ s  snf s  snf s  snnf s  snnf s  snf )r)   )r_   r`   ra   rb   rc   rd   re   r   rf   rg   r   rm   rh   ri   rj   rk   rl   rn   g    .Aro   )rp   rq   rr   rs   rt   ru   rv   r   rw   rx   ry   rz   r{   rx   r   ry   r   r   r   r   )r_   r`   ra   rb   rc   r-   rd   re   r   rf   rg   r   rm   rh   ri   rj   r*   rk   rl   rn   ro   r;   r   r^   )r   r   r,   r   kwargr   r   r   s           r   r-    QasmBackendConfiguration.to_dict  sg    !--#33+++/::6:aiik:6ZZ++//kk --'+'C'C++ --"11$
" 4$$#'==HZ 4122151L1LH-.4*++@D@T@T*U@T9@T*UH&'4,--,0,B,BS,HH()
E t##")$"6!
$ 	

#8TNc!NHUOs"O x' /77G.H*.H*Y T!9t#34.H*H%&
 h& /7.G).G*Y T!9t#34.G)H_% (":B;:O$P:O33Y:O$PH[!C 7& +V>*) %Qs   H?&II	?I)Ic                     U R                   $ )zReturns the number of qubits.

In future, `n_qubits` should be replaced in favor of `num_qubits` for consistent use
throughout Qiskit. Until this is properly refactored, this property serves as intermediate
solution.
)ra   rX   s    r   
num_qubits#QasmBackendConfiguration.num_qubits  s     }}r   r/   c                 t    [        U[        5      (       a#  U R                  5       UR                  5       :X  a  ggr1   )r2   r   r-   r3   s     r   r4   QasmBackendConfiguration.__eq__  s*    e566||~0r   itemc                     XR                   ;   $ )N)__dict__)r   r   s     r   __contains__%QasmBackendConfiguration.__contains__  s    }}$$r   )!r^   r_   r`   rb   r   rs   r   rt   ro   r   rj   rv   rx   ry   rm   rc   rd   ri   rh   rk   rg   ra   rq   ru   rf   r{   rz   rr   rn   rp   re   rl   rw   )NNNNNFNNNNNNNNNNNNNNN)r@   rA   rB   rC   rD   r^   r   r   __annotations__rE   rZ   rF   rG   r   floatdatetimedictr   r   rH   r   r   r%   r-   propertyr   r4   r   rI   r#   r   r   r   r      s    E4S> "&"&$(,0(-'+#'!!!%)- #"&Ci"i" i" 	i"
 i" i" i" i" i" i" i" i" #Yi" 3ii" S	i"  !i"" !%S	#i"$ "&%i"& e'i"( !)i"* +i", -i". /i"0 1i"2 3i"4 &&5i"6 7i"8 9i": ;i"< =i"> ?i"@ Ai"B  Ci"D Ei"VM M M +,48cN	" "Lc3h L\ C  C D % % %r   c                       \ rS rSrSrSrg)BackendConfigurationi  zEBackwards compat shim representing an abstract backend configuration.r#   N)r@   rA   rB   rC   rD   rI   r#   r   r   r   r     s    Or   r   )rD   r   r   typingr   r   r   r   r   qiskit.exceptionsr   r	   r   r   r
   r   r   r   r#   r   r   <module>r      sr    %   1 1 )m<8m<8#$?Gab f fR85 85vt% t%n		3 	r   