
    z	i                         S r SSKJr  SSKrSSKJr  SSKJr  \R                  " \	5      r
 S     S	S jjr          S
S jrg)zUtilities for providers.    )annotationsN)Callable)Backendc                  ^ S n0 n0 nUR                  5        H*  u  mn[        U4S jU  5       5      (       a  XdT'   M&  XeT'   M,     U(       a/  U  Vs/ s H"  os" UR                  5       U5      (       d  M   UPM$     n nU(       a/  U  Vs/ s H"  os" UR                  5       U5      (       d  M   UPM$     n n[	        [        X5      5      n U $ s  snf s  snf )a  Return the backends matching the specified filtering.

Filter the `backends` list by their `configuration` or `status`
attributes, or from a boolean callable. The criteria for filtering can
be specified via `**kwargs` or as a callable via `filters`, and the
backends must fulfill all specified conditions.

Args:
    backends (list[Backend]): list of backends.
    filters (callable): filtering conditions as a callable.
    **kwargs: dict of criteria.

Returns:
    list[Backend]: a list of backend instances matching the
        conditions.
c                J   ^  [        U 4S jUR                  5        5       5      $ )z:Return True if all items in criteria matches items in obj.c              3  H   >#    U  H  u  p[        TUS 5      U:H  v   M     g 7fN)getattr).0key_value_objs      X/home/james-whalen/.local/lib/python3.13/site-packages/qiskit/providers/providerutils.py	<genexpr>6filter_backends.<locals>._match_all.<locals>.<genexpr>.   s#     [JZ,$73d+v5JZs   ")allitems)r   criterias   ` r   
_match_all#filter_backends.<locals>._match_all,   s    [(..JZ[[[    c              3  J   >#    U  H  nTUR                  5       ;   v   M     g 7fr	   )configuration)r   backendkeys     r   r   "filter_backends.<locals>.<genexpr>6   s     FX'sg++--Xs    #)r   r   r   statuslistfilter)	backendsfilterskwargsr   configuration_filtersstatus_filtersvaluebr   s	           @r   filter_backendsr'      s    (\ Nlln
UFXFFF).#&"'3	 % '`x!:aoo6GI^+_Ax` 'Rx!:ahhj.+QAxR F7-.HO a
 Ss   C	5C	C+Cc                  ^ / mU H>  nTR                  UR                  S:X  a  UR                  5       OUR                  5        M@     UR                  XR                  X 5      5      n[	        U[
        5      (       a  [        U4S jU 5       S5      nUT;  a  [        SU  S35      eX;   a  [        R                  SX5        U$ )a.  Resolve backend name from a deprecated name or an alias.

A group will be resolved in order of member priorities, depending on
availability.

Args:
    name (str): name of backend to resolve
    backends (list[Backend]): list of available backends.
    deprecated (dict[str: str]): dict of deprecated names.
    aliased (dict[str: list[str]]): dict of aliased names.

Returns:
    str: resolved name (name of an available backend)

Raises:
    LookupError: if name cannot be resolved through regular available
        names, nor deprecated, nor alias names.
   c              3  6   >#    U  H  oT;   d  M
  Uv   M     g 7fr	    )r   r&   	availables     r   r   'resolve_backend_name.<locals>.<genexpr>f   s     IAy.aas   		 z	backend 'z' not found.z%Backend '%s' is deprecated. Use '%s'.)
appendversionnameget
isinstancer   nextLookupErrorloggerwarning)r1   r    
deprecatedaliasedr   resolved_namer,   s         @r   resolve_backend_namer;   J   s    , I7??a+?W\\R  NN4T)@AM-&&II2NI%IdV<899>Tr   r	   )r    list[Backend]r!   z Callable[[Backend], bool] | Nonereturnr<   )
r1   strr    r<   r8   zdict[str, str]r9   zdict[str, list[str]]r=   r>   )__doc__
__future__r   loggingcollections.abcr   qiskit.providers.backendr   	getLogger__name__r6   r'   r;   r+   r   r   <module>rF      sx     "  $ ,			8	$ JN//&F//d$
$&$4B$Ma$$r   