
    i5                        S r SSKJr  SSKJrJrJrJr  SSKrSSK	J
r
  SSKJrJr  SSKJr  SS	KJr  SS
KJr  SSKJr  SSKJr  SSKJr  SSKJr  \R8                  " \5      r " S S5      r " S S\\   \\
5      r g)zSampler primitive.    )annotations)DictOptionalUnionIterableN)BaseSamplerV2)
SamplerPubSamplerPubLike)	BackendV2   )RuntimeJobV2)BasePrimitiveV2)Session)Batch)validate_classical_registers)SamplerOptionsc                      \ rS rSrSrSrSrg)Sampler&   zBase type for Sampler.r    N)__name__
__module____qualname____firstlineno____doc__version__static_attributes__r       T/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_ibm_runtime/sampler.pyr   r   &   s
     Gr   r   c                  h    \ rS rSrSr\rSr  S   SS jjrSS.SS jjr	SS jr
\SS	 j5       rS
rg)	SamplerV2,   a  Class for interacting with Qiskit Runtime Sampler primitive service.

This class supports version 2 of the Sampler interface, which uses different
input and output formats than version 1.

Qiskit Runtime Sampler primitive returns the sampled result according to the
specified output type. For example, it returns a bitstring for each shot
if measurement level 2 (bits) is requested.

The :meth:`run` method can be used to submit circuits and parameters to the Sampler primitive.
   Nc                    U   [         R                  " U 5        [        R                  U 5        [        R                  " XUS9  g)aJ  Initializes the Sampler primitive.

Args:
    mode: The execution mode used to make the primitive query. It can be:

        * A :class:`Backend` if you are using job mode.
        * A :class:`Session` if you are using session execution mode.
        * A :class:`Batch` if you are using batch execution mode.

        Refer to the
        `Qiskit Runtime documentation
        <https://quantum.cloud.ibm.com/docs/guides/execution-modes>`_.
        for more information about the ``Execution modes``.

    options: Sampler options, see :class:`SamplerOptions` for detailed description.

)modeoptionsN)r   __init__r   r   )selfr%   r&   s      r   r'   SamplerV2.__init__=   s3    , 	t$  'Br   )shotsc                   U Vs/ s H  n[         R                  " X25      PM     nn[        U5        U R                  U5      $ s  snf )aL  Submit a request to the sampler primitive.

Args:
    pubs: An iterable of pub-like objects. For example, a list of circuits
          or tuples ``(circuit, parameter_values)``.
    shots: The total number of shots to sample for each sampler pub that does
           not specify its own shots. If ``None``, the primitive's default
           shots value will be used, which can vary by implementation.

Returns:
    Submitted job.
    The result of the job is an instance of
    :class:`qiskit.primitives.containers.PrimitiveResult`.

Raises:
    ValueError: Invalid arguments are given.
)r	   coercer   _run)r(   pubsr*   pubcoerced_pubss        r   runSamplerV2.runY   sB    $ BFF#
))#5F$\2yy&&	 Gs    Ac                    g)zfValidate that primitive inputs (options) are valid

Raises:
    ValidationError: if validation fails.
Nr   )r(   r&   s     r   _validate_optionsSamplerV2._validate_optionsq   s     	r   c                    g)zReturn the program ID.samplerr   )clss    r   _program_idSamplerV2._program_idz   s     r   r   )NN)r%   z*Optional[Union[BackendV2, Session, Batch]]r&   z%Optional[Union[Dict, SamplerOptions]])r.   zIterable[SamplerPubLike]r*   z
int | Nonereturnr   )r&   dictr;   None)r;   str)r   r   r   r   r   r   _options_classr   r'   r1   r4   classmethodr9   r   r   r   r   r!   r!   ,   s[    
 $NG <@9=C8C 7C8 JN '0  r   r!   )!r   
__future__r   typingr   r   r   r   loggingqiskit.primitives.baser   (qiskit.primitives.containers.sampler_pubr	   r
   qiskit.providersr   runtime_job_v2r   base_primitiver   sessionr   batchr   utilsr   r&   r   	getLoggerr   loggerr   r!   r   r   r   <module>rN      sh     " 2 2  1 O & ) +   / #			8	$ Q/- Qr   