
    E
i                       d Z ddlmZ ddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddlZddlmZ ddlmZmZ ddlmZ ddlmZ ddlmZmZmZ dd	lmZ dd
lmZmZm Z m!Z!m"Z"m#Z# ddl$m%Z% ddl&m'Z'm(Z(m)Z) ddl*m+Z+ ddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 ddl6m7Z7 ej8        rddl9m:Z: ddZ;ddZ< G d de          Z= G d d          Z> G d dej?        e=          Z@e@ZAdS )zvThe `Schema <marshmallow.Schema>` class, including its metaclass and options (`class Meta <marshmallow.Schema.Meta>`).    )annotationsN)ABCMeta)OrderedDictdefaultdict)Mapping)zip_longest)baseclass_registrytypes)fields)	POST_DUMP	POST_LOADPRE_DUMPPRE_LOAD	VALIDATESVALIDATES_SCHEMA)
ErrorStore)SCHEMAStringNotCollectionErrorValidationError)
OrderedSet)	EXCLUDEINCLUDERAISE	get_valueis_collectionis_instance_or_subclassmissing	set_value validate_unknown_parameter_value)RemovedInMarshmallow4Warning)Fieldreturnlist[tuple[str, Field]]c                >    d |                                  D             S )zKGet fields from a class

    :param attrs: Mapping of class attributes
    c                P    g | ]#\  }}t          |t          j                  ||f$S  )r   r	   FieldABC).0
field_namefield_values      C:\Users\Dell Inspiron 16\Desktop\tws\AgrotaPowerBi\back-agrota-powerbi\mcp-client-agrota\venv\Lib\site-packages\marshmallow/schema.py
<listcomp>z_get_fields.<locals>.<listcomp>7   sC       #J";>>	[!      )items)attrss    r,   _get_fieldsr1   2   s+    
 ',{{}}   r.   klass
SchemaMetac                    t          j        |           }t          j        t          j        d |ddd         D             g           S )a  Collect fields from a class, following its method resolution order. The
    class itself is excluded from the search; only its parents are checked. Get
    fields from ``_declared_fields`` if available, else use ``__dict__``.

    :param klass: Class whose fields to retrieve
    c              3  \   K   | ]'}t          t          |d |j                            V  (dS )_declared_fieldsN)r1   getattr__dict__)r)   r	   s     r,   	<genexpr>z%_get_fields_by_mro.<locals>.<genexpr>M   sT       	
 	
  0$-@@ 	
 	
 	
 	
 	
 	
r.   Nr   )inspectgetmro	functoolsreduceoperatoriadd)r2   mros     r,   _get_fields_by_mrorB   @   s\     .

C 	
 	
 EQrE
		
 	
 	
 		 	 	r.   c                  |     e Zd ZU dZded<   ded<   ded<   ded<   d fdZeefdd            Z fdZ	ddZ
 xZS )r3   a#  Metaclass for the Schema class. Binds the declared fields to
    a ``_declared_fields`` attribute, which is a dictionary mapping attribute
    names to field objects. Also sets the ``opts`` class attribute, which is
    the Schema class's `class Meta <marshmallow.Schema.Meta>` options.
    typeMeta
typing.AnyoptsOPTIONS_CLASSdict[str, Field]r6   namestrbasestuple[type, ...]r0   dict[str, typing.Any]r#   c                N   |                     d          }t          |dd          }|s:|D ]5}t          |d          r#t          |j        d          r|j        j        } n6d}t          |          }|D ]\  }}	||= 	t                                          | |||          }
t          |
          }|
j        }|
	                    ||          |
_
        |t          |
j
        j                                                  z  }|                     |
