
    z	iu1                         S r SSKJr  SSKJr  SSKrSSKJrJrJr  SSK	J
r
  SSKJr   " S S	5      r " S
 S\\5      rg)z)Backend abstract interface for providers.    )ABC)abstractmethodN)ListUnionTuple)Instruction)QubitPropertiesc                       \ rS rSrSrSrSrg)Backend   a  Base common type for all versioned Backend abstract classes.

Note this class should not be inherited from directly, it is intended
to be used for type checking. When implementing a provider you should use
the versioned abstract classes as the parent class and not this class
directly.
r    N)__name__
__module____qualname____firstlineno____doc__version__static_attributes__r       R/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/providers/backend.pyr   r      s     Gr   r   c            	          \ rS rSrSrSr     SS\S\S\R                  S\4S	 jjr\	S
\
\\\\   4      4S j5       r\	S
\
\   4S j5       r\	S
\
\   4S j5       r\	\S 5       5       r\	S
\4S j5       r\	S 5       r\	S 5       r\	\S 5       5       r\\S 5       5       r\	S
\\S4   4S j5       r\	S
\4S j5       r\	S
\
\
\      4S j5       rS\\\
\   4   S
\\\
\   4   4S jrS r \	S 5       r!\	S 5       r"\S 5       r#Sr$g)	BackendV2'   a  Abstract class for Backends

This abstract class is to be used for all Backend objects created by a
provider. This version differs from earlier abstract Backend classes in
that the configuration attribute no longer exists. Instead, attributes
exposing equivalent required immutable properties of the backend device
are added. For example ``backend.configuration().n_qubits`` is accessible
from ``backend.num_qubits`` now.

The ``options`` attribute of the backend is used to contain the dynamic
user configurable options of the backend. It should be used more for
runtime options that configure how the backend is used. For example,
something like a ``shots`` field for a backend that runs experiments which
would contain an int for how many shots to execute.

A backend object can optionally contain methods named
``get_translation_stage_plugin`` and ``get_scheduling_stage_plugin``. If these
methods are present on a backend object and this object is used for
:func:`~.transpile` or :func:`~.generate_preset_pass_manager` the
transpilation process will default to using the output from those methods
as the scheduling stage and the translation compilation stage. This
enables a backend which has custom requirements for compilation to specify a
stage plugin for these stages to enable custom transformation of
the circuit to ensure it is runnable on the backend. These hooks are enabled
by default and should only be used to enable extra compilation steps
if they are **required** to ensure a circuit is executable on the backend or
have the expected level of performance. These methods are passed no input
arguments and are expected to return a ``str`` representing the method name
which should be a stage plugin (see: :mod:`qiskit.transpiler.preset_passmanagers.plugin`
for more details on plugins). The typical expected use case is for a backend
provider to implement a stage plugin for ``translation`` or ``scheduling``
that contains the custom compilation passes and then for the hook methods on
the backend object to return the plugin name so that :func:`~.transpile` will
use it by default when targetting the backend.

Subclasses of this should override the public method :meth:`run` and the internal
:meth:`_default_options`:

