
    E#i                       S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSK	r	SSK
r
SSKrSSKJr  SSKJrJr  SSKJr  SSKJrJrJr  SS	KJr  SS
KJrJrJrJrJrJr  SSK J!r!  SSK"J#r#J$r$  SSK%J&r&  SSK'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0  SSKJ1r1  \	Rd                  " S5      r3S r4S r5 " S S\5      r6 " S S5      r7 " S S\Rp                  \6S9r9\9r:g)zLThe :class:`Schema` class, including its metaclass and options (class Meta).    )annotationsN)ABCMeta)OrderedDictdefaultdict)Mapping   )baseclass_registrytypes)fields)	POST_DUMP	POST_LOADPRE_DUMPPRE_LOAD	VALIDATESVALIDATES_SCHEMA)
ErrorStore)StringNotCollectionErrorValidationError)
OrderedSet)	EXCLUDEINCLUDERAISE	get_valueis_collectionis_instance_or_subclassmissing	set_value validate_unknown_parameter_value)RemovedInMarshmallow4Warning_Tc                    U R                  5        VVs/ s H)  u  p[        U[        R                  5      (       d  M&  X4PM+     snn$ s  snnf )zCGet fields from a class

:param attrs: Mapping of class attributes
)itemsr   r	   FieldABC)attrs
field_namefield_values      e/home/james-whalen/.local/lib/python3.13/site-packages/ccxt/static_dependencies/marshmallow/schema.py_get_fieldsr)   .   sE     (-{{}'4#J";> 	"!'4  s
   %AAc                `    [         R                  " U 5      n[        S USSS2    5       / 5      $ )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 type klass: Class whose fields to retrieve
c              3  b   #    U  H%  n[        [        US UR                  5      5      v   M'     g7f)_declared_fieldsN)r)   getattr__dict__).0r	   s     r(   	<genexpr>%_get_fields_by_mro.<locals>.<genexpr>F   s6      	
 # 0$--@  #s   -/Nr   )inspectgetmrosum)klassmros     r(   _get_fields_by_mror8   <   s=     ..
C	
 EQrE
		
 	     c                  j   ^  \ rS rSrSrU 4S jr\\4       SS jj5       rU 4S jr	S	S jr
SrU =r$ )

SchemaMetaP   zMetaclass 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`` options.
c                0  > UR                  S5      n[        USS5      nU(       dQ  U HI  n[        US5      (       d  M  [        UR                  S5      (       d  M3  UR                  R                  n  O   Sn[        U5      nU H  u  pX8	 M	     [        TU ]  XX#5      n
[        U
5      nU
R                  nU
R                  XES9U
l
        U[        U
R                  R                  R                  5       5      -  nU R                  U
UU[        S9U
l        U
$ )NMetaorderedF)r?   )r6   
cls_fieldsinherited_fieldsdict_cls)getr-   hasattrr>   r?   r)   super__new__r8   OPTIONS_CLASSoptslistincluder#   get_declared_fieldsdictr,   )mcsnamebasesr%   metar?   base_r@   r&   _r6   rA   	__class__s               r(   rF   SchemaMeta.__new__W   s   yy $	51
 5&))gejj).L.L#jj00G 
   '
 (MJ! (58-e4zz (((?
d5::--33566
 "%!8!8!-	 "9 "
 r9   c                    U" X2-   5      $ )a  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 options.

:param klass: The class object.
:param cls_fields: The fields declared on the class, including those added
    by the ``include`` class Meta option.
:param inherited_fields: Inherited fields.
:param dict_cls: dict-like class to use for dict output Default to ``dict``.
 )rM   r6   r@   rA   rB   s        r(   rK   SchemaMeta.get_declared_fields}   s    $ (566r9   c                   > [         TU ]  XU5        U(       a1  U R                  R                  (       a  [        R                  " X5        U R                  5       U l        g N)rE   __init__rH   registerr
   resolve_hooks_hooks)clsrN   rO   r%   rS   s       r(   rZ   SchemaMeta.__init__   s?    e,CHH%%##D.&&(
r9   c                \   [         R                  " U 5      n[        [        5      n[	        U 5       HU  nU H  n UR
                  U   n  O   M   UR                  nUR                  5        H  nX'   R                  U5        M     MW     U$ ! [         a     Mc  f = f! [         a     My  f = f)zAdd in the decorated processors

By doing this after constructing the class, we let standard inheritance
do all the hard work.
)r3   r4   r   rI   dirr.   KeyError__marshmallow_hook__keysappendAttributeError)r^   r7   hooks	attr_nameparentattrhook_configkeys           r(   r\   SchemaMeta.resolve_hooks   s     nnS!D!SI !??95D   1"77 '++-C J%%i0 .- "6 )    " s#   BB
BB
B+*B+rV   )r6   typer@   rI   rA   rI   rB   rn   )returnzdict[types.Tag, list[str]])__name__
__module____qualname____firstlineno____doc__rF   classmethodrL   rK   rZ   r\   __static_attributes____classcell__)rS   s   @r(   r;   r;   P   s\    $L  77 7 	7
 7 7&)% %r9   r;   c                  &    \ rS rSrSrSSS jjrSrg)
SchemaOpts   z=class Meta options for the :class:`Schema`. Defines defaults.c                   [        USS5      U l        [        U R                  [        [        45      (       d  [        S5      e[        USS5      U l        [        U R                  [        [        45      (       d  [        S5      eU R                  (       a  U R                  (       a  [        S5      e[        USS5      U l        [        U R                  [        [        45      (       d  [        S5      e[        US	S 5      U l        [        US
S 5      U l	        [        USS 5      U l
        [        US5      (       a,  [        R                  " S[        SS9  [        US[        5      nO[        n[        USU5      U l        [        USU5      U l        [        USS5      U l        [        US0 5      U l        [        USS5      U l        [        USS5      U l        [-        [        US[.        5      5      U l        [        USS5      U l        g )Nr   rV   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_moduler?   index_errorsTrJ   	load_only	dump_onlyunknownr[   )r-   r   
isinstancerI   tuple
ValueErrorr|   r}   r~   r   r   rD   warningswarnr    jsonr   r?   r   rJ   r   r   r   r   r   r[   )selfrP   r?   r   s       r(   rZ   SchemaOpts.__init__   s   dHb1$++e}55GHH!$b9$//D%=99KLL;;4??(  tY3$,,u66ABB!$d;%d,<dC!$d;4''MM],
 $D->M M$T?MJtY8#D.$?tY3 {B7 {B77iQV8WXj$7r9   )r|   r~   r   r   r}   r   rJ   r   r   r?   r[   r   r   r   N)F)r?   bool)rp   rq   rr   rs   rt   rZ   rv   rV   r9   r(   ry   ry      s    G"8 "8r9   ry   c                     \ rS rSrSr\\R                  \\R                  \	R                  \R                  \\R                  \\R                  \\R"                  \\R"                  \\R"                  \\R*                  \R.                  \R.                  \	R0                  \R2                  \	R4                  \R6                  \	R8                  \R:                  \R>                  \R>                  0r 0 r!SSS.r"\#r$\%r&Sr'0 r(0 r) " S S5      r*SS	S
SS	S	SSS.               S3S jjr+S4S jr,\-S5S j5       r.\/SS.     S6S jj5       r0      S7S jr1S8S jr2\3SS.S j5       r4S
S.S9S jjr5SS.S:S jjr6SS.S:S jjr7S
S\8SS.       S;S jjr9SSSS.       S<S jjr:SSSS.       S=S jjr;SS.S jr<SSS .       S>S! jjr=SSSS"S#.         S?S$ jjr>S@S% jr?S@S& jr@S@S' jrASAS( jrBSAS) jrCSBS* jrDSS+.   SCS, jjrE      SDS- jrFSES. jrGS
S/.         SFS0 jjrHSS+.     SGS1 jjrIS2rJg)HSchema   a  Base schema class with which to define custom schemas.

Example usage:

.. code-block:: python

    import datetime as dt
    from dataclasses import dataclass

    from . 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.

.. versionchanged:: 2.0.0
    `__validators__`, `__preprocessors__`, and `__data_handlers__` are removed in favor of
    `marshmallow.decorators.validates_schema`,
    `marshmallow.decorators.pre_load` and `marshmallow.decorators.post_dump`.
    `__accessor__` and `__error_handler__` are deprecated. Implement the
    `handle_error` and `get_attribute` methods instead.
zInvalid input type.zUnknown field.)rn   r   Nc                      \ rS rSrSrSrg)Schema.MetaiD  a~  Options object for a Schema.

Example usage: ::

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

Available options:

- ``fields``: Tuple or list of fields to include in the serialized result.
- ``additional``: Tuple or list of fields to include *in addition* to the
    explicitly declared fields. ``additional`` and ``fields`` are
    mutually-exclusive options.
- ``include``: Dictionary of additional fields to include in the schema. It is
    usually better to define fields as class variables, but you may need to
    use this option, e.g., if your fields are Python keywords. May be an
    `OrderedDict`.
- ``exclude``: Tuple or list of fields to exclude in the serialized result.
    Nested fields can be represented with dot delimiters.
- ``dateformat``: Default format for `Date <fields.Date>` fields.
- ``datetimeformat``: Default format for `DateTime <fields.DateTime>` fields.
- ``timeformat``: Default format for `Time <fields.Time>` fields.
- ``render_module``: Module to use for `loads <Schema.loads>` and `dumps <Schema.dumps>`.
    Defaults to `json` from the standard library.
- ``ordered``: If `True`, output of `Schema.dump` will be a `collections.OrderedDict`.
- ``index_errors``: If `True`, errors dictionaries will include the index
    of invalid items in a collection.
- ``load_only``: Tuple or list of fields to exclude from serialized results.
- ``dump_only``: Tuple or list of fields to exclude from deserialization
- ``unknown``: Whether to exclude, include, or raise an error for unknown
    fields in the data. Use `EXCLUDE`, `INCLUDE` or `RAISE`.
- ``register``: Whether to register the `Schema` with marshmallow's internal
    class registry. Must be `True` if you intend to refer to this `Schema`
    by class name in `Nested` fields. Only set this to `False` when memory
    usage is critical. Defaults to `True`.
rV   N)rp   rq   rr   rs   rt   rv   rV   r9   r(   r>   r   D  s    $	r9   r>   rV   F)onlyr}   manycontextr   r   partialr   c               @   Ub  [        U5      (       d  [        S5      e[        U5      (       d  [        S5      e[        R                  " U R                  5      U l        X0l        Xl        [        U R                  R                  5      [        U5      -  U l
        U R                  R                  U l        [        U5      =(       d    [        U R                  R                  5      U l        [        U5      =(       d    [        U R                  R                  5      U l        Xpl        Uc  U R                  R                  O
[!        U5      U l        U=(       d    0 U l        U R%                  5         0 U l        0 U l        0 U l        U R-                  5         0 n	U	R/                  U R0                  5        [3        U R4                  R6                  5       H  n
U	R/                  [9        U
S0 5      5        M!     U	R/                  U R:                  =(       d    0 5        Xl        g )Nz""only" should be a list of stringsz%"exclude" should be a list of stringserror_messages)r   r   copydeepcopyr,   declared_fieldsr   r   setrH   r}   r?   r   r   r   r   r   r   _normalize_nested_optionsr   load_fieldsdump_fields_init_fieldsupdate_default_error_messagesreversedrS   __mro__r-   r   )r   r   r}   r   r   r   r   r   r   messagesr^   s              r(   rZ   Schema.__init__k  s    M$$7$7*+OPPW%%*+RSS#}}T-B-BC		HKIII
LI yy((YC3tyy/B/B+CYC3tyy/B/B+C  II1': 	
 }"&&(445DNN223COOGC)92>? 4++1r2&r9   c                P    SU R                   R                   SU R                   S3$ )N<z(many=z)>)rS   rp   r   r   s    r(   __repr__Schema.__repr__  s&    4>>**+6$))B??r9   c                <    U R                   (       a  [        $ [        $ rY   )r?   r   rL   r   s    r(   
dict_classSchema.dict_class  s    "ll{44r9   GeneratedSchema)rN   c                   UR                  5       n[        S[        U S[        5      4SS05      US'   [        X 4U5      nU$ )a4  Generate a `Schema` class given a dictionary of fields.

.. code-block:: python

    from . 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 dict fields: Dictionary mapping field names to field instances.
:param str name: Optional name for the class, which will appear in
    the ``repr`` for the class.

.. versionadded:: 3.0.0
GeneratedMetar>   r[   F)r   rn   r-   object)r^   r   rN   r%   
schema_clss        r(   	from_dictSchema.from_dict  sK    2 gc66:<z5>Q
f $.
r9   c                   g)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.

.. versionadded:: 2.0.0

.. versionchanged:: 3.0.0rc9
    Receives `many` and `partial` (on deserialization) as keyword arguments.
NrV   )r   errordatar   kwargss        r(   handle_errorSchema.handle_error  s     	r9   c                    [        XU5      $ )zDefines how to pull values from an object to serialize.

.. versionadded:: 2.0.0

.. versionchanged:: 3.0.0a1
    Changed position of ``obj`` and ``attr``.
)r   )r   objrj   defaults       r(   get_attributeSchema.get_attribute  s     G,,r9   indexc                    U " U5      nU$ ! [          a=  nUR                  UR                  X$S9  UR                  =(       d    [        s SnA$ SnAff = f)ay  Call ``getter_func`` with ``data`` as its argument, and store any `ValidationErrors`.

:param callable getter_func: Function for getting the serialized/deserialized
    value from ``data``.
:param data: The data passed to ``getter_func``.
:param str field_name: Field name.
:param int 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_storeSchema._call_and_store  sT    	/%E   	/##ENNJ#L ##.w.		/s    
A2AAAr   c                  U(       aN  UbK  [         R                  " [         R                  [           U5       Vs/ s H  nU R	                  USS9PM     sn$ U R                  5       nU R                  R                  5        HI  u  pVUR                  XQU R                  S9nU[        L a  M*  UR                  b  UR                  OUnXtU'   MK     U$ s  snf )zSerialize ``obj``.

:param obj: The object(s) to serialize.
:param bool many: `True` if ``data`` should be serialized as a collection.
:return: A dictionary of the serialized data

.. versionchanged:: 1.0.0
    Renamed from ``marshal``.
Fr   )accessor)typingcastIterabler!   
_serializer   r   r#   	serializer   r   data_key)	r   r   r   dretrh   	field_objr   rl   s	            r(   r   Schema._serialize  s     CO  V__R%8#>>A .>  oo$($4$4$:$:$< I''	ASAS'TE(1(:(:(F)$$ICH %= 
s   Cc                  Uc  U R                   O
[        U5      nU R                  [        5      (       a  U R	                  [        XUS9nOUnU R                  X2S9nU R                  [        5      (       a  U R	                  [        XBUS9nU$ )aB  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.
)r   original_datar   )r   r   _has_processorsr   _invoke_dump_processorsr   r   )r   r   r   processed_objresults        r(   dumpSchema.dump  s    " !Ltyyd4j)) 88# 9 M  M:	**116C 2 F r9   c               t    U R                  XS9nU R                  R                  R                  " U/UQ70 UD6$ )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   rH   r   dumps)r   r   r   argsr   
serializeds         r(   r   Schema.dumps.  s9     YYsY.
yy&&,,ZI$I&IIr9   )r   r   r   r   c               
  ^ U R                   R                  nU(       a  UOSnU(       a  [        T5      (       d"  UR                  U R                  S   /US9  / nU$ [        T5       V	V
s/ s Hl  u  p[        R                  " [        U R                  [        R                  " [        R                  [        [        R                  4   U
5      USUUU	S95      PMn     nn	n
U$ U R                  5       n[        T[        5      (       d   UR                  U R                  S   /US9  U$ [        U5      nU R                  R!                  5        H  u  pUR"                  b  UR"                  OUnTR%                  U[&        5      nU[&        L a  USL d  U(       a  X;   a  MR  0 nU(       aC  US-   n[)        U5      nU Vs/ s H   nUR+                  U5      (       d  M  UUS PM"     nnUUS'   OUb  UUS'   XU4U4S	 jjnU R-                  UUUUUS
9nU[&        Ld  M  UR.                  =(       d    Un[1        UUU5        M     U[2        :w  a  U R                  R!                  5        VVs1 s H   u  pUR"                  b  UR"                  OUiM"     nnn[5        T5      U-
   HO  nTU   nU[6        :X  a  UUU'   M  U[8        :X  d  M%  UR                  U R                  S   /UU(       a  UOS5        MQ     U$ s  sn
n	f s  snf s  snnf )a   Deserialize ``data``.

:param dict data: The data to deserialize.
:param ErrorStore error_store: Structure to store errors.
:param bool many: `True` if ``data`` should be deserialized as a collection.
:param bool|tuple 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 int index: Index of the item being serialized (for storing errors) if
    serializing a collection, otherwise `None`.
:return: A dictionary of the deserialized data.
Nrn   r   F)r   r   r   r   r   T.r   c                .   > UR                   " U UT40 UD6$ rY   )deserialize)valr   r&   d_kwargsr   s       r(   getter#Schema._deserialize.<locals>.getter  s+     %00" #	 r9   r   r   r&   r   r   r   )rH   r   r   r   r   	enumerater   r   r!   _deserializer   strAnyr   r   r   r#   r   rC   r   len
startswithr   	attributer   r   r   r   r   )r   r   r   r   r   r   r   r   ret_lidxr   ret_dpartial_is_collectionrh   r   r&   	raw_valuer   prefix
len_prefixfsub_partialr   r   rl   r   s    `                        r(   r   Schema._deserialize?  s   8 yy--%4 &&'')<)<V)D(EU'S  L #,D/ #2 KK))"KKsFJJ(GK(3!&$+$+"% * 
 #2   L!$((##T%8%8%@$A#Oz w %2'$:!(,(8(8(>(>(@$	*3*<*<*HI&&i  !HHZ9	'$-)2F ('#-F!$VJ07#0711<<;O*+   # +6HY'(*1HY' $-h ,, &") + -  '#--:CeS%0U )AV '! 261A1A1G1G1I1I-
 +4*<*<*HI&&jX1I   t9v-C IE')%*c
 E)#//!00;<&2U . _J#8s   *A3K4;K:	K:''K?r   r   r   c               $    U R                  XX4SS9$ )a  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r   r   r   postprocess)_do_load)r   r   r   r   r   s        r(   loadSchema.load  s!    > }}W4  
 	