||t                    |
_        |
S )NrE   orderedF)rP   )r2   
cls_fieldsinherited_fieldsdict_cls)getr7   hasattrrE   rP   r1   super__new__rB   rH   rG   listincluder/   get_declared_fieldsdictr6   )mcsrJ   rL   r0   metarP   base_rQ   r*   _r2   rR   	__class__s               r,   rW   zSchemaMeta.__new__c   sH    yy  $	511 
	 
     5&)) gej).L.L #j0GE ''
 ( 	" 	"MJj!!T5%88-e44z ((w(??
d5:-3355666
 "%!8!8!-	 "9 "
 "
 r.   r2   rQ   r$   rR   rS   
type[dict]c                     |||z             S )aA  Returns a dictionary of field_name => `Field` pairs declared on the class.
        This is exposed mainly so that plugins can add additional fields, e.g. fields
        computed from `class Meta <marshmallow.Schema.Meta>` options.

        :param klass: The class object.
        :param cls_fields: The fields declared on the class, including those added
            by the ``include`` `class Meta <marshmallow.Schema.Meta>` option.
        :param inherited_fields: Inherited fields.
        :param dict_cls: dict-like class to use for dict output Default to ``dict``.
        r'   )r\   r2   rQ   rR   rS   s        r,   rZ   zSchemaMeta.get_declared_fields   s    $ x(:5666r.   c                    t                                          |||           |r!| j        j        rt	          j        ||            |                                 | _        d S N)rV   __init__rG   registerr
   resolve_hooks_hooks)clsrJ   rL   r0   r`   s       r,   re   zSchemaMeta.__init__   s]    ue,,, 	/CH% 	/#D#...&&((


r.   'dict[str, list[tuple[str, bool, dict]]]c                x   t          j        |           }t          t                    }t	          |           D ]|D ]!}	 |j                 } n# t          $ r Y w xY w'	 |j        }|                                D ],\  }}||         	                    fd|D                        -q# t          $ r Y }w xY w|S )zAdd in the decorated processors

        By doing this after constructing the class, we let standard inheritance
        do all the hard work.
        c              3  (   K   | ]\  }}||fV  d S rd   r'   )r)   manykwargs	attr_names      r,   r9   z+SchemaMeta.resolve_hooks.<locals>.<genexpr>   s?       & &6BdFD&1& & & & & &r.   )r;   r<   r   rX   dirr8   KeyError__marshmallow_hook__r/   extendAttributeError)	ri   rA   hooksparentattrhook_configtagconfigro   s	           @r,   rg   zSchemaMeta.resolve_hooks   s.    nS!!9DT9J9JS 	 	I   !?95D E     H -  $/#4#4#6#6  KC #J%% & & & &FL& & &     "    s$    A
AA!B**
B76B7)rJ   rK   rL   rM   r0   rN   r#   r3   )
r2   r3   rQ   r$   rR   r$   rS   ra   r#   rI   )r#   rj   )__name__
__module____qualname____doc____annotations__rW   classmethodr[   rZ   re   rg   __classcell__)r`   s   @r,   r3   r3   W   s           JJJ&&&&) ) ) ) ) )V   $7 7 7 7 [7&) ) ) ) )) ) ) ) ) ) ) )r.   c                      e Zd ZdZd	d
dZdS )
SchemaOptsz/Defines defaults for `marshmallow.Schema.Meta`.Fr]   rD   rP   boolc                   t          |dd          | _        t          | j        t          t          f          st          d          t          |dd          | _        t          | j        t          t          f          st          d          | j        r| j        rt          d          t          |dd          | _        t          | j        t          t          f          st          d          t          |d	d           | _        t          |d
d           | _	        t          |dd           | _
        t          |d          r3t          j        dt          d           t          |dt                    }nt          }t          |d|          | _        t          |d          rt          j        dt          d           t          |d|          | _        t          |dd          | _        t          |di           | _        t          |dd          | _        t          |dd          | _        t-          t          |dt.                              | _        t          |dd          | _        t          |dd          | _        d S )Nr   r'   z(`fields` option must be a list or tuple.
additionalz,`additional` option must be a list or tuple.zFCannot set both `fields` and `additional` options for the same Schema.excludez"`exclude` must be a list or tuple.
dateformatdatetimeformat
timeformatjson_modulezKThe json_module class Meta option is deprecated. Use render_module instead.   
stacklevelrender_modulerP   zThe `ordered` `class Meta` option is deprecated. Field order is already preserved by default. Set `Schema.dict_class` to OrderedDict to maintain the previous behavior.index_errorsTrY   	load_only	dump_onlyunknownrf   rm   F)r7   r   
isinstancerX   tuple
ValueErrorr   r   r   r   r   rU   warningswarnr!   jsonr   rP   r   rY   r   r   r    r   r   rf   rm   )selfr]   rP   r   s       r,   re   zSchemaOpts.__init__   s[   dHb11$+e}55 	IGHHH!$b99$/D%=99 	MKLLL; 	4? 	X   tY33$,u66 	CABBB!$d;;%d,<dCC!$d;;4'' 	!M],   
 $D->>MM M$T?MJJ4## 	M\ -    tY88#D.$??tY33 {B77 {B777iQV8W8WXXj$77D&%00			r.   N)F)r]   rD   rP   r   )r{   r|   r}   r~   re   r'   r.   r,   r   r      s3        99*1 *1 *1 *1 *1 *1 *1r.   r   c                     e Zd ZU dZeej        eej        ej	        ej
        eej        eej        eej        eej        eej        eej        ej        ej        ej        ej        ej        ej        ej        ej        ej        ej        iZde d<   i Z!de d<   dddZ"de d	<   e#Z$d
e d<   e%Z&de d<   i Z'de d<   i Z(de d<    G d d          Z)ddddddddddld%Z*dmd(Z+e,dnd*            Z-e.d+d,dod0            Z/dpd5Z0dqd9Z1e2dd:d;            Z3d<d=drd>Z4dd=dsd?Z5dd=dsd@Z6d<de7ddAdtdFZ8ddddGdudHZ9ddddGdvdKZ:dd:dwdQZ;dddRdxdTZ<ddddUdVdydXZ=dzdZZ>dzd[Z?dzd\Z@d{d`ZAd{daZBddbd|ddZCd}deZDd~dfZEd<dgddjZFddbddkZGdS )Schemaa  Base schema class with which to define schemas.

    Example usage:

    .. code-block:: python

        import datetime as dt
        from dataclasses import dataclass

        from marshmallow import Schema, fields


        @dataclass
        class Album:
            title: str
            release_date: dt.date


        class AlbumSchema(Schema):
            title = fields.Str()
            release_date = fields.Date()


        album = Album("Beggars Banquet", dt.date(1968, 12, 6))
        schema = AlbumSchema()
        data = schema.dump(album)
        data  # {'release_date': '1968-12-06', 'title': 'Beggars Banquet'}

    :param only: Whitelist of the declared fields to select when
        instantiating the Schema. If None, all fields are used. Nested fields
        can be represented with dot delimiters.
    :param exclude: Blacklist of the declared fields to exclude
        when instantiating the Schema. If a field appears in both `only` and
        `exclude`, it is not used. Nested fields can be represented with dot
        delimiters.
    :param many: Should be set to `True` if ``obj`` is a collection
        so that the object will be serialized to a list.
    :param context: Optional context passed to :class:`fields.Method` and
        :class:`fields.Function` fields.
    :param load_only: Fields to skip during serialization (write-only fields)
    :param dump_only: Fields to skip during deserialization (read-only fields)
    :param partial: Whether to ignore missing fields and not require
        any fields declared. Propagates down to ``Nested`` fields as well. If
        its value is an iterable, only missing fields listed in that iterable
        will be ignored. Use dot delimiters to specify nested fields.
    :param unknown: Whether to exclude, include, or raise an error for unknown
        fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.

    .. versionchanged:: 3.0.0
        `prefix` parameter removed.
    zdict[type, type[Field]]TYPE_MAPPINGzdict[str, str]error_messageszInvalid input type.zUnknown field.)rD   r   _default_error_messagesrD   rH   rF   rG   rI   r6   rj   rh   c                      e Zd ZU dZded<   	 ded<   	 ded<   	 ded<   	 ded	<   	 d
