
    $g	                         d dl mZmZ d dlmZ d dlmZmZmZm	Z	m
Z
mZmZ dgZedef         Z G d d          Zde
edf         dee         fd	Zd
S )    )partialreduce)
isfunction)CallableIteratorDictListTupleAnyOptionalMiddlewareManager.c                   p    e Zd ZU dZdZeeef         ed<   ee	e
                  ed<   defdZdedefd	Zd
S )r   a  Manager for the middleware chain.

    This class helps to wrap resolver functions with the provided middleware functions
    and/or objects. The functions take the next middleware function as first argument.
    If middleware is provided as an object, it must provide a method ``resolve`` that is
    used as the middleware function.

    Note that since resolvers return "AwaitableOrValue"s, all middleware functions
    must be aware of this and check whether values are awaitable before awaiting them.
    )__dict__middlewares_middleware_resolvers_cached_resolversr   r   r   c                 l    || _         |rt          t          |                    nd | _        i | _        d S N)r   listget_middleware_resolversr   r   )selfr   s     \/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/graphql/execution/middleware.py__init__zMiddlewareManager.__init__   s@    &;FPD)+66777D 	" "$    field_resolverreturnc                 ~    | j         |S || j        vrt          d | j         |          | j        |<   | j        |         S )zWrap the provided resolver with the middleware.

        Returns a function that chains the middleware functions with the provided
        resolver function.
        Nc                 "    t          ||           S r   )r   )chained_fnsnext_fns     r   <lambda>z6MiddlewareManager.get_field_resolver.<locals>.<lambda>0   s    WWk-J-J r   )r   r   r   )r   r   s     r   get_field_resolverz$MiddlewareManager.get_field_resolver$   sW     %-!!!7775;JJ*6 6D">2
 %n55r   N)__name__
__module____qualname____doc__	__slots__r   GraphQLFieldResolver__annotations__r   r	   r   r   r   r"    r   r   r   r      s         	 	 XI02FFGGGG#DN3333$S $ $ $ $626	6 6 6 6 6 6r   r   r   c              #   j   K   | D ]-}t          |          r|V  t          |dd          }||V  .dS )zEGet a list of resolver functions from a list of classes or functions.resolveN)r   getattr)r   
middlewareresolver_funcs      r   r   r   7   sb      ! $ $
j!! 	$#J	4@@M(####$ $r   N)	functoolsr   r   inspectr   typingr   r   r   r	   r
   r   r   __all__r(   r   r   r*   r   r   <module>r4      s    % % % % % % % %       G G G G G G G G G G G G G G G G G G
S) )6 )6 )6 )6 )6 )6 )6 )6X$%S/ $hx>P $ $ $ $ $ $r   