
    $gv                     \    d dl mZ d dlmZmZ d dlmZ d dlmZ  G d de          Z	dgZ
dS )    )	lru_cache)IteratorOptional)SchemaExtension)validate_documentc                   H    e Zd ZdZddee         ddfdZded         fdZdS )ValidationCacheaA  Add LRU caching the validation step during execution to improve performance.

    Example:
    ```python
    import strawberry
    from strawberry.extensions import ValidationCache

    schema = strawberry.Schema(
        Query,
        extensions=[
            ValidationCache(maxsize=100),
        ],
    )
    ```
    Nmaxsizereturnc                 L     t          |          t                    | _        dS )a  Initialize the ValidationCache.

        Args:
            maxsize: Set the maxsize of the cache. If `maxsize` is set to `None` then the
                cache will grow without bound.

        More info: https://docs.python.org/3/library/functools.html#functools.lru_cache
        )r
   N)r   r   cached_validate_document)selfr
   s     f/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/strawberry/extensions/validation_cache.py__init__zValidationCache.__init__   s)     )C	'(B(B(BCT(U(U%%%    c              #      K   | j         }|                     |j        j        |j        |j                  }||_        d V  d S N)execution_contextr   schema_schemagraphql_documentvalidation_ruleserrors)r   r   r   s      r   on_validatezValidationCache.on_validate$   sQ       2..$,..
 

 $* r   r   )	__name__
__module____qualname____doc__r   intr   r   r    r   r   r	   r	      so          	V 	V 	V 	V 	V 	V 	V	Xd^ 	 	 	 	 	 	r   r	   N)	functoolsr   typingr   r   $strawberry.extensions.base_extensionr   strawberry.schema.executer   r	   __all__r    r   r   <module>r&      s          % % % % % % % % @ @ @ @ @ @ 7 7 7 7 7 7% % % % %o % % %P 
r   