ed<   	 d
ed<   	 d
ed<   	 ded<   	 ded<   	 ded<   	 ded<   	 ded<   	 d
ed<   	 ded<   dS )Schema.Metaa)  Options object for a Schema.

        Example usage: ::

            from marshmallow import Schema


            class MySchema(Schema):
                class Meta:
                    fields = ("id", "email", "date_created")
                    exclude = ("password", "secret_attribute")

        .. admonition:: A note on type checking

            Type checkers will only check the attributes of the `Meta <marshmallow.Schema.Meta>`
            class if you explicitly subclass `marshmallow.Schema.Meta`.

            .. code-block:: python

                from marshmallow import Schema


                class MySchema(Schema):
                    # Not checked by type checkers
                    class Meta:
                        additional = True


                class MySchema2(Schema):
                    # Type checkers will check attributes
                    class Meta(Schema.Meta):
                        additional = True  # Incompatible types in assignment

        .. versionremoved:: 3.0.0b7 Remove ``strict``.
        .. versionadded:: 3.0.0b12 Add `unknown`.
        .. versionchanged:: 3.0.0b17 Rename ``dateformat`` to `datetimeformat`.
        .. versionadded:: 3.9.0 Add `timeformat`.
        .. versionchanged:: 3.26.0 Deprecate `ordered`. Field order is preserved by default.
        z,typing.ClassVar[tuple[str, ...] | list[str]]r   r   z!typing.ClassVar[dict[str, Field]]rY   r   ztyping.ClassVar[bool]rm   ztyping.ClassVar[str]r   r   r   rF   r   rP   r   r   r   r   rf   N)r{   r|   r}   r~   r   r'   r.   r,   rE   r   Z  s        &	 &	P 	=<<<<@@@@	 	3222	 	>===	 	$###O((((I,,,,Q((((I 	"!!!	 	'&&&`++++e????7????7%%%%	 	('''	 	r.   rE   Nr'   )onlyr   rm   contextr   r   partialr   r   types.StrSequenceOrSet | Noner   types.StrSequenceOrSetrm   bool | Noner   dict | Noner   r   r   $bool | types.StrSequenceOrSet | Noner   
str | Nonec               @   |t          |          st          d          t          |          st          d          t          j        | j                  | _        || j        j        n|| _        || _        t          | j        j
                  t          |          z  | _
        | j        j        | _        t          |          pt          | j        j                  | _        t          |          pt          | j        j                  | _        || _        || j        j        nt!          |          | _        |rt#          j        dt&          d           |pi | _        |                                  i | _        i | _        i | _        |                                  i }	|	                    | j                   t9          | j        j                  D ]&}
|	                    t?          |
di                      '|	                    | j         pi            |	| _         d S )Nz""only" should be a list of stringsz%"exclude" should be a list of stringszThe `context` parameter is deprecated and will be removed in marshmallow 4.0. Use `contextvars.ContextVar` to pass context instead.r   r   r   )!r   r   copydeepcopyr6   declared_fieldsrG   rm   r   setr   rP   r   r   r   r   r    r   r   r!   r   _normalize_nested_optionsr   load_fieldsdump_fields_init_fieldsupdater   reversedr`   __mro__r7   r   )r   r   r   rm   r   r   r   r   r   messagesri   s              r,   re   zSchema.__init__  s    M$$7$7*+OPPPW%% 	T*+RSSS#}T-BCC&*lDINN		HKII
 I
LLI y(YC3ty/B+C+CYC3ty/B+C+C  I1':: 	
  	MH,	    }"&&((((*-/-/4555DN233 	@ 	@COOGC)92>>????+1r222&r.   r#   rK   c                2    d| j         j         d| j         dS )N<z(many=z)>)r`   r{   rm   r   s    r,   __repr__zSchema.__repr__  s"    ?4>*??$)????r.   ra   c                ,    | j         rt          S t          S )z'`dict` type to return when serializing.)rP   r   r[   r   s    r,   
