o
    tBh                     @   s@   d dl mZmZmZ g dZG dd dZejZejZ	ej
ZdS )    )AnyTupleUnion)Descriptionis_descriptionregister_descriptionunregister_descriptionc                   @   sp   e Zd ZU dZeZeeeedf f e	d< e
dedefddZe
dedd	fd
dZe
dedd	fddZd	S )r   aO  Type checker for human readable descriptions.

    By default, only ordinary strings are accepted as descriptions,
    but you can register() other classes that will also be allowed,
    e.g. to support lazy string objects that are evaluated only at runtime.
    If you register(object), any object will be allowed as description.
    .basesobjreturnc                 C   s   t || jS N)
isinstancer	   )clsr
    r   r/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/graphql/pyutils/description.pyr      s   zDescription.isinstancebaseNc                 C   s   t |ts	td|tu rt| _dS | jtu r|| _dS t | jts1|| jur/| j|f| _dS dS || jvr@|  j|f7  _dS dS )z9Register a class that shall be accepted as a description.zOnly types can be registered.N)r   type	TypeErrorobjectr	   tupler   r   r   r   r   register   s   





zDescription.registerc                    s   t  ts	tdt | jtr: | jv r!t fdd| jD | _| js)t| _dS t| jdkr8| jd | _dS dS | j u rDt| _dS dS )zCUnregister a class that shall no more be accepted as a description.zOnly types can be unregistered.c                 3   s    | ]	}| ur|V  qd S r   r   ).0br   r   r   	<genexpr>0   s    z)Description.unregister.<locals>.<genexpr>   r   N)r   r   r   r	   r   r   lenr   r   r   r   
unregister)   s   




zDescription.unregister)__name__
__module____qualname____doc__strr	   r   r   r   __annotations__classmethodr   boolr   r   r   r   r   r   r   r      s   
 r   N)typingr   r   r   __all__r   r   r   r   r   r   r   r   r   r   r   <module>   s    .
