
    {	i                     V    S r SSKJrJrJr  SSKJr  SSKJr  \" SS9r	S r
S rSS
 jrg	)z)Utility functions for Aer job management.    )singledispatchupdate_wrapperwraps)ThreadPoolExecutor)JobError   )max_workersc                 0   ^  [        T 5      U 4S j5       nU$ )z
Decorator to ensure that a submit has been performed before
calling the method.

Args:
    func (callable): test function to be decorated.

Returns:
    callable: the decorated function.
c                 L   > U R                   c  [        S5      eT" U /UQ70 UD6$ )Nz4Job not submitted yet!. You have to .submit() first!)_futurer   )selfargskwargsfuncs      O/home/james-whalen/.local/lib/python3.13/site-packages/qiskit_aer/jobs/utils.py_wrapper!requires_submit.<locals>._wrapper"   s.    <<QRRD*4*6**    )r   )r   r   s   ` r   requires_submitr      s"     4[+ +
 Or   c                 b   ^ [        U 5      mU4S jnTR                  Ul        [        X5        U$ )zh
Returns a wrapper function that selects which registered function
to call based on the type of args[2]
c                  L   > TR                  U S   R                  5      " U 0 UD6$ )N   )dispatch	__class__)r   kw
dispatchers     r   wrappermethdispatch.<locals>.wrapper2   s(    ""47#4#45tBrBBr   )r   registerr   )r   r   r   s     @r   methdispatchr    +   s2    
  %JC "**G7!Nr   Nc                 P    Ub  [        S U 5       5      $ [        S U  5       5      $ )z?Return True if circuits contain instructions that cant be splitc              3   F   #    U  H  nS 1R                  U5      v   M     g7f)SaveDataN)intersection).0optypes     r   	<genexpr>,_check_custom_instruction.<locals>.<genexpr>?   s      K7J<,,V447s   !c              3   f   #    U  H'  oR                     H  nS UR                  ;   v   M     M)     g7f)save_N)instructionsname)r%   expinsts      r   r'   r(   B   s'     X{GWGWtw$))#GW#{s   /1)any)experimentsoptypess     r   _check_custom_instructionr2   :   s.     K7KKK X{XXXr   )N)__doc__	functoolsr   r   r   concurrent.futuresr   qiskit.providersr   DEFAULT_EXECUTORr   r    r2    r   r   <module>r9      s1    0 ; ; 1 %%!4 *Yr   