dict_classzSchema.dict_class  s     < 	r.   GeneratedSchema)rJ   r   rJ   type[Schema]c                   t          dt          | dt                    fddi          }t          || fi |                                d|i          S )a  Generate a `Schema <marshmallow.Schema>` class given a dictionary of fields.

        .. code-block:: python

            from marshmallow import Schema, fields

            PersonSchema = Schema.from_dict({"name": fields.Str()})
            print(PersonSchema().load({"name": "David"}))  # => {'name': 'David'}

        Generated schemas are not added to the class registry and therefore cannot
        be referred to by name in `Nested` fields.


        :param fields: Dictionary mapping field names to field instances.
        :param name: Optional name for the class, which will appear in
            the ``repr`` for the class.

        .. versionadded:: 3.0.0
        GeneratedMetarE   rf   F)rD   r7   objectr   )ri   r   rJ   rE   s       r,   	from_dictzSchema.from_dict  s\    4 gc66::<z5>Q
 
 D3&"AV[[]]"AFD"A"ABBBr.   errorr   datar   c                   dS )a  Custom error handler function for the schema.

        :param error: The `ValidationError` raised during (de)serialization.
        :param data: The original input data.
        :param many: Value of ``many`` on dump or load.
        :param partial: Value of ``partial`` on load.

        .. versionchanged:: 3.0.0rc9
            Receives `many` and `partial` (on deserialization) as keyword arguments.
        Nr'   )r   r   r   rm   rn   s        r,   handle_errorzSchema.handle_error  s      r.   objrw   defaultc                $    t          |||          S )zDefines how to pull values from an object to serialize.

        .. versionchanged:: 3.0.0a1
            Changed position of ``obj`` and ``attr``.
        )r   )r   r   rw   r   s       r,   get_attributezSchema.get_attribute$  s     dG,,,r.   indexc                   	  | |          }nB# t           $ r5}|                    |j        ||           |j        pt          cY d}~S d}~ww xY w|S )a  Call ``getter_func`` with ``data`` as its argument, and store any `ValidationErrors`.

        :param getter_func: Function for getting the serialized/deserialized
            value from ``data``.
        :param data: The data passed to ``getter_func``.
        :param field_name: Field name.
        :param index: Index of the item being validated, if validating a collection,
            otherwise `None`.
        r   N)r   store_errorr   
valid_datar   )getter_funcr   r*   error_storer   valuer   s          r,   _call_and_storezSchema._call_and_store.  sz    	/K%%EE 	/ 	/ 	/##ENJe#LLL #.w......		/
 s    
A*AAAFrm   c               
    |r| fd|D             S                                   } j                                        D ]A\  }}|                    || j                  }|t
          u r,|j        |j        n|}|||<   B|S )zSerialize ``obj``.

        :param obj: The object(s) to serialize.
        :param many: `True` if ``data`` should be serialized as a collection.
        :return: A dictionary of the serialized data
        Nc                >    g | ]}                     |d           S )Fr   )