r9   c               p    U R                   R                  R                  " U40 UD6nU R                  XbX4S9$ )a  Same as :meth:`load`, except it takes a JSON string as input.

:param json_data: A JSON 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  )rH   r   loadsr  )r   	json_datar   r   r   r   r   s          r(   r  Schema.loads  s6    : yy&&,,YA&Ayy'yKKr9   c                    U(       a  U" X#XeS9  g U" X&US9  g ! [          a/  n	UR                  U	R                  U	R                  US9   S n	A	g S n	A	ff = f)N)r   r   r   )r   r   r   r&   )
r   validator_funcoutputr   r   r   r   pass_originalr   errs
             r(   _run_validatorSchema._run_validator  sN    	OvgQvTB 	O##CLL#..#N	Os     
A%AAr   r   c                    U R                  XUSS9  0 $ ! [         aW  n[        R                  " [        R                  [
        [        R                  [
           4   UR                  5      s SnA$ SnAff = f)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)r   r   r  N)r  r   r   r   Dictr   Listr   )r   r   r   r   excs        r(   validateSchema.validate
  sa    0	QMM$7MN 	  	Q;;v{{3C0@+@A3<<PP	Qs    
A6AA1+A61A6Tr  c          
        [        5       n0 nUc  U R                  O
[        U5      nUc  U R                  O
[	        U5      nUc  U R
                  nU R                  [        5      (       a   U R                  [        XXS9nOUnU(       d  U R                  WUUUUS9n
U R                  XjUS9  U R                  [        5      (       a?  [        UR                  5      nU R                  USU
UUUUS9  U R                  USU
UUUUS9  UR                  nU(       d9  U(       a2  U R                  [         5      (       a   U R                  [         U
UUUS9n
U(       a  [        XqW
S9nU R#                  XX#S	9  UeW
$ ! [         a  n	U	R                  5       nSn
 Sn	A	GNSn	A	ff = f! [         a  n	U	R                  5       n Sn	A	NnSn	A	ff = f)
a  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)r   r   r   )r   r   r   r   )r   r   r   T)r   	pass_manyr   r   r   r   field_errorsF)r   r   r  )r   r   r   r   r   r   r   r   _invoke_load_processorsr   normalized_messagesr   _invoke_field_validatorsr   errors_invoke_schema_validatorsr   r   )r   r   r   r   r   r  r   r"  processed_datar  r   r  r  s                r(   r  Schema._do_load*  s   8 !l Ltyyd4j  LL1': 	
 ?llG))!%!=!=dT "> " "N&&' ' F ))'4 *  ##$455#K$6$67.. +""&#!- /  .. +#"&#!- /  !''Fkd.B.B9.M.M	7!99!!&* ' : F !&GCcdDIs # 002d ' 7 446F7s0   +E7 ;F! 7
FFF!
G+G  Gc           	        U R                   b`  U R                  SU R                   S5        U R                  U R                    Vs/ s H  oR                  SS5      S   PM     sn5      U l         U R                  (       aW  U R                  SU R                  S5        U R                  U R                   Vs/ s H  nSU;  d  M  UPM     sn5      U l        ggs  snf s  snf )	zFApply then flatten nested schema options.
This method is private API.
Nr   intersectionr   r   r   r}   union)r   _Schema__apply_nested_option	set_classsplitr}   )r   fields     r(   r    Schema._normalize_nested_options  s     99 &&vtyy.IDII'VI5C(;A(>I'VWDI<<&&y$,,H>>$(LLEL5Cu4DLEDL	  (W Fs   C5
CCc                   U Vs/ s H  nSU;   d  M  UR                  SS5      PM     nn[        [        5      nU H  u  pxXg   R                  U5        M     [	        UR                  5       5       H  u  pU R                  U
5      n[        U R                  U	   US5      nU(       a2  US:X  a  XR                  U5      -  nUS:X  a  XR                  U5      -  n[        U R                  U	   X5        M     gs  snf )z%Apply nested options to nested fieldsr   r   rV   r(  r'  N)
r+  r   rI   re   iterr#   r*  r-   r   setattr)r   option_namefield_namesset_operationrN   nested_fieldsnested_optionsri   nested_namesrl   optionsnew_optionsoriginal_optionss                r(   __apply_nested_optionSchema.__apply_nested_option  s     9DSsd{+C+S$T*$1 F")),7 %2 !!5!5!78LC..1K&t';';C'@+rR G+>>2B#CCK N2>>2B#CCKD((-{H 9 Ts
   
C8C8c                   U R                   R                  (       a&  U R                  U R                   R                  5      nOkU R                  U R                  R	                  5       5      nU R                   R
                  (       a'  XR                  U R                   R
                  5      -  nU R                  5       nU R                  b#  U R                  U R                  5      nX#U-
  -  nOUnU R                  (       a  X0R                  -
  nX R                  U-
  -  nU(       a  SU  SU S3n[        U5      eU R                  5       nU HG  nU R                  R                  U[        R                  " 5       5      nU R                  Xg5        XuU'   MI     U R                  5       U R                  5       pUR                  5        H1  u  pgUR                  (       d  XxU'   UR                   (       a  M-  XyU'   M3     U	R                  5        V
Vs/ s H   u  pUR"                  b  UR"                  OU
PM"     nn
n[%        U5      [%        ['        U5      5      :w  a?  U Vs1 s H  oR)                  U5      S:  d  M  UiM     nn[        S[+        U5       35      eUR                  5        V
Vs/ s H  u  pUR,                  =(       d    U
PM     nn
n[%        U5      [%        ['        U5      5      :w  a?  U Vs1 s H  oR)                  U5      S:  d  M  UiM     nn[        S[+        U5       35      eXPl        Xl        Xl        gs  snn
f s  snf s  snn
f s  snf )zpUpdate self.fields, self.load_fields, and self.dump_fields based on schema options.
This method is private API.
NzInvalid fields for z: r   r   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: 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: )rH   r   r*  r   rd   r|   r   r}   r   r   rC   	ma_fieldsInferred_bind_fieldr#   r   r   r   r   r   countrI   r   r   r   )r   available_field_namesinvalid_fieldsr2  messagefields_dictr&   r   r   r   rN   dump_data_keysxdata_keys_duplicatesr   load_attributesattributes_duplicatess                    r(   r   Schema._init_fields  s    99$(NN4993C3C$D!$(NN43G3G3L3L3N$O!yy##%		8L8L)MM%)99 :>..:SK,AAAN/K << &4Kll-BBBN+D6N3C1EGW%%oo'%J,,00Y=O=O=QRIZ3&/
# &
 $(??#4doo6G[%0%6%6%8!J&&*3J'&&&*3J'	 &9 $/#4#4#6
#6 #,"4"4"@IdJ#6 	 
 ~#c.&9"::)$)a-A-A!-Dq-H> ! $ ' (,,@'A&BD  CNBSBSBUVBUYT3==0D0BUV3s?';#<<*%*a.C.CA.F.J? " % ( )--B(C'DF  "&&9

$ W%s$   'MM9M+!M4MMc                    g)zLHook to modify a field when it is bound to the `Schema`.

No-op by default.
NrV   )r   r&   r   s      r(   on_bind_fieldSchema.on_bind_field   s    
 r9   c                p   XR                   ;   a  SUl         XR                  ;   a  SUl         UR                  X5        U R                  X5        g! [         aZ  n[	        U[
        5      (       a>  [        U[        R                  5      (       a  SU SUR                   S3n[        U5      UeUeSnAff = f)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``.
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   rn   
issubclassr	   r$   rp   rL  )r   r&   r   r   msgs        r(   r?  Schema._bind_field  s     '"&I'"&I	%%j7 	:1  	 )T**z)T]]/S/S!* .,,5,>,>+?tE 
  n%/K	s   A 
B5AB00B5c                f    [        U R                  US4   =(       d    U R                  US4   5      $ )NTF)r   r]   )r   tags     r(   r   Schema._has_processors"  s,    DKKd,IS%L0IJJr9   )r   c               N    U R                  USX#US9nU R                  USX#US9nU$ )NF)r  r   r   r   T_invoke_processors)r   rU  r   r   r   s        r(   r   Schema._invoke_dump_processors%  sI     &&5tm ' 
 &&4d] ' 
 r9   c          	     V    U R                  USUUUUS9nU R                  USUUUUS9nU$ )NT)r  r   r   r   r   FrX  )r   rU  r   r   r   r   s         r(   r  Schema._invoke_load_processors3  s[     &&' ' 
 &&' ' 
 r9   c          
     (   U R                   [            GH  n[        X5      nUR                  [           nUS   n U R                  U   nUR                  b  UR                  OUn
U(       a}  [        U5       Hl  u  p XR                  =(       d    U   nU R                  UUU
UU R                  R                  (       a  UOS S9nU[        L a  X+   R                  US 5        Ml  Mn     M   X(R                  =(       d    U   nU R                  UUU
US9nU[        L a  UR                  US 5        GM  GM!     g ! [
         a+  n	XpR                  ;   a   S n	A	GMD  [        SU S35      U	eS n	A	ff = f! [
         a     GM  f = f! [
         a     GM|  f = f)Nr&   "z" field does not exist.r   )r   r   r&   r   )r]   r   r-   rc   r   rb   r   r   r   r   r   r   rH   r   r   pop)r   r   r   r   rh   	validatorvalidator_kwargsr&   r   r   r   r   itemr   validated_values                  r(   r!  Schema._invoke_field_validatorsP  s   Y/I0I(==iH),7JU KK
3	 '0&8&8&D	""*  !*4IC< $%8%8%FJ G +/*>*>(1!&'/(3*.))*@*@3d +? + +g5 IMM*d; 6 "1 3 !4!4!B
CE '+&:&:$-"#+$/	 '; 'O ''1T2 2W 0  U!5!55 1ZL0G!HIuTU $    sA   D8>E0+F8
E-E(E((E-0
E?>E?
FF)r  c               |   U R                   [        U4    H  n[        X5      n	U	R                  [        U4   n
U(       a  U
S   (       a  M6  U
R	                  SS5      nU(       a?  U(       d8  [        [        X45      5       H  u  nu  pU R                  U	UUUUUUUS9  M      M  U R                  U	UUUUUUS9  M     g )Nskip_on_field_errorsr  F)r   r   r   r   r   r  )r   r   r   r  r   )r]   r   r-   rc   rC   r   zipr  )r   r   r  r   r   r   r   r  rh   r`  ra  r  r   rb  origs                  r(   r#   Schema._invoke_schema_validators  s     &6	%BCI0I(==!9-   01G H,00%HMI)23t3K)L%C$''!&*$/! '!&3 ( 	 *M ##"/ +"/# $ - Dr9   c          
        X4nU R                   U    H  n[        X5      n	U	R                  U   n
U
R                  SS5      nU(       aT  U(       dM  U(       a*  [	        X55       VVs/ s H  u  pU	" X4SU0UD6PM     nnnMn  U Vs/ s H  o" U4SU0UD6PM     nnM  U(       a  U	" X54SU0UD6nM  U	" U4SU0UD6nM     U$ s  snnf s  snf )Nr  Fr   )r]   r-   rc   rC   rg  )r   rU  r  r   r   r   r   rl   rh   	processorprocessor_kwargsr  rb  originals                 r(   rY  Schema._invoke_processors  s     S)I0I(==cB,00%HMI  /2$.F.FND "$FtFvF.F  D
 NRRTTId@@@TDRD $TNtNvND$T???D' *( 
 Ss   %CC)r   r   r   r   r   r}   r   r   r   r   r   r?   r   r   )r   ztypes.StrSequenceOrSet | Noner}   types.StrSequenceOrSetr   r   r   zdict | Noner   ro  r   ro  r   $bool | types.StrSequenceOrSet | Noner   
str | None)ro   r   )ro   rn   )r   z!dict[str, ma_fields.Field | type]rN   r   ro   rn   )r   r   r   
typing.Anyr   r   )r   rr  rj   r   r   rr  )r   z_T | typing.Iterable[_T]r   r   )r   rr  r   bool | None)r   Rtyping.Mapping[str, typing.Any] | typing.Iterable[typing.Mapping[str, typing.Any]]r   r   r   r   ro   z_T | list[_T])r   rt  r   rs  r   rp  r   rq  )r  r   r   rs  r   rp  r   rq  )r   rt  r   rs  r   rp  ro   zdict[str, list[str]])
r   rt  r   rs  r   rp  r   rq  r  r   )ro   None)r&   r   r   zma_fields.Fieldro   ru  )ro   r   )rU  r   r   r   )rU  r   r   r   r   rp  )r   r   r   r   )
r   r   r  r   r   r   r   rp  r  r   )rU  r   r  r   r   r   )Krp   rq   rr   rs   rt   r   r=  StringbytesdtdatetimeDateTimefloatFloatr   Booleanr   RawrI   r   intIntegeruuidUUIDtimeTimedateDate	timedelta	TimeDeltadecimalDecimalTYPE_MAPPINGr   r   ry   rG   r   r*  rH   r,   r]   r>   rZ   r   propertyr   ru   r   r   r   staticmethodr   r   r   r   r   r   r  r  r  r  r  r   r)  r   rL  r?  r   r   r  r!  r#  rY  rv   rV   r9   r(   r   r      s"   9x 	Yy
Y''yiy}}immY]]Y		9>>


i))**L" N &#
 MI DF% %T /3*,#,.,.8<"-' ,-' (	-'
 -' -' *-' *-' 6-' -'^@ 5 5 
 &	1 	
 
 B$,6AE"- MQ  & IN 0 <@  D AE J2 r?r  r r 
rv !8<"!
?!
 !
 6!
 !
N !8<"LL 	L
 6L LT O6 !8<?  6 
N !8<" e?e e 6e e eN"I&I'V26K <@'+
  6:-3p #)  ) 	) ) 6) )d  	  r9   r   )	metaclass);rt   
__future__r   r   ry  rx  r  r3   r   r   r  r   abcr   collectionsr   r   collections.abcr    r	   r
   r   r   r=  
decoratorsr   r   r   r   r   r   r   r   
exceptionsr   r   
orderedsetr   utilsr   r   r   r   r   r   r   r   r   r    TypeVarr!   r)   r8   r;   ry   	SchemaABCr   
BaseSchemarV   r9   r(   <module>r     s    R "          0 # ) ) !  $ A "
 
 
 3^^D	(l l^%8 %8PbT^^z bJ 
r9   