+
    n9e.                     Z   ^ RI HtHtHtHtHtHtHtHtH	t	 ^ RI H
t ^ RI Ht ^ RItR tR tR tR tR	 tR
 t ! R R]4      tR!tR tR t]! 4       tR t]]]R]]3R ltR t ! R R]4      t]R]R/t/ t R t!R t"R t#]]3R lt$RR!]]3R lt%RR!]]3R lt&R t'/ t(R t)R t*R]3R  lt+R# )"    )	CheckedPMapCheckedPSetCheckedPVectorCheckedTypeInvariantException_restore_pickleget_typemaybe_parse_user_typemaybe_parse_many_user_types)optional)wrap_invariantNc                 N   \        \        V Uu. uF6  p\        VP                  P	                  V/ 4      P                  4       4      NK8  	  up. 4      4      W&   \        V P                  4       4       F*  w  rE\        V\        4      '       g   K  WPV,          V&   W K,  	  R # u upi N)dictsumlist__dict__getitems
isinstance_PField)dctbasesnamebkvs   &&&   :/usr/lib/python3/dist-packages/pyrsistent/_field_common.py
set_fieldsr      s|    S%P%Q$qzz~~dB7==?@%PRTUVCISYY[!a!!IaL " Qs   <B"c                    a  \         ;QJ d    . R  V 3R lV 4        4       F  NK  	  5M! R  V 3R lV 4        4       4      pV'       d   \        VRR4      hR# )c              3   >   "   T F  w  rV'       d   K  Vx  K  	  R # 5ir    ).0is_ok
error_codes   &  r   	<genexpr>*check_global_invariants.<locals>.<genexpr>   s"      WH (9uPU #
Hs   
c              3   2   <"   T F  q! S4      x  K  	  R # 5ir   r"   )r#   	invariantsubjects   & r   r&   r'      s     HZ	7++Zs   zGlobal invariant failedNr"   )tupler   )r*   
invariantserror_codess   f& r   check_global_invariantsr.      sT    % WHZHW%% WHZHW WK b2KLL     c                 t    \        V\        4      '       d   V \        J d   VP                  V4      # V ! W4      # r   )r   r   PFIELD_NO_SERIALIZER	serialize)
serializerformatvalues   &&&r   r2   r2   !   s1    %%%*8L*Lv&&f$$r/   c                 h  a VP                   '       d   \        ;QJ d)    V3R  lVP                    4       F  '       g   K   RM	  RM! V3R  lVP                    4       4      '       gI   \        S4      pRP                  V P                  W$P                  4      p\	        WVP                   WE4      hR# R# )c              3   N   <"   T F  p\        S\        V4      4      x  K  	  R # 5ir   )r   r	   )r#   tr5   s   & r   r&   check_type.<locals>.<genexpr>)   s     Qjj<<js   "%TFz'Invalid type for field {0}.{1}, was {2}N)typeanyr4   __name__
PTypeError)destination_clsfieldr   r5   actual_typemessages   &&&f  r   
check_typerB   (   sw    zzz##QejjQ###QejjQQQ5k;BB?C[C[]acwcwx

KQQ Rzr/   c                     \        V4      \        J d   R # \        V4      p\        V4      ^ 8X  d   R# \	        \        V^ ,          4      V 4      # )TF)r:   setr+   len
issubclassr	   )type_cls
field_typetypess   && r   is_type_clsrJ   /   s@    J3*E
5zQhuQx((33r/   c                     V'       g   R # \        WP                  4      '       g   R # R\        P                  ! VP                  4      P
                  9   # )Fignore_extra)rJ   r:   inspect	signaturefactory
parameters)rG   r?   rL   s   &&&r   is_field_ignore_extra_complaintrQ   8   s:    x,,W..u}}=HHHHr/   c                   :   a  ] tR t^Dt o RtR t]R 4       tRtV t	R# )r   c                N    Wn         W n        W0n        W@n        WPn        W`n        R # r   r:   r)   initial	mandatory_factoryr3   )selfr:   r)   rU   rV   rO   r3   s   &&&&&&&r   __init___PField.__init__G   s     	""$r/   c                   V P                   \        J db   \        V P                  4      ^8X  dH   \	        \        V P                  4      ^ ,          4      p\        V\        4      '       d   VP                  # V P                   # )   )	rW   PFIELD_NO_FACTORYrE   r:   r	   r+   rF   r   create)rX   typs   & r   rO   _PField.factoryO   sY     ==--#dii.A2E5+A./C#{++zz!}}r/   )rW   rU   r)   rV   r3   r:   NrT   )
r<   
__module____qualname____firstlineno__	__slots__rY   propertyrO   __static_attributes____classdictcell__)__classdict__s   @r   r   r   D   s#     WI%  r/   r   c                     R# )T)TNr"   )_s   &r   <lambda>rk   Z   s    r/   c                     V # r   r"   )xs   &r   rk   rk   [   s    ar/   c                     V# r   r"   )rj   r5   s   &&r   rk   rk   ]   s    r/   Fc           	         \        V \        \        \        34      '       d   \        \	        V 4      4      pM\        \        V 4      4      pV\        8w  d   \        V4      '       d   \        V4      MTp\        WgVW4VR7      p\        V4       V# )a  
Field specification factory for :py:class:`PRecord`.