_serialize)r)   dr   s     r,   r-   z%Schema._serialize.<locals>.<listcomp>J  s)    @@@qDOOAEO22@@@r.   )accessor)r   r   r/   	serializer   r   data_key)r   r   rm   retro   	field_objr   keys   `       r,   r   zSchema._serializeB  s      	ACO@@@@C@@@@oo$($4$:$:$<$< 	 	 Iy''	3AS'TTE(1(:(F)$$ICCHH
r.   c               *   || j         nt          |          }| j        t                   r|                     t          |||          }n|}|                     ||          }| j        t                   r|                     t          |||          }|S )a  Serialize an object to native Python data types according to this
        Schema's fields.

        :param obj: The object to serialize.
        :param many: Whether to serialize `obj` as a collection. If `None`, the value
            for `self.many` is used.
        :return: Serialized data

        .. versionadded:: 1.0.0
        .. versionchanged:: 3.0.0b7
            This method returns the serialized data rather than a ``(data, errors)`` duple.
            A :exc:`ValidationError <marshmallow.exceptions.ValidationError>` is raised
            if ``obj`` is invalid.
        .. versionchanged:: 3.0.0rc9
            Validation no longer occurs upon serialization.
        N)rm   original_datar   )rm   r   rh   r   _invoke_dump_processorsr   r   )r   r   rm   processed_objresults        r,   dumpzSchema.dumpT  s    " !Ltyyd4jj;x  	  88#D 9  MM  MT::;y! 	116C 2  F r.   c               f    |                      ||          } | j        j        j        |g|R i |S )a+  Same as :meth:`dump`, except return a JSON-encoded string.

        :param obj: The object to serialize.
        :param many: Whether to serialize `obj` as a collection. If `None`, the value
            for `self.many` is used.
        :return: A ``json`` string

        .. versionadded:: 1.0.0
        .. versionchanged:: 3.0.0b7
            This method returns the serialized data rather than a ``(data, errors)`` duple.
            A :exc:`ValidationError <marshmallow.exceptions.ValidationError>` is raised
            if ``obj`` is invalid.
        r   )r   rG   r   dumps)r   r   rm   argsrn   
serializeds         r,   r   zSchema.dumpsv  sA     YYsY..
,ty&,ZI$III&IIIr.   )rm   r   r   r   Rtyping.Mapping[str, typing.Any] | typing.Iterable[typing.Mapping[str, typing.Any]]r   r   typing.Any | list[typing.Any]c               l     j         j        }|r|nd}|rUt                    s&                     j        d         g|           g }n fdt                    D             }|S                                  }	t          t                    s%                     j        d         g|           nut                    }
 j	        
                                D ]\  }}|j        |j        n|}                    |t                    }|t          u rdu s|
r|v rDi }|
r)|dz   t                    fdD             }||d<   n|d<   |||ffd		}                     ||||
          }|t          ur|j        p|}t#          |	||           t$          k    rd  j	        
                                D             }t'                    |z
  D ]M}|         }t(          k    r||	|<   t*          k    r'                     j        d         g||r|nd           N|	S )a  Deserialize ``data``.

        :param data: The data to deserialize.
        :param error_store: Structure to store errors.
        :param many: `True` if ``data`` should be deserialized as a collection.
        :param partial: Whether to ignore missing fields and not require
            any fields declared. Propagates down to ``Nested`` fields as well. If
            its value is an iterable, only missing fields listed in that iterable
            will be ignored. Use dot delimiters to specify nested fields.
        :param unknown: Whether to exclude, include, or raise an error for unknown
            fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
        :param index: Index of the item being serialized (for storing errors) if
            serializing a collection, otherwise `None`.
        :return: The deserialized data as `dict_class` instance or list of `dict_class`
        instances if `many` is `True`.
        NrD   r   c           
     |    g | ]8\  }}                     t          j        t          |          d |          9S )F)r   rm   r   r   r   )_deserializetypingcastr[   )r)   idxr   r   r   r   r   s      r,   r-   z'Schema._deserialize.<locals>.<listcomp>  sb     
 
 
 Q %%D!,,$/" ' '! &  
 
 
r.   T.c                N    g | ]!}|                               |d          "S rd   )
startswith)r)   f
len_prefixprefixs     r,   r-   z'Schema._deserialize.<locals>.<listcomp>  sB     # # #+,1<<;O;O#*++# # #r.   r   c                $     |j         | |fi |S rd   )deserialize)valr   r*   d_kwargsr   s       r,   getterz#Schema._deserialize.<locals>.getter  s4     190"  #	  r.   r   r   r*   r   r   c                4    h | ]\  }}|j         |j         n|S rd   r   )r)   r*   r   s      r,   	<setcomp>z&Schema._deserialize.<locals>.<setcomp>  s<       -
I +4*<*HI&&j  r.   r   )rG   r   r   r   r   	enumerater   r   r   r   r/   r   rT   r   lenr   	attributer   r   r   r   r   )r   r   r   rm   r   r   r   r   ret_lret_dpartial_is_collectionro   r   r*   	raw_valuer   sub_partialr   r   r   r   r   r   s   ``` ``               @@r,   r   zSchema._deserialize  s$   : y-%/4 	 && '')<V)D(EU'SSS
 
 
 
 
 
 
 #,D//
 
 
 L!!$(( =	##T%8%@$A#OOOO$1'$:$:!(,(8(>(>(@(@ *1 *1$	9*3*<*HI&&i  !HHZ99	''$- '2;w2F2F ( 2'#-F!$VJ# # # # #07# # #K +6HY''(*1HY' $-h      ,, &") + -   ''#-:CeS%000'!! 151A1G1G1I1I   t99v- 	 	C IE'))%*c

 E))#//!0;<&2<UU  
 r.   rm   r   r   c               6    |                      ||||d          S )aR  Deserialize a data structure to an object defined by this Schema's fields.

        :param data: The data to deserialize.
        :param many: Whether to deserialize `data` as a collection. If `None`, the
            value for `self.many` is used.
        :param partial: Whether to ignore missing fields and not require
            any fields declared. Propagates down to ``Nested`` fields as well. If
            its value is an iterable, only missing fields listed in that iterable
            will be ignored. Use dot delimiters to specify nested fields.
        :param unknown: Whether to exclude, include, or raise an error for unknown
            fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
            If `None`, the value for `self.unknown` is used.
        :return: Deserialized data

        .. versionadded:: 1.0.0
        .. versionchanged:: 3.0.0b7
            This method returns the deserialized data rather than a ``(data, errors)`` duple.
            A :exc:`ValidationError <marshmallow.exceptions.ValidationError>` is raised
            if invalid data are passed.
        Trm   r   r   postprocess)_do_load)r   r   rm   r   r   s        r,   loadzSchema.load  s*    > }}tWg4  
 
 	
r.   	json_datastr | bytes | bytearrayc               d     | j         j        j        |fi |}|                     ||||          S )a  Same as :meth:`load`, except it uses `marshmallow.Schema.Meta.render_module` to deserialize
        the passed string before passing data to :meth:`load`.

        :param json_data: A string of the data to deserialize.
        :param many: Whether to deserialize `obj` as a collection. If `None`, the
            value for `self.many` is used.
        :param partial: Whether to ignore missing fields and not require
            any fields declared. Propagates down to ``Nested`` fields as well. If
            its value is an iterable, only missing fields listed in that iterable
            will be ignored. Use dot delimiters to specify nested fields.
        :param unknown: Whether to exclude, include, or raise an error for unknown
            fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
            If `None`, the value for `self.unknown` is used.
        :return: Deserialized data

        .. versionadded:: 1.0.0
        .. versionchanged:: 3.0.0b7
            This method returns the deserialized data rather than a ``(data, errors)`` duple.
            A :exc:`ValidationError <marshmallow.exceptions.ValidationError>` is raised
            if invalid data are passed.
        r	  )rG   r   loadsr  )r   r  rm   r   r   rn   r   s          r,   r  zSchema.loads  s=    < -ty&,YAA&AAyyD'7yKKKr.   validator_functypes.SchemaValidatorpass_originalr   
int | Nonec                  	 |r |||||           d S  ||||           d S # t           $ r}	|	j        }
|
t          k    rt          }nLd }	 | j        |
         }n&# t          $ r |
