
    z	i                        S r SSKJr  SSKrSSKJrJr  SSKJrJ	r	J
r
  SSKJr  SSKJr  SSKJr  SS	KJrJr  \
(       a  SS
KJr   " S S5      r " S S\\5      rg)zJob abstract interface.    )annotationsN)ABCabstractmethod)CallableOptionalTYPE_CHECKING)QiskitError)Backend)JobTimeoutError)JOB_FINAL_STATES	JobStatus)Resultc                      \ rS rSrSrSrSrg)Job   a  Base common type for all versioned Job 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       N/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/providers/job.pyr   r      s     Gr   r   c                      \ rS rSrSrSrSrSS jrSS jrSS jr	SS jr
SS	 jrSS
 jrSS jr S       SS jjr\S 5       r\SS j5       rS r\SS j5       rSrg)JobV1*   aX  Class to handle jobs

This first version of the Backend abstract class is written to be mostly
backwards compatible with the legacy providers interface. This was done to ease
the transition for users and provider maintainers to the new versioned providers. Expect,
future versions of this abstract class to change the data model and
interface.
   Tc                (    X l         Xl        X0l        g)zInitializes the asynchronous job.

Args:
    backend: the backend used to run the job.
    job_id: a unique id in the context of the backend used to run
        the job.
    kwargs: Any key value metadata to associate with this job.
N)_job_id_backendmetadata)selfbackendjob_idkwargss       r   __init__JobV1.__init__7   s     r   c                    U R                   $ )z'Return a unique id identifying the job.)r!   r$   s    r   r&   JobV1.job_idD   s    ||r   c                J    U R                   c  [        S5      eU R                   $ )z/Return the backend where this job was executed.z"The job does not have any backend.)r"   r	   r+   s    r   r%   JobV1.backendH   s"    == BCC}}r   c                D    U R                  5       [        R                  :H  $ )z,Return whether the job has successfully run.)statusr   DONEr+   s    r   done
JobV1.doneN   s    {{}	..r   c                D    U R                  5       [        R                  :H  $ )z+Return whether the job is actively running.)r0   r   RUNNINGr+   s    r   runningJobV1.runningR   s    {{}	 1 111r   c                D    U R                  5       [        R                  :H  $ )z*Return whether the job has been cancelled.)r0   r   	CANCELLEDr+   s    r   	cancelledJobV1.cancelledV   s    {{}	 3 333r   c                0    U R                  5       [        ;   $ )zMReturn whether the job is in a final job state such as ``DONE`` or ``ERROR``.)r0   r   r+   s    r   in_final_stateJobV1.in_final_stateZ   s    {{} 000r   Nc                   U R                   (       d  g[        R                  " 5       nU R                  5       nU[        ;  a  [        R                  " 5       U-
  nUb"  Xa:  a  [	        SU R                  5        S35      eU(       a  U" U R                  5       XP5        [        R                  " U5        U R                  5       nU[        ;  a  M  g)a  Poll the job status until it progresses to a final state such as ``DONE`` or ``ERROR``.

Args:
    timeout: Seconds to wait for the job. If ``None``, wait indefinitely.
    wait: Seconds between queries.
    callback: Callback function invoked after each query.
        The following positional arguments are provided to the callback function:

        * job_id: Job ID
        * job_status: Status of the job from the last query
        * job: This BaseJob instance

        Note: different subclass might provide different arguments to
        the callback function.

Raises:
    JobTimeoutError: If the job does not reach a final state before the
        specified timeout.
NzTimeout while waiting for job .)_asynctimer0   r   r   r&   sleep)r$   timeoutwaitcallback
start_timer0   elapsed_times          r   wait_for_final_stateJobV1.wait_for_final_state^   s    , {{YY[
,,99;3L"|'>%(Ft{{}oUV&WXX5JJt[[]F ,, 	r   c                    g)z,Submit the job to the backend for execution.Nr   r+   s    r   submitJobV1.submit        	r   c                    g)zReturn the results of the job.Nr   r+   s    r   resultJobV1.result   rN   r   c                    [         e)zAttempt to cancel the job.)NotImplementedErrorr+   s    r   cancelJobV1.cancel   s    !!r   c                    g)z@Return the status of the job, among the values of ``JobStatus``.Nr   r+   s    r   r0   JobV1.status   rN   r   )r"   r!   r#   )r%   zOptional[Backend]r&   strreturnNone)rY   rX   )rY   r
   )rY   bool)N   N)rD   zOptional[float]rE   floatrF   zOptional[Callable]rY   rZ   )rY   r   )rY   r   )r   r   r   r   r   r   rA   r(   r&   r%   r2   r6   r:   r=   rI   r   rL   rP   rT   r0   r   r   r   r   r   r   *   s     GF/241
 `d"&"5:"J\"	"H    "  r   r   )r   
__future__r   rB   abcr   r   typingr   r   r   qiskit.exceptionsr	   qiskit.providers.backendr
   qiskit.providers.exceptionsr   qiskit.providers.jobstatusr   r   qiskit.resultr   r   r   r   r   r   <module>rf      sE     "  # 4 4 ) , 7 B$	 	iC ir   