o
    ȳg                     @  s   d Z ddlmZ ddlZddlmZ ejrddlmZ e	e Z
i ZdddZejdddddZejdddddZdddddZdS )a!  A registry of :class:`Schema <marshmallow.Schema>` classes. This allows for string
lookup of schemas, which may be used with
class:`fields.Nested <marshmallow.fields.Nested>`.

.. warning::

    This module is treated as private API.
    Users should not need to use this module directly.
    )annotationsN)RegistryError)Schema	classnamestrcls
SchemaTypereturnNonec                   s   |j    d|  }| tv r#t fddt|  D s#t|  | n	| tvr,|gt| < |tvr;t|g | dS |gt|< dS )a  Add a class to the registry of serializer classes. When a class is
    registered, an entry for both its classname and its full, module-qualified
    path are added to the registry.

    Example: ::

        class MyClass:
            pass


        register("MyClass", MyClass)
        # Registry:
        # {
        #   'MyClass': [path.to.MyClass],
        #   'path.to.MyClass': [path.to.MyClass],
        # }

    .c                 3  s    | ]}|j  kV  qd S N)
__module__).0eachmodule V/var/www/html/chatdoc2/venv/lib/python3.10/site-packages/marshmallow/class_registry.py	<genexpr>9   s    

zregister.<locals>.<genexpr>N)r   	_registryanyappend
setdefault)r   r   fullpathr   r   r   register   s   
r   .)allr   typing.Literal[False]c                C     d S r   r   r   r   r   r   r   	get_classH   s   r   typing.Literal[True]list[SchemaType]c                C  r   r   r   r   r   r   r   r   L   s   Fboollist[SchemaType] | SchemaTypec             
   C  sl   zt |  }W n ty } z	td| d|d}~ww t|dkr0|r(t |  S td| dt |  d S )zRetrieve a class from the registry.

    :raises: `marshmallow.exceptions.RegistryError` if the class cannot be found
        or if there are multiple entries for the given class name.
    zClass with name z1 was not found. You may need to import the class.N   zMultiple classes with name z8 were found. Please use the full, module-qualified path.r   )r   KeyErrorr   len)r   r   classeserrorr   r   r   r   R   s"   

)r   r   r   r   r	   r
   )r   r   r   r   r	   r   )r   r   r   r    r	   r!   )r   r   r   r"   r	   r#   )__doc__
__future__r   typingmarshmallow.exceptionsr   TYPE_CHECKINGmarshmallowr   typer   r   r   overloadr   r   r   r   r   <module>   s    
*