| j        v r| j        |
         }Y nw xY w|r|j        |j        n|
}n|
}|                    |	j        ||           Y d }	~	d S d }	~	ww xY w)N)r   rm   r   )	r   r*   r   r   rq   r   r   r   r   )r   r  outputr   r   rm   r   r  r   errr*   r   r   s                r,   _run_validatorzSchema._run_validator=  s>   	I Cv}gDQQQQQQvwTBBBBBB 	I 	I 	IJV##!*.	E $J 7II E E E!T%999$($8$D	E  * %-9 "**' H  *H##CL(%#HHHHHHHHH)	Is<   % % 
B=B8AB8 A=:B8<A==5B88B=rm   r   dict[str, list[str]]c                   	 |                      |||d           nS# t          $ rF}t          j        t          t
          t          t
                   f         |j                  cY d}~S d}~ww xY wi S )a  Validate `data` against the schema, returning a dictionary of
        validation errors.

        :param data: The data to validate.
        :param many: Whether to validate `data` as a collection. If `None`, the
            value for `self.many` is used.
        :param partial: Whether to ignore missing fields and not require
            any fields declared. Propagates down to ``Nested`` fields as well. If
            its value is an iterable, only missing fields listed in that iterable
            will be ignored. Use dot delimiters to specify nested fields.
        :return: A dictionary of validation errors.

        .. versionadded:: 1.1.0
        F)rm   r   r  N)r  r   r   r   r[   rK   rX   r   )r   r   rm   r   excs        r,   validatezSchema.validated  s}    0	CMM$T7MNNNN 	C 	C 	C;tCcN3S\BBBBBBBB	C	s    
A,;A'!A,'A,Tr  r  c          	        t                      }i }|| j        nt          |          }|| j        nt	          |          }|| j        }| j        t                   rN	 |                     t          ||||          }n/# t          $ r }	|	
                                }d}
Y d}	~	n
d}	~	ww xY w|}|s|                     |||||          }
|                     ||
|           | j        t                   rLt          |j                  }|                     |d|
||||           |                     |d|
||||           |j        }|s`|r^| j        t                    rL	 |                     t           |
|||          }
n+# t          $ r}	|	
                                }Y d}	~	nd}	~	ww xY w|r-t          |||
          }|                     ||||	           ||
S )
ar  Deserialize `data`, returning the deserialized result.
        This method is private API.

        :param data: The data to deserialize.
        :param many: Whether to deserialize `data` as a collection. If `None`, the
            value for `self.many` is used.
        :param partial: Whether to validate required fields. If its
            value is an iterable, only fields listed in that iterable will be
            ignored will be allowed missing. If `True`, all fields will be allowed missing.
            If `None`, the value for `self.partial` is used.
        :param unknown: Whether to exclude, include, or raise an error for unknown
            fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
            If `None`, the value for `self.unknown` is used.
        :param postprocess: Whether to run post_load methods..
        :return: Deserialized data
        N)rm   r   r   )r   rm   r   r   )r   r   rm   T)r   	pass_manyr   r   rm   r   field_errorsF)r   r   r  )r   rm   r   r   r    r   rh   r   _invoke_load_processorsr   normalized_messagesr   _invoke_field_validatorsr   errors_invoke_schema_validatorsr   r   )r   r   rm   r   r   r  r   r&  processed_datar  r   r"  r  s                r,   r  zSchema._do_load  s   8 !ll') Ltyyd4jj  LL1':: 	
 ?lG;x  		"2!%!=!=dT7 "> " " # 2 2 20022-12 "N .	7&&' '  F ))'f4 *    {+, #K$677.. +""&#!- /    .. +#"&#!- /    !'F 
7k 
7dk).D 
7	7!99!!&* ' :  FF ' 7 7 7 4466FFFFFF7 	!&tGGGCc4dGDDDIs0   A= =
B'B""B'E< <
F$FF$Nonec                :   | j         E|                     d| j         d           |                     d | j         D                       | _         | j        rG|                     d| j        d           |                     d | j        D                       | _        dS dS )zVApply then flatten nested schema options.
        This method is private API.
        Nr   intersectionc                F    g | ]}|                     d d          d         S )r      r   splitr)   fields     r,   r-   z4Schema._normalize_nested_options.<locals>.<listcomp>  s+    'V'V'V5C(;(;A(>'V'V'Vr.   r   unionc                    g | ]}d |v|	S )r   r'   r0  s     r,   r-   z4Schema._normalize_nested_options.<locals>.<listcomp>  s"    EEE5Cu4D4D4D4D4Dr.   )r   _Schema__apply_nested_option	set_classr   r   s    r,   r   z Schema._normalize_nested_options  s     9 &&vty.III'V'VDI'V'V'VWWDI< 	&&y$,HHH>>EEDLEEE DLLL		 	r.   c                   d |D             }t          t                    }|D ] \  }}||                             |           !t          |                                          D ]\  }}	|                     |	          }
t          | j        |         |d          }|r<|dk    r|
|                     |          z  }
|dk    r|
|                     |          z  }
t          | j        |         ||
           dS )z%Apply nested options to nested fieldsc                B    g | ]}d |v |                     d d          S )r   r-  r.  )r)   rJ   s     r,   r-   z0Schema.__apply_nested_option.<locals>.<listcomp>  s+    SSSsd{{C++{{{r.   r'   r2  r+  N)	r   rX   appenditerr/   r5  r7   r   setattr)r   option_namefield_namesset_operationnested_fieldsnested_optionsrv   nested_namesr   optionsnew_optionsoriginal_optionss               r,   __apply_nested_optionzSchema.__apply_nested_option  s    TSSSS$T**$1 	8 	8 FL6")),7777 !5!5!7!788 	I 	ILC..11K&t';C'@+rRR D G++4>>2B#C#CCK N224>>2B#C#CCKD(-{KHHHH	I 	Ir.   c                   | j         j        r |                     | j         j                  }nZ|                     | j                                                  }| j         j        r"||                     | j         j                  z  }|                                 }| j        #|                     | j                  }|||z
  z  }n|}| j        r|| j        z
  }|| j        |z
  z  }|rd|  d| d}t          |          | 	                                }|D ]I}| j        
                    |t          j                              }|                     ||           |||<   J| 	                                | 	                                }	}|                                D ]\  }}|j        s|||<   |j        s||	|<   d |	                                D             t#                    t#          t%                              k    r-fdD             }
t          dt'          |
                     d |                                D             t#                    t#          t%                              k    r-fd	D             }t          d
t'          |                     || _        |	| _        || _        dS )zUpdate self.fields, self.load_fields, and self.dump_fields based on schema options.
        This method is private API.
        NzInvalid fields for z: r   c                4    g | ]\  }}|j         |j         n|S rd   r   )r)   rJ   r   s      r,   r-   z'Schema._init_fields.<locals>.<listcomp><  s<     
 
 
i #,"4"@Id
 
 
r.   c                F    h | ]}                     |          d k    |S r-  count)r)   xdump_data_keyss     r,   r   z&Schema._init_fields.<locals>.<setcomp>A  s8     $ $ $^-A-A!-D-Dq-H-H-H-H-Hr.   zThe data_key argument for one or more fields collides with another field's name or data_key argument. Check the following field names and data_key arguments: c                &    g | ]\  }}|j         p|S r'   )r  )r)   rJ   r   s      r,   r-   z'Schema._init_fields.<locals>.<listcomp>J  s#    VVVYT33=0DVVVr.   c                F    h | ]}                     |          d k    |S rH  rI  )r)   rK  load_attributess     r,   r   z&Schema._init_fields.<locals>.<setcomp>L  s8     % % %o.C.CA.F.F.J.J.J.J.Jr.   zThe attribute argument for one or more fields collides with another field's name or attribute argument. Check the following field names and attribute arguments: )rG   r   r5  r   keysr   r   r   r   r   rT   	ma_fieldsInferred_bind_fieldr/   r   r   r  r   rX   r   r   )r   available_field_namesinvalid_fieldsr<  messagefields_dictr*   r   r   r   data_keys_duplicatesattributes_duplicatesrL  rO  s               @@r,   r   zSchema._init_fields  sL    9 	N$(NN493C$D$D!!$(NN43G3L3L3N3N$O$O!y# N%	8L)M)MM%))9 :>..:S:SKk,AAANN/K < 	C &4Kdl-BBBN 	&EDEENEEEGW%%%oo''% 	0 	0J,00Y=O=Q=QRRIZ333&/K
###'??#4#4doo6G6G[%0%6%6%8%8 	4 	4!J	& 4*3J'& 4*3J'
 
#.#4#4#6#6
 
 
 ~#c.&9&9":":::$ $ $ $)$ $ $  D (,,@'A'AD D   WV+BSBSBUBUVVV3s?';';#<#<<<% % % %*% % %! F )--B(C(CF F   "&&r.   r*   r   r"   c                    dS )zqHook to modify a field when it is bound to the `Schema <marshmallow.Schema>`.

        No-op by default.
        Nr'   )r   r*   r   s      r,   on_bind_fieldzSchema.on_bind_fieldZ  s	    
 	r.   c                b   || j         v rd|_         || j        v rd|_        	 |                    ||            n`# t          $ rS}t	          |t
                    r8t          |t          j                  rd| d|j	         d}t          |          | d}~ww xY w| 
                    ||           dS )zBind field to the schema, setting any necessary attributes on the
        field (e.g. parent and name).

        Also set field load_only and dump_only values if field_name was
        specified in `class Meta <marshmallow.Schema.Meta>`.
        TzField for "zJ" must be declared as a Field instance, not a class. Did you mean "fields.z()"?N)r   r   _bind_to_schema	TypeErrorr   rD   
