
    6|h                        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Zej                  ddd       Zej                  ddd       Zddd	Zy)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)Schemac                P   |j                   dj                  | g      }| t        v r4t        fdt        |    D              st        |    j	                  |       n| t        vr
|gt        | <   |t        vr&t        j                  |g       j	                  |       y|gt        |<   y)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  <   K   | ]  }|j                   k(    y wN)
__module__).0eachmodules     Y/var/www/html/test/engine/venv/lib/python3.12/site-packages/marshmallow/class_registry.py	<genexpr>zregister.<locals>.<genexpr>8   s      *&*6!*s   N)r
   join	_registryanyappend
setdefault)	classnameclsfullpathr   s      @r   registerr      s    ( ^^F xx+,H Ic *.7	.B* ' 	)##C(	)	# #u	) y Xr*11#6   #e	(    c                     y r	    r   alls     r   	get_classr   H   s    ORr   c                     y r	   r   r   s     r   r   r   L   s    TWr   c                    	 t         |    }t        |      dkD  r|r	t         |    S t        d| d      t         |    d   S # t        $ r}t        d| d      |d}~ww xY w)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errors       r   r   r   P   s    I& 7|aY'')) 7% %
 	
 #A&&  ym ,# #
 	s   	? 	AAA)r   strr   
SchemaTypereturnNone).)r   r&   r   ztyping.Literal[False]r(   r'   )r   r&   r   ztyping.Literal[True]r(   zlist[SchemaType])F)r   r&   r   boolr(   zlist[SchemaType] | SchemaType)__doc__
__future__r   typingmarshmallow.exceptionsr   TYPE_CHECKINGmarshmallowr   typer'   r   r   overloadr   r   r   r   <module>r3      sd    #  0	"fJ 	(V  R  R  W  W'r   