:param type: a type or iterable with types that are allowed for this field
:param invariant: a function specifying an invariant that must hold for the field
:param initial: value of field if not specified when instantiating the record
:param mandatory: boolean specifying if the field is mandatory or not
:param factory: function called when field is set.
:param serializer: function that returns a serialized version of the field
)r:   r)   rU   rV   rO   r3   )r   r   rD   r+   r   r
   PFIELD_NO_INVARIANTcallabler   r   _check_field_parameters)	r:   r)   rU   rV   rO   r3   rI   invariant_functionr?   s	   &&&&&&   r   r?   r?   `   s}    , $sE*++/56)$/06?CV6V[cdm[n[n	2t}g'ZQE E"Lr/   c                 8  a  S P                    FT  p\        V\         4      '       d   K  \        V\        4      '       d   K3  \        R P	                  \        V4      4      4      h	  S P
                  \        Jd   \        S P
                  4      '       g   S P                   '       d   \        ;QJ d)    V 3R lS P                    4       F  '       g   K   RM	  RM! V 3R lS P                    4       4      '       g.   \        RP	                  \        S P
                  4      4      4      h\        S P                  4      '       g   \        R4      h\        S P                  4      '       g   \        R4      h\        S P                  4      '       g   \        R4      hR# )	z Type parameter expected, not {0}c              3   P   <"   T F  p\        SP                  V4      x  K  	  R # 5ir   )r   rU   )r#   r8   r?   s   & r   r&   *_check_field_parameters.<locals>.<genexpr>   s     "TA:emmQ#?#?s   #&TFzInitial has invalid type {0}zInvariant must be callablezFactory must be callablezSerializer must be callableN)r:   r   str	TypeErrorr4   rU   PFIELD_NO_INITIALrq   r;   r)   rO   r3   )r?   r8   s   f r   rr   rr      s   ZZ!T"":a+=+=>EEd1gNOO  }}--''JJJss"T"Tsss"T"TTT6==d5==>QRSSEOO$$455EMM""233E$$%%566 &r/   c                   6   a a ] tR t^t oRtV 3R ltRtVtV ;t# )r=   z
Raised when trying to assign a value with a type that doesn't match the declared type.

Attributes:
source_class -- The class of the record
field -- Field name
expected_types  -- Types allowed for the field
actual_type -- The non matching type
c                `   < \         \        V `
  ! V/ VB  Wn        W n        W0n        W@n        R # r   )superr=   rY   source_classr?   expected_typesr@   )rX   r}   r?   r~   r@   argskwargs	__class__s   &&&&&*,r   rY   PTypeError.__init__   s.    j$($9&9(
,&r/   )r@   r~   r?   r}   )	r<   ra   rb   rc   __doc__rY   rf   rg   __classcell__)r   rh   s   @@r   r=   r=      s     ' 'r/   r=   PVectorPSetc                4    \         W3,          p\        W24      # )z=Unpickling function for auto-generated PVec/PSet field types.)_seq_field_typesr   )checked_class	item_typedatatype_s   &&& r   _restore_seq_field_pickler      s    ]56E5''r/   c                2    RP                  R V  4       4      # )z4Convert a tuple of types to a human-readable string. c              3   h   "   T F(  p\        V4      P                  P                  4       x  K*  	  R # 5ir   )r	   r<   
capitalize)r#   r_   s   & r   r&   "_types_to_names.<locals>.<genexpr>   s&     H%38C=))4466%s   02)join)rI   s   &r   _types_to_namesr      s    77H%HHHr/   c                   a aa \         P                  S S34      pVe   V#  ! V VV3R lRS 4      p\        S ,          p\        VP                  4      V,           Vn        V\         S S3&   V# )zFCreate a subclass of the given checked class with the given item type.c                   <   <a  ] tR t^t o  Zt ZtVV3R ltRtV tR# )%_make_seq_field_type.<locals>.TheTypec                ,   < \         SS\        V 4      33# r   )r   r   )rX   r   r   s   &r   
__reduce__0_make_seq_field_type.<locals>.TheType.__reduce__   s    -"ItDz:< <r/   r"   N)	r<   ra   rb   rc   __type____invariant__r   rf   rg   )rh   r   item_invariantr   s   @r   TheTyper      s     &	< 	<r/   r   )r   r   SEQ_FIELD_TYPE_SUFFIXESr   _checked_typesr<   )r   r   r   r   r   suffixs   fff   r   _make_seq_field_typer      sm      -!;<E< <- < %]3F&w'='=>GG18]I-.Nr/   c           	        a \        WV4      oV'       d
   RV3R llpMSP                  p\        V'       d   \        S4      MSVRVV! V4      R7      # )ah  
Create checked field for either ``PSet`` or ``PVector``.

:param checked_class: ``CheckedPSet`` or ``CheckedPVector``.
:param item_type: The required type for the items in the set.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param initial: Initial value to pass to factory.

:return: A ``field`` containing a checked class.
c                 6   < V f   R # SP                  WVR7      # )N)_factory_fieldsrL   r^   )argumentr   rL   r   s   &&&r   rO    _sequence_field.<locals>.factory   s     ~~h^j~kkr/   T)r:   rO   rV   r)   rU   )NF)r   r^   r?   optional_type)r   r   r   rU   r)   r   rO   r   s   &&&&&& @r   _sequence_fieldr      sS     #=^LG	l 	l ..mG,g D$ )+ +r/   c           	     *    \        \        WVVVR7      # )aL  
Create checked ``PSet`` field.

:param item_type: The required type for the items in the set.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param initial: Initial value to pass to factory if no value is given
    for the field.

:return: A ``field`` containing a ``CheckedPSet`` of the given type.
r)   r   )r   r   r   r   rU   r)   r   s   &&&&&r   
pset_fieldr      s     ;	W%.*8: :r/   c           	     *    \        \        WVVVR7      # )aU  
Create checked ``PVector`` field.

:param item_type: The required type for the items in the vector.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param initial: Initial value to pass to factory if no value is given
    for the field.

:return: A ``field`` containing a ``CheckedPVector`` of the given type.
r   )r   r   r   s   &&&&&r   pvector_fieldr      s     >9%.*8: :r/   c                     R# )T)Tr   r"   )items   &r   rk   rk     s    jr/   c                4    \         W3,          p\        W24      # )z8Unpickling function for auto-generated PMap field types.)_pmap_field_typesr   )key_type
value_typer   r   s   &&& r   _restore_pmap_field_pickler     s    h23E5''r/   c                   a a \         P                  S S34      pVe   V#  ! V V3R lR\        4      pRP                  \	        VP
                  4      \	        VP                  4      4      Vn        V\         S S3&   V# )zDCreate a subclass of CheckedPMap with the given key and value types.c                   4   <a  ] tR tRt o  Zt ZtR tRtV tR# )%_make_pmap_field_type.<locals>.TheMapi$  c                R    \         V P                  V P                  \        V 4      33# r   )r   __key_type____value_type__r   )rX   s   &r   r   0_make_pmap_field_type.<locals>.TheMap.__reduce__(  s+    .&&(;(;T$ZHJ Jr/   r"   N)	r<   ra   rb   rc   r   r   r   rf   rg   )rh   r   r   s   @r   TheMapr   $  s     #	J 	Jr/   r   z{0}To{1}PMap)r   r   r   r4   r   _checked_key_types_checked_value_typesr<   )r   r   r   r   s   ff  r   _make_pmap_field_typer     s~    !!8Z"89EJ J J %++1123346FO /5h
*+Mr/   c                   a \        W4      oV'       d   V3R lpMSP                  p\        RS! 4       V'       d   \        S4      MSWCR7      # )aD  
Create a checked ``PMap`` field.

:param key: The required type for the keys of the map.
:param value: The required type for the values of the map.
:param optional: If true, ``None`` can be used as a value for
    this field.
:param invariant: Pass-through to ``field``.

:return: A ``field`` containing a ``CheckedPMap``.
c                 2   < V f   R # SP                  V 4      # r   r   )r   r   s   &r   rO   pmap_field.<locals>.factoryB  s    }}X..r/   T)rV   rU   r:   rO   r)   )r   r^   r?   r   )r   r   r   r)   rO   r   s   &&&& @r   
pmap_fieldr   3  sD     #88F	/ --4/7mF+V 7 7r/   r"   ),pyrsistent._checked_typesr   r   r   r   r   r   r	   r
   r   r   r   r   rM   r   r.   r2   rB   rJ   rQ   objectr   PFIELD_NO_TYPErp   r]   ry   r1   r?   rr   rx   r=   r   r   r   r   r   r   r   r   _validr   r   r   r   r"   r/   r   <module>r      s  
 
 
 @ 4 M%R4If * ,  H -  )<FW#4AU!H7(' '& I   (
I( 2#6+> $)",1:& ',R/!4:& 
!  (
* /4?R 7r/   