issubclassr	   r(   r{   r[  )r   r*   r   r   msgs        r,   rS  zSchema._bind_fielda  s     ''"&I''"&I	%%j$7777 	 	 	 )T** 0z)T]/S/S 0E* E E,5,>E E E 
  nn%/	 	:y11111s   9 
BABB)r   ry   c               j    |                      |d|||          }|                      |d|||          S )NF)r!  r   rm   r   T_invoke_processors)r   ry   r   rm   r   s        r,   r   zSchema._invoke_dump_processors|  sS     &&5t$m ' 
 
 &&4d] ' 
 
 	
r.   c               n    |                      |d||||          }|                      |d||||          S )NT)r!  r   rm   r   r   Frb  )r   ry   r   rm   r   r   s         r,   r#  zSchema._invoke_load_processors  sa     &&' ' 
 
 &&' ' 
 
 	
r.   c          	        | j         t                   D ]J\  }}}t          | |          }|d         }	 | j        |         }	n4# t          $ r'}
|| j        v rY d }
~
Ft          d| d          |
d }
~
ww xY w|	j        |	j        n|}|r}t          |          D ]l\  }}	 ||	j	        p|         }| 
                    ||||| j        j        r|nd           }|t          u r|                    |d            ]# t          $ r Y iw xY w	 ||	j	        p|         }| 
                    ||||          }|t          u r|                    |d            ;# t          $ r Y Hw xY wd S )Nr*   "z" field does not exist.r   )r   r   r*   r   )rh   r   r7   r   rq   r   r   r   r  r  r   rG   r   r   pop)r   r   r   rm   ro   r_   validator_kwargs	validatorr*   r   r   r   r   itemr   validated_values                   r,   r%  zSchema._invoke_field_validators  s	   .2k).D +	3 +	3*Iq*i00I),7JU K
