
    z	i4
                     N    S r SSKrSSKrSSKrSSKJr  SSKJr   " S S\5      rg).Error pass to be called when an error happens.    N)AnalysisPass)TranspilerErrorc                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )Error   r   c                 b   > [         TU ]  5         Xl        US;   a  X l        g[	        SU 35      e)aL  Error pass.

Args:
    msg (str | Callable[[PropertySet], str]): Error message, if not provided a generic error
        will be used.  This can be either a raw string, or a callback function that accepts
        the current ``property_set`` and returns the desired message.
    action (str): the action to perform. Default: 'raise'. The options are:
      * ``'raise'``: Raises a ``TranspilerError`` exception with msg
      * ``'warn'``: Raises a non-fatal warning with msg
      * ``'log'``: logs in ``logging.getLogger(__name__)``

Raises:
    TranspilerError: if action is not valid.
)raisewarnlogUnknown action: N)super__init__msgactionr   )selfr   r   	__class__s      ^/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/transpiler/passes/utils/error.pyr   Error.__init__   s6     	-- K!$4VH"=>>    c                    U R                   c  SnO[        U R                   [        5      (       a  [        R                  " 5       R                  U R                   5       Vs/ s H  o3S   c  M
  US   PM     nnU Vs0 s H  oUU R                  U   _M     nnU R                   R                  " S0 UD6nOU R                  U R                  5      nU R                  S:X  a  [        U5      eU R                  S:X  a  [        R                  " U[        5        gU R                  S:X  a,  [        R                  " [        5      nUR!                  U5        g[        SU R                   35      es  snf s  snf )	zRun the Error pass on `dag`.Nz5An error occurred while the pass manager was running.   r
   r   r   r    )r   
isinstancestrstring	Formatterparseproperty_setformatr   r   warningsr   Warninglogging	getLogger__name__info)r   _r   tup
prop_names	prop_name
propertiesloggers           r   run	Error.run0   s-   88IC#&&"("2"2"4":":488"D"D3AA"D   T^^S]iT%6%6y%AAS]J^((///J/C((4,,-C;;'!!#&&;;& MM#w'[[E!&&x0FKK!$4T[[M"BCC! _s    	E*-	E*<E/)r   r   )Nr
   )	r%   
__module____qualname____firstlineno____doc__r   r-   __static_attributes____classcell__)r   s   @r   r   r      s    8?,D Dr   r   )	r2   r#   r   r!   qiskit.transpiler.basepassesr   qiskit.transpiler.exceptionsr   r   r   r   r   <module>r7      s'    5    5 8.DL .Dr   