
    \Di.                       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  SSKJr  SS	KJr  \
R2                  (       a  SS
KJr  SrSrSr\\\1r " S S5      r \ " 5       r!S3S jr"S3S jr#S3S jr$S3S jr%S3S jr&S4S jrS5S jr'S6S jr(S7S jr)\	RT                  " S5      r+\	RT                  " S5      r,\	RT                  " S5      r-S8S jr.S r/S r0S r1S9S  jr2S9S! jr3    S:S" jr4S:S# jr5S7S$ jr6S;S% jr7S<S& jr8S=S' jr9S>S( jr:\!4S?S) jjr;S* r<S+ r=S@S, jr>S- r?SAS. jr@SAS/ jrASBS0 jrBSCS1 jrCSDS2 jrDg)Ez Utility methods for marshmallow.    )annotationsN)Mapping)format_datetimeparsedate_to_datetime)pprint)FieldABC)FieldInstanceResolutionError)RemovedInMarshmallow4Warning)Fieldexcludeincluderaisec                  ,    \ rS rSrS rS rS rS rSrg)_Missing    c                    g)NF selfs    Y/var/www/html/Aiprofessor/professorTrac/lib/python3.13/site-packages/marshmallow/utils.py__bool___Missing.__bool__!   s        c                    U $ Nr   r   s    r   __copy___Missing.__copy__$       r   c                    U $ r   r   )r   _s     r   __deepcopy___Missing.__deepcopy__'   r   r   c                    g)Nz<marshmallow.missing>r   r   s    r   __repr___Missing.__repr__*   s    &r   r   N)	__name__
__module____qualname____firstlineno__r   r   r!   r$   __static_attributes__r   r   r   r   r       s    'r   r   c                h    [         R                  " U 5      =(       d    [         R                  " U 5      $ )z%Return True if ``obj`` is a generator)inspectisgeneratorfunctionisgeneratorobjs    r   is_generatorr1   4   s#    &&s+Gw/B/B3/GGr   c                n    [        U S5      =(       a    [        U S5      (       + =(       d    [        U 5      $ )zAReturn True if ``obj`` is an iterable object that isn't a string.__iter__strip)hasattrr1   r/   s    r   is_iterable_but_not_stringr6   9   s)    C$BWS'-B)BX|TWGXXr   c                P    [        U 5      =(       a    [        U [        5      (       + $ )zGReturn True if ``obj`` is a collection type, e.g list, tuple, queryset.)r6   
isinstancer   r/   s    r   is_collectionr9   >   s    %c*K:c73K/KKr   c                P     [        X5      $ ! [         a    [        X5      s $ f = f)zFReturn True if ``val`` is either a subclass or instance of ``class_``.)
issubclass	TypeErrorr8   )valclass_s     r   is_instance_or_subclassr?   C   s,    '#&& '#&&'s   
 %%c                H    [        U [        5      =(       a    [        U S5      $ )zbReturn True if ``obj`` has keyed tuple behavior, such as
namedtuples or SQLAlchemy's KeyedTuples.
_fields)r8   tupler5   r/   s    r   is_keyed_tuplerC   K   s     c5!=gc9&==r   c                    [         R                  " S[        SS9  [        U [        R
                  5      (       a$  [        [        R                  " U /UQ70 UD65        g[        U /UQ70 UD6  g)zPretty-printing function that can pretty-print OrderedDicts
like regular dictionaries. Useful for printing the output of
:meth:`marshmallow.Schema.dump`.

.. deprecated:: 3.7.0
    marshmallow.pprint will be removed in marshmallow 4.
zQmarshmallow's pprint function is deprecated and will be removed in marshmallow 4.   )
stacklevelN)
warningswarnr
   r8   collectionsOrderedDictprintjsondumps	py_pprint)r0   argskwargss      r   r   r   R   s[     MM[$
 #{..//djj.t.v./#'''r   c                f    U R                   S L=(       a    U R                   R                  U 5      S L$ r   )tzinfo	utcoffsetdatetimes    r   is_awarerV   f   s-    t#W(A(A((KSW(Wr   c                    [        U 5      $ )zParse a RFC822-formatted datetime string and return a datetime object.

https://stackoverflow.com/questions/885015/how-to-parse-a-rfc-2822-date-time-into-a-python-datetime  # noqa: B950
)r   )
datestrings    r   from_rfcrY   l   s    
 !,,r   c                    [        U 5      $ )zaReturn the RFC822-formatted representation of a datetime object.

:param datetime: The datetime.
)r   rT   s    r   	rfcformatr[   t   s    
 8$$r   z(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})[T ](?P<hour>\d{1,2}):(?P<minute>\d{1,2})(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?(?P<tzinfo>Z|[+-]\d{2}(?::?\d{2})?)?$z4(?P<year>\d{4})-(?P<month>\d{1,2})-(?P<day>\d{1,2})$zd(?P<hour>\d{1,2}):(?P<minute>\d{1,2})(?::(?P<second>\d{1,2})(?:\.(?P<microsecond>\d{1,6})\d{0,6})?)?c                   [        U [        R                  5      (       a  U R                  5       S-  n U S:  a  SOSnSR                  " [        [        U 5      S5      6 nX-   n[        R                  " [        R                  " U S9U5      $ )z6Return a tzinfo instance with a fixed offset from UTC.<   r   -+z{:02d}{:02d})minutes)r8   dt	timedeltatotal_secondsformatdivmodabstimezone)offsetsignhhmmnames       r   get_fixed_timezonerl      so    &",,''%%'2-1*3#D  &Vb"9:D;D;;r||F3T::r   c                \   [         R                  U 5      nU(       d  [        S5      eUR                  5       nUS   =(       a    US   R	                  SS5      US'   UR                  S5      nUS:X  a  [        R                  R                  nOMUbJ  [        U5      S:  a  [        US	S 5      OS
nS[        USS 5      -  U-   nUS
   S:X  a  U* n[        U5      nUR                  5        VVs0 s H  u  pgUc  M
  U[        U5      _M     nnnX2S'   [        R                  " S0 UD6$ s  snnf )zParse a string and return a datetime.datetime.

This function supports time zone offsets. When the input contains one,
the output uses a timezone with a fixed offset from UTC.
z-Not a valid ISO8601-formatted datetime stringmicrosecond   0rR   ZN   r   r]      r^   r   )_iso8601_datetime_rematch
ValueError	groupdictljustpopra   rg   utclenintrl   itemsrU   )valuerv   kwrR   offset_minsrh   kvs           r   from_iso_datetimer      s    !&&u-EHII		B=)Mb.?.E.Ea.MB}VVHF}		*-f+/c&+&qc&1+&&4!9WF#F+ "
	<
a)!SV)
B	<xL;; 
=s   .	D(;D(c                V   [         R                  U 5      nU(       d  [        S5      eUR                  5       nUS   =(       a    US   R	                  SS5      US'   UR                  5        VVs0 s H  u  p4Uc  M
  U[        U5      _M     nnn[        R                  " S0 UD6$ s  snnf )z]Parse a string and return a datetime.time.

This function doesn't support time zone offsets.
z)Not a valid ISO8601-formatted time stringrn   ro   rp   r   )	_iso8601_time_rerv   rw   rx   ry   r~   r}   ra   time)r   rv   r   r   r   s        r   from_iso_timer      s    
 ""5)EDEE		B=)Mb.?.E.Ea.MB} "
	<
a)!SV)
B	<77=R= 
=s   /	B%<B%c                    [         R                  U 5      nU(       d  [        S5      eUR                  5       R	                  5        VVs0 s H  u  p#U[        U5      _M     nnn[        R                  " S0 UD6$ s  snnf )z*Parse a string and return a datetime.date.z)Not a valid ISO8601-formatted date stringr   )_iso8601_date_rerv   rw   rx   r~   r}   ra   date)r   rv   r   r   r   s        r   from_iso_dater      sf    ""5)EDEE % 1 7 7 9	: 9!SV) 9B	:77=R= 
;s   	A:c                Z   U SL d  U SL a  [        S5      e[        U 5      n U S:  a  [        S5      e [        R                  R	                  U [        R
                  R                  S9R                  S S9$ ! [         a  n[        S5      UeS nAf[         a  n[        S5      UeS nAff = f)	NTFzNot a valid POSIX timestampr   )tzrR   zTimestamp is too largez"Error converting value to datetime)
rw   floatra   rU   fromtimestamprg   r{   replaceOverflowErrorOSError)r   excs     r   from_timestampr      s    }677%LEqy677H{{((2;;??(CKKSWKXX <12; H=>CGHs$   AA6 6
B* BB*B%%B*c                4    [        U 5      n [        U S-  5      $ Ni  )r   r   r   s    r   from_timestamp_msr      s    %LE%$,''r   c                    [        U 5      (       d'  U R                  [        R                  R                  S9n U R                  5       $ )Nr   )rV   r   ra   rg   r{   	timestampr   s    r   r   r      s2     E??R[[__5??r   c                    [        U 5      S-  $ r   )r   r   s    r   timestamp_msr      s    Ud""r   c                "    U R                  5       $ )zbReturn the ISO8601-formatted representation of a datetime object.

:param datetime: The datetime.
)	isoformatrT   s    r   r   r      s    
 r   c                @    [         R                  R                  U 5      $ r   )ra   r   r   )r   s    r   to_iso_timer          77T""r   c                @    [         R                  R                  U 5      $ r   )ra   r   r   )r   s    r   to_iso_dater      r   r   c                d    [        U [        5      (       a  U R                  S5      n [        U 5      $ )Nzutf-8)r8   bytesdecodestr)r=   s    r   ensure_text_typer      s&    #ujj!s8Or   c                6    U  Vs/ s H  o"U   PM	     sn$ s  snf )zExtracts a list of dictionary values from a list of dictionaries.
::

    >>> dlist = [{'id': 1, 'name': 'foo'}, {'id': 2, 'name': 'bar'}]
    >>> pluck(dlist, 'id')
    [1, 2]
r   )dictlistkeyds      r   pluckr      s     %%HqcFH%%%s   c                    [        U[        5      (       d!  SU;   a  [        XR                  S5      U5      $ [	        XU5      $ )a  Helper for pulling a keyed value off various types of objects. Fields use
this method by default to access attributes of the source object. For object `x`
and attribute `i`, this method first tries to access `x[i]`, and then falls back to
`x.i` if an exception is raised.

.. warning::
    If an object `x` does not raise an exception when `x[i]` does not exist,
    `get_value` will never check the value `x.i`. Consider overriding
    `marshmallow.fields.Field.get_value` in this case.
.)r8   r}   _get_value_for_keyssplit_get_value_for_keyr0   r   defaults      r   	get_valuer     s9     c3C3J"3		#@@c00r   c                x    [        U5      S:X  a  [        XS   U5      $ [        [        XS   U5      USS  U5      $ )Nrt   r   )r|   r   r   )r0   keysr   s      r   r   r     sC    
4yA~!#Aw883Q148W r   c                    [        U S5      (       d  [        XU5      $  X   $ ! [        [        [        [
        4 a    [        XU5      s $ f = f)N__getitem__)r5   getattrKeyError
IndexErrorr<   AttributeErrorr   s      r   r   r   &  sM    3&&s))*xj)^< *s))*s   # &AAc                    SU;   a\  UR                  SS5      u  p4U R                  U0 5      n[        U[        5      (       d  [	        SU SU SU 35      e[        XTU5        gX U'   g)zSet a value in a dict. If `key` contains a '.', it is assumed
be a path (i.e. dot-delimited string) to the value's location.

::

    >>> d = {}
    >>> set_value(d, 'foo.bar', 42)
    >>> d
    {'foo': {'bar': 42}}
r   rt   zCannot set z in z due to existing value: N)r   
setdefaultr8   dictrw   	set_value)dctr   r   headresttargets         r   r   r   0  sq     czYYsA&
b)&$''cU$tf,DVHM  	&&Cr   c                F    [        U 5      (       d  [        SU < S35      eU $ )z@Check that an object is callable, else raise a :exc:`TypeError`.Object z is not callable.)callabler<   r/   s    r   callable_or_raiser   G  s%    C=='#(9:;;Jr   c                p    [        [        R                  " U 5      R                  R	                  5       5      $ r   )listr,   	signature
parametersr   funcs    r   
_signaturer   N  s'    !!$'22779::r   c                   [         R                  " U 5      (       d  [         R                  " U 5      (       a  [        U 5      $ [	        U [
        R                  5      (       a  [        U R                  5      $ [        U 5      $ )zGiven a callable, return a list of argument names. Handles
`functools.partial` objects and class-based callables.

.. versionchanged:: 3.0.0a1
    Do not return bound arguments, eg. ``self``.
)r,   
isfunctionismethodr   r8   	functoolspartialr   r   s    r   get_func_argsr   R  s]     $7#3#3D#9#9$$	))**$))$$dr   c                    [        U [        5      (       a"  [        U [        5      (       d  [        eU " 5       $ [        U [        5      (       d  [        eU $ )zjReturn a field instance from a field class or instance.

:param cls_or_instance: Field class or instance.
)r8   typer;   r   r	   )cls_or_instances    r   resolve_field_instancer   a  sF    
 /4((/844..  ox00**r   c                Z    U R                   S-  U R                  -   S-  U R                  -   $ )zCompute the total microseconds of a timedelta

https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/datetime.py#L665-L667  # noqa: B950
iQ i@B )dayssecondsmicrosecondsr   s    r   timedelta_to_microsecondsr   o  s,    
 JJ)$u}}4?%BTBTTTr   c                :    U [         ;  a  [        SU < S35      eU $ )Nr   z1 is not a valid value for the 'unknown' parameter)_UNKNOWN_VALUESrw   r/   s    r    validate_unknown_parameter_valuer   w  s+    
/!cWMN
 	
 Jr   )returnbool)r   None)rU   dt.datetimer   r   )rX   r   r   r   )rU   r   r   r   )rh   zfloat | dt.timedeltar   zdt.timezone)r   
typing.Anyr   r   )r   r   r   r   )r   zdt.timer   r   )r   zdt.dater   r   )r=   zstr | bytesr   r   )r   zlist[dict[str, typing.Any]]r   r   )r   z	int | str)r   zdict[str, typing.Any]r   r   r   r   )r   ztyping.Callabler   z	list[str])r   ztype[Field] | Fieldr   r   )r   zdt.timedeltar   r}   )r0   r   r   r   )E__doc__
__future__r   rI   rU   ra   r   r,   rL   retypingrG   collections.abcr   email.utilsr   r   r   rN   marshmallow.baser   marshmallow.exceptionsr	   marshmallow.warningsr
   TYPE_CHECKINGmarshmallow.fieldsr   EXCLUDEINCLUDERAISEr   r   missingr1   r6   r9   r?   rC   rV   rY   r[   compileru   r   r   rl   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   <module>r      sj   & #      	   # > & % ? =	( 
GU+' '" *H
Y
L
'>((-% zz-  ::UV ::G ;2H"(

# ##& ,3 1 *.;Ur   