3		 U U U!555HHHH !HZ!H!H!HIIuTU '0&8&D	""*   3!*4 7 7IC7 $Y%8%FJ G +/*>*>(1!&'/(3*.)*@#J33d +? + + +g55 HHZ666 $   7 3 !4!B
CE '+&:&:$-"#+$/	 '; ' 'O ''11T222     DC+	3 +	3sA   A
A2	A-A--A2C33
D ?D E
EE)r"  r!  r"  c               p   | j         t                   D ]\  }}	}
|	|k    rt          | |          }|r	|
d         r(|
                    dd          }|rF|sDt	          t          ||                    D ]%\  }\  }}|                     ||||||||           &|                     |||||||           d S )Nskip_on_field_errorsr  F)r   r   rm   r   r   r  )r   r   rm   r  r   )rh   r   r7   rT   r  zipr  )r   r   r!  r   r   rm   r   r"  ro   	hook_manyrh  ri  r  r   rj  origs                   r,   r'  z Schema._invoke_schema_validators  s)    7;kBR6S 	 	2Iy"2I%%i00I  01G H ,00%HHM I )23t]3K3K)L)L 
 
%C$''!&*$/! '!&3 ( 	 	 	 	
 ##"/ +"/# $    +	 	r.   c               .   | j         |         D ]\  }}}	||k    rt          | |          |	                    dd          }
r4|s2|
rfdt          ||          D             }Xfd|D             }i|
r ||fdi}x |fdi}|S )Nr  Fc                .    g | ]\  }} ||fd iS r   r'   )r)   rj  originalrn   rm   	processors      r,   r-   z-Schema._invoke_processors.<locals>.<listcomp>  sF       *D( "	$FFtFvFF  r.   c                &    g | ]} |fd iS r   r'   )r)   rj  rn   rm   rt  s     r,   r-   z-Schema._invoke_processors.<locals>.<listcomp>  s0    RRRTIId@@@@@RRRr.   rm   )rh   r7   rT   r   )r   ry   r!  r   rm   r   rn   ro   ro  processor_kwargsr  rt  s       ` `    @r,   rc  zSchema._invoke_processors  s    7;k#6F 	< 	<2Iy"2I%%i00I,00%HHM <I <  S     .9$.N.N  DD
 SRRRRRTRRRDD < y}JJ4J6JJ y;;D;F;;r.   )r   r   r   r   rm   r   r   r   r   r   r   r   r   r   r   r   )r#   rK   )r#   ra   )r   rI   rJ   rK   r#   r   )r   r   r   rF   rm   r   )r   rF   rw   rK   r   rF   )r   rF   rm   r   )r   rF   rm   r   )r   r   r   r   rm   r   r#   r   )r   r   rm   r   r   r   r   r   )r  r  rm   r   r   r   r   r   )r  r  r   r   rm   r   r   r   r  r   r   r  )r   r   rm   r   r   r   r#   r  )
r   r   rm   r   r   r   r   r   r  r   )r#   r)  )r*   rK   r   r"   r#   r)  )ry   rK   rm   r   )ry   rK   rm   r   r   r   )r   r   rm   r   )
r   r   r!  r   rm   r   r   r   r"  r   )ry   rK   r!  r   rm   r   )Hr{   r|   r}   r~   rK   rQ  StringbytesdtdatetimeDateTimefloatFloatr   Booleanr   RawrX   r   intIntegeruuidUUIDtimeTimedateDate	timedelta	TimeDeltadecimalDecimalr   r   r   r   r   rH   r   r5  r6   rh   rE   re   r   propertyr   r   r   r   r   staticmethodr   r   r   r   r   r   r  r  r  r  r  r   r4  r   r[  rS  r   r#  r%  r'  rc  r'   r.   r,   r   r     s        2 2j 	Yy
Y'yiy}imY]Y	9>


i)*-L    " &(N'''' &#/ /    
 %M$$$$I )+++++68F8888Y Y Y Y Y Y Y Y| /3*, #,.,.8<"4' 4' 4' 4' 4' 4'l@ @ @ @    X 
 &	C C C C C [C@   - - - - MQ     \& ;@      $ <@            D AE J J J J J J2 p p p p p pr !8<"!
 !
 !
 !
 !
 !
N !8<"L L L L L LV !%I %I %I %I %I %I\ !8<     N !8<" e e e e e eN   "I I I I&I' I' I' I'V   2 2 2 28 <@
 
 
 
 
 

 
 
 
8,3 ,3 ,3 ,3n #( ( ( ( ( (b        r.   r   )	metaclass)r#   r$   )r2   r3   )Br~   
__future__r   r   rz  ry  r  r=   r;   r   r?   r   r  r   abcr   collectionsr   r   collections.abcr   	itertoolsr   marshmallowr	   r
   r   r   rQ  marshmallow.decoratorsr   r   r   r   r   r   marshmallow.error_storer   marshmallow.exceptionsr   r   r   marshmallow.orderedsetr   marshmallow.utilsr   r   r   r   r   r   r   r   r    marshmallow.warningsr!   TYPE_CHECKINGmarshmallow.fieldsr"   r1   rB   r3   r   	SchemaABCr   
BaseSchemar'   r.   r,   <module>r     s   | | " " " " " "                       0 0 0 0 0 0 0 0 # # # # # # ! ! ! ! ! ! 3 3 3 3 3 3 3 3 3 3 + + + + + +                / . . . . . T T T T T T T T T T - - - - - -
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 > = = = = =	 )((((((	 	 	 	   .z z z z z z z zz-1 -1 -1 -1 -1 -1 -1 -1`V V V V VT^z V V V Vr  


r.   