.. automethod:: _default_options
   Nnamedescriptiononline_datebackend_versionc                    U R                  5       U l        Xl        U(       aC  U H!  nXpR                  ;  d  M  [        SU S35      e   U R                  R                  " S0 UD6  X l         X0l         X@l         XPl         SU l	        g)ai  Initialize a BackendV2 based backend

Args:
    provider: An optional backwards reference to the provider
        object that the backend is from
    name: An optional name for the backend
    description: An optional description of the backend
    online_date: An optional datetime the backend was brought online
    backend_version: An optional backend version string. This differs
        from the :attr:`~qiskit.providers.BackendV2.version` attribute
        as :attr:`~qiskit.providers.BackendV2.version` is for the
        abstract :attr:`~qiskit.providers.Backend` abstract interface
        version of the object while ``backend_version`` is for
        versioning the backend itself.
    fields: kwargs for the values to use to override the default
        options.

Raises:
    AttributeError: If a field is specified that's outside the backend's
        options
Options field  is not valid for this backendNr   )
_default_options_options	_providerAttributeErrorupdate_optionsr   r   r   r   _coupling_map)selfproviderr   r   r   r   fieldsfields           r   __init__BackendV2.__init__S   s    > --/!-(>%@^)_``   MM((262	"&2&0.	 "r   returnc                 .    U R                   R                  $ )zRA list of Instruction tuples on the backend of the form ``(instruction, (qubits)``)targetinstructionsr(   s    r   r1   BackendV2.instructions   s     {{'''r   c                 @    [        U R                  R                  5      $ )zSA list of :class:`~qiskit.circuit.Instruction` instances that the backend supports.)listr0   
operationsr2   s    r   r6   BackendV2.operations   s     DKK**++r   c                 @    [        U R                  R                  5      $ )z6A list of instruction names that the backend supports.)r5   r0   operation_namesr2   s    r   r9   BackendV2.operation_names   s     DKK//00r   c                     g)zLA :class:`qiskit.transpiler.Target` object for the backend.

:rtype: Target
Nr   r2   s    r   r0   BackendV2.target   s     	r   c                 .    U R                   R                  $ )z,Return the number of qubits the backend has.)r0   
num_qubitsr2   s    r   r>   BackendV2.num_qubits   s     {{%%%r   c                 r    U R                   c  U R                  R                  5       U l         U R                   $ )z9Return the :class:`~qiskit.transpiler.CouplingMap` object)r'   r0   build_coupling_mapr2   s    r   coupling_mapBackendV2.coupling_map   s1     %!%!?!?!AD!!!r   c                 6    U R                   R                  5       $ )zCReturn the :class:`~qiskit.transpiler.InstructionDurations` object.)r0   	durationsr2   s    r   instruction_durationsBackendV2.instruction_durations   s     {{$$&&r   c                     g)zlThe maximum number of circuits that can be
run in a single job.

If there is no limit this will return None
Nr   r2   s    r   max_circuitsBackendV2.max_circuits   s     	r   c                     g)a:  Return the default options

This method will return a :class:`qiskit.providers.Options`
subclass object that will be used for the default options. These
should be the default parameters to use for the options of the
backend.

Returns:
    qiskit.providers.Options: A options object with
        default values set
Nr   )clss    r   r"   BackendV2._default_options   s     	r   c                 .    U R                   R                  $ )zReturn the system time resolution of input signals

This is required to be implemented if the backend supports Pulse
scheduling.

Returns:
    The input signal timestep in seconds. If the backend doesn't define ``dt``, ``None`` will
    be returned.
)r0   dtr2   s    r   rO   BackendV2.dt   s     {{~~r   c                     [         e)zReturn the system time resolution of output signals

Returns:
    The output signal timestep in seconds.

Raises:
    NotImplementedError: if the backend doesn't support querying the
        output signal timestep
NotImplementedErrorr2   s    r   dtmBackendV2.dtm   s
     "!r   c                     [         e)a3  Return the grouping of measurements which are multiplexed

This is required to be implemented if the backend supports Pulse
scheduling.

Returns:
    The grouping of measurements which are multiplexed

Raises:
    NotImplementedError: if the backend doesn't support querying the
        measurement mapping
rR   r2   s    r   meas_mapBackendV2.meas_map   s
     "!r   qubitc                     U R                   R                  c  [        e[        U[        5      (       a  U R                   R                  U   $ U Vs/ s H  o R                   R                  U   PM     sn$ s  snf )a  Return QubitProperties for a given qubit.

If there are no defined or the backend doesn't support querying these
details this method does not need to be implemented.

Args:
    qubit: The qubit to get the
        :class:`.QubitProperties` object for. This can
        be a single integer for 1 qubit or a list of qubits and a list
        of :class:`.QubitProperties` objects will be
        returned in the same order
Returns:
    The :class:`~.QubitProperties` object for the
    specified qubit. If a list of qubits is provided a list will be
    returned. If properties are missing for a qubit this can be
    ``None``.

Raises:
    NotImplementedError: if the backend doesn't support querying the
        qubit properties
)r0   qubit_propertiesrS   
isinstanceint)r(   rY   qs      r   r[   BackendV2.qubit_properties   sa    8 ;;''/%%eS!!;;//669>?A,,Q/???s   "A5c                     U H-  n[        U R                  U5      (       a  M   [        SU S35      e   U R                  R                  " S0 UD6  g)a`  Set the options fields for the backend

This method is used to update the options of a backend. If
you need to change any of the options prior to running just
pass in the kwarg with the new value for the options.

Args:
    fields: The fields to update the options

Raises:
    AttributeError: If the field passed in is not part of the
        options
r    r!   Nr   )hasattrr#   r%   r&   )r(   r*   r+   s      r   set_optionsBackendV2.set_options  sK     E4==%00$~eW<Z%[\\  	$$.v.r   c                     U R                   $ )zReturn the options for the backend

The options of a backend are the dynamic parameters defining
how the backend is used. These are used to control the :meth:`run`
method.
)r#   r2   s    r   optionsBackendV2.options'  s     }}r   c                     U R                   $ )z_Return the backend provider.

Returns:
    provider: the provider responsible for the backend.
)r$   r2   s    r   r)   BackendV2.provider1  s     ~~r   c                     g)a  Run on the backend.

This method returns a :class:`~qiskit.providers.Job` object
that runs circuits. Depending on the backend this may be either an async
or sync call. It is at the discretion of the provider to decide whether
running should block until the execution is finished or not: the Job
class can handle either situation.

Args:
    run_input (QuantumCircuit or list): An
        individual or a list of :class:`.QuantumCircuit` objects to
        run on the backend.
    options: Any kwarg options to pass to the backend for running the
        config. If a key is also present in the options
        attribute/object then the expectation is that the value
        specified will be used instead of what's set in the options
        object.

Returns:
    Job: The job object for the run
Nr   )r(   	run_inputre   s      r   runBackendV2.run:  s    . 	r   )r'   r#   r$   r   r   r   r   )NNNNN)%r   r   r   r   r   r   strdatetimer,   propertyr   r   r   r]   r1   r6   r9   r   r0   r>   rB   rF   rI   classmethodr"   r   floatrO   rT   rW   r	   r[   rb   re   r)   rk   r   r   r   r   r   r   '   s0   'R G )-#0" 0" 	0"
 &&0" 0"d (d5eCj)@#AB ( ( ,D- , , 1c 1 1    &C & & " " ' '       
E%+& 
 
 
"U 
" 
" "$tCy/ " " @3S	>* @	_ 55	6 @D/&      r   r   )r   abcr   r   rn   typingr   r   r   qiskit.circuit.gater   qiskit._accelerate.targetr	   r   r   r   r   r   <module>rv      s;    0    % % + 5	 	j jr   