
    Ǆg                        U d 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
mZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$ ddl%m&Z& g dZ' e#d      Z( e#d      Z) e#d	      Z* e#d
      Z+dZ,dZ- G d de      Z.eZ/eZ0ee0ge!ee   e/f   f   Z1eee   e/ge0f   Z2eZ3ee/ge3f   Z4ee3ge/f   Z5edee6   ge6f   Z7ee6gee!ee/e6f      f   Z8e!e.df   Z9ee0ge!ee!e.ef      ef   f   Z: G d de      Z; ejx                         Z=i Z>ee"e   e;f   e?d<    G d de      Z@i ZAee"e   e@f   e?d<   i ZBee6e"e   f   e?d<   ej                  j                  d      ZEdZFg ZGee   e?d<   dddddde"e   de1de2dee6   d ee4   d!ee5   d"ee:   d#dfd$ZHde"e   de6d#dfd%ZI e&d&eJ'      	 	 ddddddde"e   de1de2d(ee7   d)ee8   dee6   d ee4   d!ee5   d"ee:   d#dfd*       ZKdddddde"e   de1de2dee6   d ee4   d!ee5   d"ee:   d#dfd+ZL ej                  d,-       G d. d/ee(                ZN e#d0e1      ZO ej                  d,-       G d2 d3eeOe(f                ZP ej                  d,-       G d4 d5             ZQd6e!edf   d#e!ee   e/f   fd7ZRd6e!edf   d#e!ee!e.ef      e/f   fd8ZSd9ee   d:e/d#e!edf   fd;ZTd6ee   d#e!ee   e/f   fd<ZUd6ee   d#e!ee!e.ef      e/f   fd=ZVd9ee   d:e/d#ee   fd>ZWd6eeef   d#e!ee   e/f   fd?ZXd6eeef   d#e!ee!e.ef      e/f   fd@ZYd9ee   d:e/d#eeef   fdAZZd6ed#e!ee   e/f   fdBZ[d6ed#e!ee!e.ef      e/f   fdCZ\d9ee   d:e/d#efdDZ]d:e/d#e3fdEZ^dFe3d#e/fdGZ_d6eeef   d#e!ee   e/f   fdHZ`d6eeef   d#e!ee!e.ef      e/f   fdIZad9ee   d:e/d#eeef   fdJZbe`ZcebZdd6eeef   d#e!ee   e/f   fdKZed6eeef   d#e!ee!e.ef      e/f   fdLZfd9ee   d:e/d#eeef   fdMZgd:e/d#e3fdNZhdFe3d#e/fdOZid6ee   d#e!ee   e/f   fdPZjd6ee   d#e!ee!e.ef      e/f   fdQZkd9ee   d:e/d#ee   fdRZl eLemeReTdSeST        eLeneUeWdUeVT        eLeoeXeZdVeYT        eLee[e]dWe^e_e\        eLee`ebdXeaT        eLe
eeegdYeheief        eLeejeldZekT        epeoee
h      Zqeer   e?d[<    epemeneoeee
eh      Zseer   e?d\<   d]ed#etfd^Zud]ed#efd_Zvdd]e0d`eee0getf      d#etfdaZw ej                  d,d,d,db       G dc d             Zx G dd deex      Zy ey       Zz	 dd]e0dfee   d`eee0getf      d#exfdgZ{	 dd]e0d`eee0getf      d#e!ee   exf   fdhZ|dfee   diexd#e0fdjZ}	 dd]e0d`eee0getf      d#ee   fdkZ~	 dd]e0d`eee0getf      d#ee   fdlZ	 dd]e0d`eee0getf      d#exfdmZddndoedef   d]e0dpe0d`eee0getf      d#e0f
dqZddndoedef   d]e0dpe0d`eee0getf      d#e0f
drZe!e"e(   e"e)   f   Ze!e"e(   e"e)   e"e*   f   Zej
                  dsk\  re$e"e   e!e"e   df   ej                  f   Zne$e"e   e!e"e   df   f   Zee$e(e)f   ge+f   Zee$e(e)e*f   ge+f   Zee(ge+f   Zeege+f   Zee(geegef   f   Zedtee(e)f   d#eee(e)ef      fdu       Zedtee(e)e*f   d#eee(e)e*ef      fdv       Zedte"e(   d#eee(ef      fdw       Zedted#eee      fdx       Zedteegetf   d#eee      fdy       Zdte$eeegetf   f   d#eee      fdzZe	 ddte"e(   doee(ef   d]e0d`eee0getf      d#e0f
d{       Ze	 ddtee(e)f   doee(e)ef   d]e0d`eee0getf      d#e0f
d|       Ze	 ddtee(e)e*f   doee(e)e*ef   d]e0d`eee0getf      d#e0f
d}       Ze	 ddteegetf   doee   d]e0d`eee0getf      d#e0f
d~       Z	 ddte$eeegetf   f   doee   d]e0d`eee0getf      d#e0f
dZe	 ddte"e(   doee(ef   d]e0d`eee0getf      d#e0f
d       Ze	 ddtee(e)f   doee(e)ef   d]e0d`eee0getf      d#e0f
d       Ze	 ddtee(e)e*f   doee(e)e*ef   d]e0d`eee0getf      d#e0f
d       Ze	 ddteegetf   doee   d]e0d`eee0getf      d#e0f
d       Z	 ddte$eeegetf   f   doee   d]e0d`eee0getf      d#e0f
dZ	 ddeegetf   d]e0d`eee0getf      d#etfdZ	 ddeegetf   d]e0d`eee0getf      d#etfdZe	 dde"e(   dee(etf   d]e0d`eee0getf      d#etf
d       Ze	 ddee(e)f   dee(e)etf   d]e0d`eee0getf      d#etf
d       Ze	 ddee(e)e*f   dee(e)e*etf   d]e0d`eee0getf      d#etf
d       Z	 ddedeet   d]e0d`eee0getf      d#etf
dZe	 dde"e(   dee(etf   d]e0d`eee0getf      d#etf
d       Ze	 ddee(e)f   dee(e)etf   d]e0d`eee0getf      d#etf
d       Ze	 ddee(e)e*f   dee(e)e*etf   d]e0d`eee0getf      d#etf
d       Z	 ddedeet   d]e0d`eee0getf      d#etf
dZ	 dd]e0diexd`eee0getf      d#eee      fdZej                   G d d             Z G d de      Zi Zeeef   e?d<   diexd#efdZde3d#exfdZ eee      ed<   ddiexdee   d#e6fdZde6d#exfdZ G d d      Zdiexd#e6fdZ e&deJ'      diexd#e6fd       Z e&deJ'      de6d#exfd       Zde0de0d#ee   fdZ	 dd]e0d`eee0getf      d#e!ee!e9ef      exf   fdZ	 dd]e0d`eee0getf      d#ee!e9ef      fdZ	 dde9d]e0d`eee0getf      d#ee!e9ef      fdZddndoedef   d]e0dpe0d`eee0getf      d#e0f
dZde9d#e6fdZdede9d#efdZy)a  
Contains utility functions for working with nested python data structures.

A *pytree* is Python nested data structure. It is a tree in the sense that
nodes are Python collections (e.g., list, tuple, dict) and the leaves are
Python values. Furthermore, a pytree should not contain reference cycles.

pytrees are useful for working with nested collections of Tensors. For example,
one can use `tree_map` to map a function over all Tensors inside some nested
collection of Tensors and `tree_leaves` to get a flat list of all Tensors
inside some nested collection. pytrees are helpful for implementing nested
collection support for PyTorch APIs.

This pytree implementation is not very performant due to Python overhead
To improve the performance we can move parts of the implementation to C++.
    N)defaultdictdeque
namedtupleOrderedDict)AnyCallablecastDefaultDictDequeDict	FrozenSetGenericHashableIterableListMapping
NamedTupleOptionalr   overloadProtocolSequenceTupleTypeTypeVarUnion)
deprecated)PyTreeContextFlattenFuncUnflattenFuncDumpableContextToDumpableContextFnFromDumpableContextFnTreeSpecLeafSpeckeystrkey_getregister_pytree_nodetree_flattentree_flatten_with_pathtree_unflatten	tree_itertree_leavestree_leaves_with_pathtree_structuretree_maptree_map_with_path	tree_map_tree_map_onlytree_map_only_tree_alltree_anytree_all_onlytree_any_onlytreespec_dumpstreespec_loadstreespec_pprintTSUR   NO_SERIALIZED_TYPE_NAME_FOUNDc                   D    e Zd ZdefdZdedefdZdefdZ	de
de
fdZy)	KeyEntryreturnc                      y N selfs    [/home/mcse/projects/flask_80/flask-venv/lib/python3.12/site-packages/torch/utils/_pytree.py__hash__zKeyEntry.__hash__d           otherc                      y rF   rG   )rI   rN   s     rJ   __eq__zKeyEntry.__eq__g   rL   rM   c                      y rF   rG   rH   s    rJ   __str__zKeyEntry.__str__j   rL   rM   parentc                      y rF   rG   )rI   rS   s     rJ   getzKeyEntry.getm   rL   rM   N)__name__
__module____qualname__intrK   objectboolrP   strrR   r   rU   rG   rM   rJ   rC   rC   c   s@    # F t  # # rM   rC   r$   .c                   B    e Zd ZU ee   ed<   eed<   eed<   ee	   ed<   y)NodeDeftype
flatten_fnunflatten_fnflatten_with_keys_fnN)
rV   rW   rX   r   r   __annotations__r   r    r   FlattenWithKeysFuncrG   rM   rJ   r^   r^      s#    
s)O"#677rM   r^   SUPPORTED_NODESc                   H    e Zd ZU ee   ed<   eed<   ee   ed<   ee	   ed<   y)_SerializeNodeDeftypserialized_type_nameto_dumpable_contextfrom_dumpable_contextN)
rV   rW   rX   r   r   rc   r\   r   r"   r#   rG   rM   rJ   rg   rg      s)    	cN!"566#$9::rM   rg   SUPPORTED_SERIALIZED_TYPESSERIALIZED_TYPE_TO_PYTHON_TYPEoptreeF_cxx_pytree_pending_importsri   rj   rk   rb   clsr`   ra   ri   rj   rk   rb   rD   c          	      &   t         5  | t        v rt        |  d      	 ddd       t        | ||||||       t        syt
        rddlm} |j                  | |||||       y| ||f}|||d}	t        j                  ||	f       y# 1 sw Y   ixY w)a  Register a container-like type as pytree node.

    Args:
        cls: the type to register
        flatten_fn: A callable that takes a pytree and returns a flattened
            representation of the pytree and additional context to represent the
            flattened pytree.
        unflatten_fn: A callable that takes a flattened version of the pytree,
            additional context, and returns an unflattened pytree.
        serialized_type_name: A keyword argument used to specify the fully qualified
            name used when serializing the tree spec.
        to_dumpable_context: An optional keyword argument to custom specify how
            to convert the context of the pytree to a custom json dumpable
            representation. This is used for json serialization, which is being
            used in torch.export right now.
        from_dumpable_context: An optional keyword argument to custom specify how
            to convert the custom json dumpable representation of the context
            back to the original context. This is used for json deserialization,
            which is being used in torch.export right now.
        flatten_with_keys_fn: An optional keyword argument to specify how to
            access each pytree leaf's keypath when flattening and tree-mapping.
            Like ``flatten_fn``, but in place of a List[leaf], it should return
            a List[(keypath, leaf)].
    z& is already registered as pytree node.Nrp   r@   )_cxx_pytree)ri   rj   rk   )
_NODE_REGISTRY_LOCKre   
ValueError_private_register_pytree_node_cxx_pytree_exists_cxx_pytree_imported rs   ro   append)
rq   r`   ra   ri   rj   rk   rb   cxxargskwargss
             rJ   r(   r(      s    D 
 M/!u$JKLL "M "1/31 ())!5 3"7 	* 	
 Z.$8#6%:

 	$**D&>:GM Ms   BBc          	      P    t        | t        t        |t        t        t
               y)a  
    Registers a namedtuple as a valid pytree node. By default namedtuples are
    valid pytree nodes, but they are not serializable. This API provides the
    argument `serialized_type_name` which allows these namedtuples to be
    serialized.

    Args:
        cls: the dataclass type to register
        serialized_type_name: The serialized name for the dataclass. This is
        required if you want to serialize the pytree TreeSpec containing this
        namedtuple.
    rp   N)rv   _namedtuple_flatten_namedtuple_unflatten_namedtuple_serialize_namedtuple_deserialize_namedtuple_flatten_with_keys)rq   ri   s     rJ   _register_namedtupler      s!    " "115:rM   zy`torch.utils._pytree._register_pytree_node` is deprecated. Please use `torch.utils._pytree.register_pytree_node` instead.)category	to_str_fnmaybe_from_str_fnc          	      h    ||t        j                  dt        d       t        | ||||||       y)a  Register a container-like type as pytree node for the Python pytree only.

    Args:
        cls: the type to register
        flatten_fn: A callable that takes a pytree and returns a flattened
            representation of the pytree and additional context to represent the
            flattened pytree.
        unflatten_fn: A callable that takes a flattened version of the pytree,
            additional context, and returns an unflattened pytree.
        serialized_type_name: A keyword argument used to specify the fully qualified
            name used when serializing the tree spec.
        to_dumpable_context: An optional keyword argument to custom specify how
            to convert the context of the pytree to a custom json dumpable
            representation. This is used for json serialization, which is being
            used in torch.export right now.
        from_dumpable_context: An optional keyword argument to custom specify how
            to convert the custom json dumpable representation of the context
            back to the original context. This is used for json deserialization,
            which is being used in torch.export right now.
        flatten_with_keys_fn: An optional keyword argument to specify how to
            access each pytree leaf's keypath when flattening and tree-mapping.
            Like ``flatten_fn``, but in place of a List[leaf], it should return
            a List[(keypath, leaf)].
    Nzx`to_str_fn` and `maybe_from_str_fn` is deprecated. Please use `to_dumpable_context` and `from_dumpable_context` instead.   )
stacklevelrp   )warningswarnFutureWarningrv   )	rq   r`   ra   r   r   ri   rj   rk   rb   s	            rJ   _register_pytree_noder     sH    R  1 =T		
 "1/31rM   c                (   t         5  | t        v rt        j                  |  d       t	        | |||      }|t        | <   |du |du z  rt        d|  d      |t        }t        | |||      }|t        | <   | t        |<   ddd       y# 1 sw Y   yxY w)zThis is an internal function that is used to register a pytree node type
    for the Python pytree only. End-users should use :func:`register_pytree_node`
    instead.
    zM is already registered as pytree node. Overwriting the previous registration.Nz7Both to_dumpable_context and from_dumpable_context for z must be None or registered.)
rt   re   r   r   r^   ru   rA   rg   rl   rm   )	rq   r`   ra   ri   rj   rk   rb   node_defserialize_node_defs	            rJ   rv   rv   K  s     
 C/!MM% 9 9
 3
L:NO'4',AT,IJI# O) ) 
  '#@ . !	
 +="3'?B&';<7C C Cs   A8BBT)frozenc                   :    e Zd ZU eed<   defdZdee   defdZ	y)SequenceKeyidxrD   c                 "    d| j                   dS N[]r   rH   s    rJ   rR   zSequenceKey.__str__{      488,a  rM   sequencec                      || j                      S rF   r   )rI   r   s     rJ   rU   zSequenceKey.get~  s    !!rM   N)
rV   rW   rX   rY   rc   r\   rR   r   r<   rU   rG   rM   rJ   r   r   w  s*    	H! !"HQK "A "rM   r   K)boundc                   >    e Zd ZU eed<   defdZdeeef   defdZ	y)
MappingKeykeyrD   c                 "    d| j                   dS r   r   rH   s    rJ   rR   zMappingKey.__str__  r   rM   mappingc                      || j                      S rF   r   )rI   r   s     rJ   rU   zMappingKey.get  s    txx  rM   N)
rV   rW   rX   r   rc   r\   rR   r   r<   rU   rG   rM   rJ   r   r     s.    	
F! !!71a4= !Q !rM   r   c                   4    e Zd ZU eed<   defdZdedefdZy)
GetAttrKeynamerD   c                      d| j                    S )N.)r   rH   s    rJ   rR   zGetAttrKey.__str__  s    499+rM   objc                 .    t        || j                        S rF   )getattrr   )rI   r   s     rJ   rU   zGetAttrKey.get  s    sDII&&rM   N)rV   rW   rX   r\   rc   rR   r   rU   rG   rM   rJ   r   r     s&    
I 's 's 'rM   r   dc                     t        |       d fS rF   listr   s    rJ   _tuple_flattenr     s    7D=rM   c                     t        |       \  }}t        |      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r   	enumerater   r   valuescontextivs        rJ   _tuple_flatten_with_keysr     =     %Q'OFG,5f,=>DAq[^Q>GG>   :r   r   c                     t        |       S rF   )tupler   r   s     rJ   _tuple_unflattenr     s    =rM   c                 
    | d fS rF   rG   r   s    rJ   _list_flattenr     s    d7NrM   c                     t        |       \  }}t        |      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r   r   r   r   s        rJ   _list_flatten_with_keysr     s;    #A&OFG,5f,=>DAq[^Q>GG>r   c                     t        |       S rF   r   r   s     rJ   _list_unflattenr     s    <rM   c                 f    t        | j                               t        | j                               fS rF   r   r   keysr   s    rJ   _dict_flattenr     "    
T!&&(^++rM   c                     t        |       \  }}t        ||      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r   zipr   r   r   r   kr   s        rJ   _dict_flatten_with_keysr     s?     $A&OFG+.w+?@41aZ]A@'II@   ;c                 ,    t        t        ||             S rF   )dictr   r   s     rJ   _dict_unflattenr     s    GV$%%rM   c                 .    t        |       t        |       fS rF   )r   r_   r   s    rJ   r   r     s    7DGrM   c                     t        |       \  }}t        |j                  |      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r   r   _fieldsr   )r   r   r   fieldr   s        rJ   r   r     sI     *!,OFG03GOOV0LMHE1*U
Q	M Ms   Ac                 (    t        t         ||        S rF   )r	   r   r   s     rJ   r   r     s    
GV,--rM   c                     | t         vrt        d|  d      t         |    }|j                  }|t        k(  rt        d|  d      |S )Nz-Can't serialize TreeSpec of namedtuple class zc because we didn't register a serializated_type_name. Please register using `_register_namedtuple`.za because we couldn't find a serializated_type_name. Please register using `_register_namedtuple`.)rl   NotImplementedErrorri   rA   )r   r   ri   s      rJ   r   r     ss    00!;G9 E& &
 	
 4G<-BB<<!;G9 E& &
 	

  rM   dumpable_contextc                 F    | t         vrt        d|  d      t         |    }|S )Nz/Can't deserialize TreeSpec of namedtuple class z. because we couldn't find a serializated name.)rm   r   )r   rh   s     rJ   r   r     s>    ==!=>N=O P< <
 	

 ))9
:CJrM   c                 f    t        | j                               t        | j                               fS rF   r   r   s    rJ   _ordereddict_flattenr     r   rM   c                     t        |       \  }}t        ||      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r   r   r   r   s        rJ   _ordereddict_flatten_with_keysr     s?     +1-OFG+.w+?@41aZ]A@'II@r   c                 :    t        d t        ||       D              S )Nc              3   *   K   | ]  \  }}||f  y wrF   rG   ).0r   values      rJ   	<genexpr>z)_ordereddict_unflatten.<locals>.<genexpr>  s     K
UU|Ks   )r   r   r   s     rJ   _ordereddict_unflattenr     s     Kc'66JKKKrM   c                 >    t        |       \  }}|| j                  |gfS rF   )r   default_factory)r   r   dict_contexts      rJ   _defaultdict_flattenr     s'    (+FLA%%|444rM   c                     t        |       \  }}|\  }}t        ||      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r   r   r   )r   r   r   _r   r   r   s          rJ   _defaultdict_flatten_with_keysr     sH     +1-OFGOA|+.|V+DE41aZ]AEwNNEs   A c                 8    |\  }}t        |t        | |            S rF   )r   r   )r   r   r   r   s       rJ   _defaultdict_unflattenr     s"     %,!O\(MNNrM   c                 D    | \  }}|j                   |j                  |d}|S )N)default_factory_moduledefault_factory_namer   )rW   rX   )r   r   r   json_defaultdicts       rJ   _defaultdict_serializer   "  s1    $+!O\"1"<"< / < <$
 rM   c                     t        | t              sJ t        |       h dk(  sJ | d   }| d   }t        |t              sJ t        |t              sJ t	        j
                  |      }t        ||      }| d   }||gS )N>   r   r   r   r   r   r   )
isinstancer   setr\   	importlibimport_moduler   )r   r   r   moduler   r   s         rJ   _defaultdict_deserializer   ,  s    &---  %    ..FG+,BC,c222*C000$$%;<Ff&:;O#N3L\**rM   c                 0    t        |       | j                  fS rF   )r   maxlenr   s    rJ   _deque_flattenr  ?  s    7AHHrM   c                     t        |       \  }}t        |      D cg c]  \  }}t        |      |f c}}|fS c c}}w rF   )r  r   r   r   s        rJ   _deque_flatten_with_keysr  C  r   r   c                     t        | |      S )N)r   )r   r   s     rJ   _deque_unflattenr  J  s    ((rM   zbuiltins.tuple)ri   rb   zbuiltins.listzbuiltins.dictzcollections.namedtuplezcollections.OrderedDictzcollections.defaultdictzcollections.dequeSTANDARD_DICT_TYPESBUILTIN_TYPEStreec                     t        |       }|j                  }t        |      dk7  s|d   t        k7  ryt	        |dd       }t        |t              syt        d |D              S )Nr@   r   Fr   c              3   @   K   | ]  }t        |      t        k(    y wrF   )r_   r\   )r   entrys     rJ   r   z*_is_namedtuple_instance.<locals>.<genexpr>  s     6etE{c!6s   )r_   	__bases__lenr   r   r   all)r  rh   basesfieldss       rJ   _is_namedtuple_instancer    sY    
t*CMME
5zQ%(e+S)T*Ffe$6v666rM   c                 :    t        |       rt        S t        |       S rF   )r  r   r_   )r  s    rJ   _get_node_typer    s    t$:rM   is_leafc                 D    |d uxr  ||       xs t        |       t        vS rF   )r  re   r  r  s     rJ   _is_leafr    s/    41GDM n77 rM   )initr   eqreprc                   .   e Zd ZU eed<   eed<   ed    ed<    ej                  d      Z	e
ed<    ej                  d      Ze
ed<    ej                  d      Ze
ed<   ddZdde
d	efdZd	efdZdedee   d	d
fdZded	ee   fdZdee   d	efdZy
)r$   r_   r   children_specsF)r  	num_nodes
num_leavesnum_childrenrD   Nc                 ,   t        d | j                  D        d      }t        d | j                  D              }t        | j                        }t        j	                  | d|       t        j	                  | d|       t        j	                  | d|       y )Nc              3   4   K   | ]  }|j                     y wrF   )r  r   specs     rJ   r   z)TreeSpec.__post_init__.<locals>.<genexpr>  s     HDH   r@   )startc              3   4   K   | ]  }|j                     y wrF   )r  r"  s     rJ   r   z)TreeSpec.__post_init__.<locals>.<genexpr>  s     ITIr$  r  r  r  )sumr  r  rZ   __setattr__)rI   r  r  r  s       rJ   __post_init__zTreeSpec.__post_init__  sw    HD4G4GHPQR	IT5H5HII
4../4i84z:4>rM   indentc           
         d| j                   j                   d| j                   d}d}| j                  dkD  r|dz  }|| j                  d   j                  |      z  }|| j                  dkD  rdndz  }|dj                  | j                  dd  D cg c]  }d	d
|z  z   |j                  |      z    c}      z  }| d}||z   S c c}w )Nz	TreeSpec(z, z, [ry   r   r   r@   ,
 z]))r_   rV   r   r  r  __repr__join)rI   r*  repr_prefixchildren_specs_strchildrepr_suffixs         rJ   r/  zTreeSpec.__repr__  s    &tyy'9'9&:"T\\N#N"$q aKF$"5"5a"8"A"A&"II):):Q)>#BF#(( "&!4!4QR!8 3<'%..*@@#  114[((s   !C
c                 B    | j                   dk(  xr | j                  dk(  S )Nr@   )r  r  rH   s    rJ   r  zTreeSpec.is_leaf  s    ~~";t!';;rM   r  subtreesc           	      r   | j                         r|j                  |       y t        |      }| j                  t        vr|| j                  k7  rt        d| j                  d|d      t        |   j                  } ||      \  }}t        |      | j                  k7  r%t        d| j                   dt        |       d      || j                  k7  rt        d| j                  d      | j                  t        v xr |t        v }|| j                  k7  r|st        d| j                  d|d      t        |      | j                  k7  r%t        d| j                   dt        |       d      |r| j                  t        ur| j                  n| j                  d   }|}	t        |      }
t        |	      }|
|k7  rG|j                  |
      }|
j                  |      }d}|r|d	| z  }|r|d
| z  }t        d| d      |	D cg c]  }||   	 }}nht        |   j                  } ||      \  }}|| j                  k7  r;| j                  t        ur)t        d| j                  d| j                  d|d      t!        || j"                        D ]  \  }}|j%                  ||        y c c}w )NzType mismatch; expected z
, but got r   zNode arity mismatch; expected z+Node context mismatch for custom node type zNode type mismatch; expected r@   ry   z; missing key(s): z; extra key(s): zNode keys mismatchz$Node context mismatch for node type z; expected )r  rz   r  r_   r  ru   re   r`   r  r  r   r  r   r   
differencer   r   r  _flatten_up_to_helper)rI   r  r6  	node_typer`   child_pytreesr   both_standard_dictr   expected_keysgot_key_setexpected_key_setmissing_keys
extra_keysmessager   child_pytree
child_specs                     rJ   r9  zTreeSpec._flatten_up_to_helper  s
   <<>OOD!"4(	99M)DII%   $		}Jym1F  )3>>J%/%5"M7=!T%6%66   $ 1 12*S=O<PPQS  $,,& A$))aP  		00UYBU5U  DII%.@   $		}Jym1F  4yD---   $ 1 12*SYKqJ 
 " yy3 LL a	  !-!$i#&}#5 "22#3#>#>{#KL!,!7!78H!IJ G#%7~#FF!%5j\#BB$'9'!%DEE6C Dsc D D,Y7BB
)3D)9&wt||+		.$>tyym L$$(LL#3:g[K 
 ),M4;N;N(O 	E$L*,,\8D	E !Es   J4c                 .    g }| j                  ||       |S rF   )r9  )rI   r  r6  s      rJ   flatten_up_tozTreeSpec.flatten_up_to  s    !#""42rM   leavesc           	         t        |t        t        f      st        |      }t        |      | j                  k7  r(t        dt        |       d| j                   d|  d      | j                         r|d   S t        | j                     j                  }d}d}g }| j                  D ]6  }||j                  z  }|j                  |j                  |||              |}8  ||| j                        S )Nz0treespec.unflatten(leaves): `leaves` has length z, but the spec refers to a pytree that holds z items (z).r   )r   r   r   r  r  ru   r  re   r_   ra   r  rz   	unflattenr   )rI   rG  ra   r%  endr;  rD  s          rJ   rI  zTreeSpec.unflatten!  s    &4-0&\Fv;$//)B3v;- P>>Boo=N Or# 
 <<>!9&tyy1>> -- 	J:(((C  !5!5fU36G!HIE	
 M4<<88rM   rD   Nr   )rV   rW   rX   r   rc   r   r   dataclassesr   r  rY   r  r  r)  r\   r/  r[   r  r   r9  rF  r   rI  rG   rM   rJ   r$   r$     s    
I$$&[&&E2Is2'k''U3J3)))u5L#5?)s )3 ) < <JE& JEDL JET JEX& T&\ 
9 9& 9rM   c                   :     e Zd Zd fdZddZddedefdZ xZS )r%   rD   c                 (    t         |   d d g        y rF   )super__init__)rI   	__class__s    rJ   rQ  zLeafSpec.__init__<  s    tR(rM   c                     t         j                  | dd       t         j                  | dd       t         j                  | dd       y )Nr  r@   r  r  r   )rZ   r(  rH   s    rJ   r)  zLeafSpec.__post_init__?  s8    4a04q143rM   r*  c                      yN*rG   )rI   r*  s     rJ   r/  zLeafSpec.__repr__D      rM   rK  rL  )	rV   rW   rX   rQ  r)  rY   r\   r/  __classcell__)rR  s   @rJ   r%   r%   ;  s     )4
s 3 rM   r%   rG  c                     t        | |      r|j                  |        t        S t        |       }t        |   j
                  } ||       \  }}|D cg c]  }t        |||       }}t        |||      S c c}w Nr  )r  rz   
_LEAF_SPECr  re   r`   _tree_flatten_helperr$   )	r  rG  r  r:  r`   r;  r   r3  r  s	            rJ   r]  r]  M  s    
 g&dt$I +66J'-M7 KXAFUFG<N  Iw77	s   A6c                 *    g }t        | ||      }||fS )zkFlattens a pytree into a list of values and a TreeSpec that can be used
    to reconstruct the pytree.
    r[  )r]  )r  r  rG  r#  s       rJ   r)   r)   b  s!     Ffg>D4<rM   treespecc                 t    t        |t              st        dt        |       d      |j	                  |       S )zqGiven a list of values and a TreeSpec, builds a pytree.
    This is the inverse operation of `tree_flatten`.
    zftree_unflatten(leaves, treespec): Expected `treespec` to be instance of TreeSpec but got item of type r   )r   r$   	TypeErrorr_   rI  )rG  r_  s     rJ   r+   r+   n  sE     h)99=h8HK
 	
 f%%rM   c              #      K   t        | |      r|  yt        |       }t        |   j                  } ||       \  }}|D ]  }t	        ||      E d{     y7 w)z,Get an iterator over the leaves of a pytree.r[  N)r  r  re   r`   r,   )r  r  r:  r`   r;  r   r3  s          rJ   r,   r,   z  sd     
 g&
"4(	$Y/::
%d+q # 	9E 888	98s   AAAAc                 .    t        t        | |            S )z!Get a list of leaves of a pytree.r[  )r   r,   r  s     rJ   r-   r-     s    
 	$011rM   c                 "    t        | |      d   S )zGet the TreeSpec for a pytree.r[  r@   )r)   r  s     rJ   r/   r/     s    
 g.q11rM   r[  funcrestsc                    t        ||      \  }}|g|D cg c]  }|j                  |       c}z   }|j                  t        | g|       S c c}w )a  Map a multi-input function over pytree args to produce a new pytree.

    See also :func:`tree_map_`.

    >>> tree_map(lambda x: x + 1, {'x': 7, 'y': (42, 64)})
    {'x': 8, 'y': (43, 65)}
    >>> tree_map(lambda x: x is None, {'x': 7, 'y': (42, 64), 'z': None})
    {'x': False, 'y': (False, False), 'z': True}

    If multiple inputs are given, the structure of the tree is taken from the first input;
    subsequent inputs need only have ``tree`` as a prefix:

    >>> tree_map(lambda x, y: [x] + y, [5, 6], [[7, 9], [1, 2]])
    [[5, 7, 9], [6, 1, 2]]

    Args:
        func (callable): A function that takes ``1 + len(rests)`` arguments, to be applied at the
            corresponding leaves of the pytrees.
        tree (pytree): A pytree to be mapped over, with each leaf providing the first positional
            argument to function ``func``.
        rests (tuple of pytree): A tuple of pytrees, each of which has the same structure as
            ``tree`` or has ``tree`` as a prefix.
        is_leaf (callable, optional): An extra leaf predicate function that will be called at each
            flattening step. The function should have a single argument with signature
            ``is_leaf(node) -> bool``. If it returns :data:`True`, the whole subtree being treated
            as a leaf. Otherwise, the default pytree registry will be used to determine a node is a
            leaf or not. If the function is not specified, the default pytree registry will be used.

    Returns:
        A new pytree with the same structure as ``tree`` but with the value at each leaf given by
        ``func(x, *xs)`` where ``x`` is the value at the corresponding leaf in ``tree`` and ``xs``
        is the tuple of values at corresponding nodes in ``rests``.
    r[  )r)   rF  rI  mapre  r  r  rf  rG  r_  r	flat_argss           rJ   r0   r0     sY    N $D':FHuE!H2215EEIc$3344 Fs   Ac                    t        ||      \  }}|g|D cg c]  }|j                  |       c}z   }t        t        | g|        |S c c}w )aT  Like :func:`tree_map`, but do an inplace call on each leaf and return the original tree.

    See also :func:`tree_map`.

    Args:
        func (callable): A function that takes ``1 + len(rests)`` arguments, to be applied at the
            corresponding leaves of the pytrees.
        tree (pytree): A pytree to be mapped over, with each leaf providing the first positional
            argument to function ``func``.
        rests (tuple of pytree): A tuple of pytrees, each of which has the same structure as
            ``tree`` or has ``tree`` as a prefix.
        is_leaf (callable, optional): An extra leaf predicate function that will be called at each
            flattening step. The function should have a single argument with signature
            ``is_leaf(node) -> bool``. If it returns :data:`True`, the whole subtree being treated
            as a leaf. Otherwise, the default pytree registry will be used to determine a node is a
            leaf or not. If the function is not specified, the default pytree registry will be used.

    Returns:
        The original ``tree`` with the value at each leaf is given by the side-effect of function
        ``func(x, *xs)`` (not the return value) where ``x`` is the value at the corresponding leaf
        in ``tree`` and ``xs`` is the tuple of values at values at corresponding nodes in ``rests``.
    r[  )r)   rF  r   rh  ri  s           rJ   r2   r2     sT    8 $D':FHuE!H2215EEI	#d
Y
 K Fs   A   
   __type_or_types_or_predc                      y rF   rG   rp  s    rJ   map_onlyrs        rM   c                      y rF   rG   rr  s    rJ   rs  rs    rt  rM   c                      y rF   rG   rr  s    rJ   rs  rs    rt  rM   c                      y rF   rG   rr  s    rJ   rs  rs  
  rt  rM   c                      y rF   rG   rr  s    rJ   rs  rs    rt  rM   c                 D    t         t        t        f      s-t        j                  dk\  r-t         t
        j                        rdt        dt        f fdnt               r nt        d      dt        t        gt        f   dt        t        gt        f   ffd}|S )a  
    Suppose you are writing a tree_map over tensors, leaving everything
    else unchanged.  Ordinarily you would have to write:

        def go(t):
            if isinstance(t, Tensor):
                return ...
            else:
                return t

    With this function, you only need to write:

        @map_only(Tensor)
        def go(t):
            return ...

    You can also directly use 'tree_map_only'
    rm  xrD   c                     t        |       S rF   r   )rz  rp  s    rJ   predzmap_only.<locals>.pred.  s    a!899rM   z9Argument must be a type, a tuple of types, or a callable.re  c                 `     t        j                         dt        dt        f fd       }|S )Nrz  rD   c                 (     |       r |       S | S rF   rG   )rz  re  r}  s    rJ   wrappedz*map_only.<locals>.wrapper.<locals>.wrapped7  s    AwAwHrM   )	functoolswrapsr<   r   )re  r  r}  s   ` rJ   wrapperzmap_only.<locals>.wrapper6  s3    			q 	S 	 
	
 rM   )r   r_   r   sysversion_infotypes	UnionTyper   r[   callablera  r   r<   )rp  r  r}  s   ` @rJ   rs  rs    s    * )D%=9G#.@	:C 	:D 	: 
)	*&STThsCx( XseSj-A  NrM   c                      y rF   rG   rp  re  r  r  s       rJ   r3   r3   B       rM   c                      y rF   rG   r  s       rJ   r3   r3   L  r  rM   c                      y rF   rG   r  s       rJ   r3   r3   V  r  rM   c                      y rF   rG   r  s       rJ   r3   r3   `  r  rM   c                 <    t         t        |       |      ||      S rZ  )r0   rs  r  s       rJ   r3   r3   j  s!     5H45d;T7SSrM   c                      y rF   rG   r  s       rJ   r4   r4   s  r  rM   c                      y rF   rG   r  s       rJ   r4   r4   }  r  rM   c                      y rF   rG   r  s       rJ   r4   r4     r  rM   c                      y rF   rG   r  s       rJ   r4   r4     r  rM   c                 <    t         t        |       |      ||      S rZ  )r2   rs  r  s       rJ   r4   r4     s!     6X56t<dGTTrM   r}  c                 F    t        ||      }t        t        | |            S rZ  )r,   r  rh  r}  r  r  rk  s       rJ   r5   r5     "    
 $0Is4#$$rM   c                 F    t        ||      }t        t        | |            S rZ  )r,   anyrh  r  s       rJ   r6   r6     r  rM   __type_or_typesc                      y rF   rG   r  r}  r  r  s       rJ   r7   r7     r  rM   c                      y rF   rG   r  s       rJ   r7   r7     r  rM   c                      y rF   rG   r  s       rJ   r7   r7     r  rM   c                 J     t        ||      }t         fd|D              S )Nr[  c              3   H   K   | ]  }t        |      s |        y wrF   r|  r   rz  r  r}  s     rJ   r   z tree_all_only.<locals>.<genexpr>       L1Z?-KtAwL   "")r,   r  r  r}  r  r  rk  s   ``   rJ   r7   r7     "     $0IL	LLLrM   c                      y rF   rG   r  s       rJ   r8   r8     r  rM   c                      y rF   rG   r  s       rJ   r8   r8     r  rM   c                      y rF   rG   r  s       rJ   r8   r8     r  rM   c                 J     t        ||      }t         fd|D              S )Nr[  c              3   H   K   | ]  }t        |      s |        y wrF   r|  r  s     rJ   r   z tree_any_only.<locals>.<genexpr>  r  r  )r,   r  r  s   ``   rJ   r8   r8     r  rM   c                    t        |t              sJ t        | |      r| g|j                  z  S |j	                         ry t        |       }||j                  k7  ry t        |   j                  } ||       \  }}t        |      |j                  k7  s||j                  k7  ry g }t        ||j                        D ]  \  }}	t        ||	|      }
|
||
z  } y  |S rZ  )r   r$   r  r  r  r  r_   re   r`   r  r  r   r   r  _broadcast_to_and_flatten)r  r_  r  r:  r`   r;  ctxresultr3  rD  flats              rJ   r  r    s    
 h)))g&v++++t$IHMM! +66J#D)M3 =X222cX=M=M6M F 0G0GH z(
GLdNF MrM   c                   <    e Zd ZU dZee   ed<   eed<   ed    ed<   y)_TreeSpecSchemaa  
    _TreeSpecSchema is the schema used to serialize the TreeSpec
    It contains the following fields:
    - type: A string name of the type. null for the case of a LeafSpec.
    - context: Any format which is json dumpable
    - children_spec: A list of children serialized specs.
    r_   r   children_specN)	rV   rW   rX   __doc__r   r\   rc   r!   r   rG   rM   rJ   r  r  0  s%     3-)**rM   r  c                   :    e Zd ZU eegef   ed<   eegef   ed<   y)_ProtocolFntreespec_to_jsonjson_to_treespecN)rV   rW   rX   r   r$   r!   rc   rG   rM   rJ   r  r  ?  s'    z?:;;0(:;;rM   r  _SUPPORTED_PROTOCOLSc                 F   | j                         rt        d d g       S | j                  t        vrt	        d| j                   d      t        | j                     }|j
                  }|t        k(  rt	        d| j                   d      |j                  !	 t        j                  | j                        }n|j                  | j                        }| j                  D cg c]  }t        |       }}t        |||      S # t        $ r}t        d      |d }~ww xY wc c}w )NzSerializing  in pytree is not registered.z%No registered serialization name for zZ found. Please update your _register_pytree_node call with a `serialized_type_name` kwarg.zUnable to serialize context. Please make the context json dump-able, or register a custom serializer using _register_pytree_node.)r  r  r_   rl   r   ri   rA   rj   jsondumpsr   ra  r  _treespec_to_json)r_  r   ri   serialized_contexter3  child_schemass          rJ   r  r  G  s3   tT2..}}66!8==/)FG
 	
 4HMMB-BB<<!3HMM? Ca a
 	

 --5	!%H,<,<!= 0CCHDTDTU;C;R;RS%&u-SMS/1C]SS  	A 		 Ts   D  D	D
DDjson_schemac                    | d   | d   t        | d         dk(  rt        S | d   t        vrt        d| d    d      t        | d      }t        |   }|j
                  	 t        j                  | d         }n|j                  | d         }g }| d   D ]  }|j                  t        |              t        |||      S # t        $ r}t        d      |d }~ww xY w)Nr_   r   r  r   zDeserializing r  zUnable to deserialize context. Please make the context json load-able, or register a custom serializer using _register_pytree_node.)r  r\  rm   r   rl   rk   r  loadsra  rz   _json_to_treespecr$   )r  rh   r   r   exr  child_strings          rJ   r  r  k  s   F#	"*O,-26"@@![011NO
 	
 )V)<
=C3C8//7	jjY!78G %::;y;QRN#O4 ?/=>? C.11  	A 		s   !C 	C
CCprotocolc           	      T   t        | t              st        dt        |        d      |t        }|t
        v rt
        |   j                  |       }n,t        d| dt        t
        j                                      t        j                  |t        j                  |      f      }|S )Nzhtreespec_dumps(treespec, protocol): Expected `treespec` to be instance of TreeSpec but got item of type r   Unknown protocol . Available protocols: )r   r$   ra  r_   'DEFAULT_TREESPEC_SERIALIZATION_PROTOCOLr  r  ru   r   r   r  r  rM  asdict)r_  r  	json_specstr_specs       rJ   r9   r9     s    h)--1(^,<A?
 	

 :''(2CCHM	z *$$()=)B)B)D$E#FH
 	

 zz8[%7%7	%BCDHOrM   
serializedc           	          t        j                  |       \  }}|t        v rt        |   j                  |      S t	        d| dt        t        j                                      )Nr  r  )r  r  r  r  ru   r   r   )r  r  r  s      rJ   r:   r:     sh     JJz2Hk''#H->>{KK

H: &  $%9%>%>%@ AB	D rM   c                       e Zd ZdefdZy)
_DummyLeafrD   c                      yrU  rG   rH   s    rJ   r/  z_DummyLeaf.__repr__  rW  rM   N)rV   rW   rX   r\   r/  rG   rM   rJ   r  r    s    # rM   r  c                     t        t        | j                        D cg c]  }t                c}|       }t	        |      S c c}w rF   )r+   ranger  r  r  )r_  r   
dummy_trees      rJ   r;   r;     s<    $X%8%89:!:J 
 	;s   AzC`pytree_to_str` is deprecated. Please use `treespec_dumps` instead.c                     t        |       S rF   )r9   )r_  s    rJ   pytree_to_strr    s    
 (##rM   zC`str_to_pytree` is deprecated. Please use `treespec_loads` instead.r  c                     t        |       S rF   )r:   )r  s    rJ   str_to_pytreer    s    
 $rM   r|   r}   c                      g }| D ]  }|j                  t        |              |j                         D ]  }|j                  t        |              |S )zpGet a flat list of arguments to this function

    A slightly faster version of tree_leaves((args, kwargs))
    )extendr,   r   )r|   r}   rG  as       rJ   arg_tree_leavesr    sR    
 F $il#$]]_ $il#$MrM   c                 P    t        | |      \  }}t        t        d| |            |fS )a  Flattens a pytree like :func:`tree_flatten`, but also returns each leaf's key path.

    Args:
        tree: a pytree to flatten. If it contains a custom type, that type must be
            registered with an appropriate `tree_flatten_with_path_fn` when registered
            with :func:`register_pytree_node`.
        is_leaf: An extra leaf predicate function that will be called at each
            flattening step. The function should have a single argument with signature
            ``is_leaf(node) -> bool``. If it returns :data:`True`, the whole subtree being treated
            as a leaf. Otherwise, the default pytree registry will be used to determine a node is a
            leaf or not. If the function is not specified, the default pytree registry will be used.
    Returns:
        A tuple where the first element is a list of (key path, leaf) pairs, and the
        second element is a :class:`TreeSpec` representing the structure of the flattened
        tree.
    rG   )r)   r   _generate_key_paths)r  r  r   r_  s       rJ   r*   r*     s.    ( tW-KAx#Bg67AArM   c                 .    t        t        d| |            S )a8  Gets the leaves of a pytree like ``tree_leaves`` and returns each leaf's key path.

    Args:
        tree: a pytree. If it contains a custom type, that type must be
            registered with an appropriate `tree_flatten_with_path_fn` when registered
            with :func:`register_pytree_node`.
        is_leaf: An extra leaf predicate function that will be called at each
            flattening step. The function should have a single argument with signature
            ``is_leaf(node) -> bool``. If it returns :data:`True`, the whole subtree being treated
            as a leaf. Otherwise, the default pytree registry will be used to determine a node is a
            leaf or not. If the function is not specified, the default pytree registry will be used.
    Returns:
        A list of (key path, leaf) pairs.
    rG   )r   r  r  s     rJ   r.   r.     s    $ #Bg677rM   key_pathc              #     K   |r ||      r| |f y t        |      }t        j                  |      }|s| |f y |j                  }|r0 ||      \  }}|D ]  \  }}	t	        g | ||	|      E d {    ! y t        d| d      7 w)Nz.Did not find a flatten_with_keys_fn for type: zF. Please pass a flatten_with_keys_fn argument to register_pytree_node.)r  re   rU   rb   r  ru   )
r  r  r  r:  handlerflatten_with_keyskey_childrenr   r   cs
             rJ   r  r    s     
 74=nt$I!!),Gn44+D1a  	GDAq*>X>q>1gFFF	G <YK HS S
 	
 Gs   A1B3B
4Bc                     t        ||      \  }}t        t        |       }||D cg c]  }|j                  |       c}z   }|j	                   fdt        | D              S c c}w )a  Like :func:`tree_map`, but the provided callable takes an additional key path argument.

    Args:
        func: A function that takes ``2 + len(rests)`` arguments, to be applied at the
            corresponding leaves of the pytrees. The first positional argument
            to ``func`` is the key path of the leaf in question. The second
            positional argument is the value of the leaf.
        tree: A pytree to be mapped over, with each leaf providing the first positional
            argument to function ``func``.
        rests: A tuple of pytrees, each of which has the same structure as
            ``tree`` or has ``tree`` as a prefix.
        is_leaf: An extra leaf predicate function that will be called at each
            flattening step. The function should have a single argument with signature
            ``is_leaf(node) -> bool``. If it returns :data:`True`, the whole subtree being treated
            as a leaf. Otherwise, the default pytree registry will be used to determine a node is a
            leaf or not. If the function is not specified, the default pytree registry will be used.

    Returns
        A new pytree with the same structure as ``tree`` but with the value at each leaf given by
        ``func(keypath, x, *xs)`` where ``keypath`` is the key path at the
        corresponding leaf in ``tree``, ``x`` is the value at that leaf, and
        ``xs`` is the tuple of values at corresponding nodes in ``rests``.
    c              3   (   K   | ]	  } |   y wrF   rG   )r   xsre  s     rJ   r   z%tree_map_with_path.<locals>.<genexpr>H  s     KBdBiKs   )r*   r   r   rF  rI  )re  r  r  rf  keypath_leavesr_  rj  all_keypath_leavess   `       rJ   r1   r1   (  si    :  6dGDNH#~./N'e*T8+A+A!+D*TTK#7I2JKKK +Us   A$kpc                 \    dj                  | D cg c]  }t        |       c}      S c c}w )z9Given a key path, return a pretty-printed representation.ry   )r0  r\   )r  r   s     rJ   r&   r&   K  s#    77B'qCF'(('s   )r   c                 6    |D ]  }|j                  |       }  | S )zAGiven an object and a key path, return the value at the key path.)rU   )r   r  r   s      rJ   r'   r'   P  s#     eeCjJrM   )NNrF   )r  rM  r  r   r  r  	threadingr  r   collectionsr   r   r   r   typingr   r   r	   r
   r   r   r   r   r   r   r   r   r   r   GenericOrderedDictr   r   r   r   r   r   r   typing_extensionsr   __all__r<   r=   r>   r?   r  rA   rC   r   r   r   r    r!   r"   r#   r\   	ToStrFuncMaybeFromStrFuncKeyPathrd   r^   Lockrt   re   rc   rg   rl   rm   util	find_specrw   rx   ro   r(   r   r   r   rv   	dataclassr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   _odict_flatten_odict_unflattenr   r   r   r   r   r  r  r  r   r   r   	frozensetr  r_   r  r[   r  r  r  r$   r%   r\  r]  r)   r+   r,   r-   r/   r0   r2   Type2Type3r  r  TypeAnyFn2Fn3FnFnAny	MapOnlyFnrs  r3   r4   r5   r6   r7   r8   r  r  r  r  rY   r  r  r9   r:   r  r;   r  r  r  r*   r.   r  r1   r&   r'   rG   rM   rJ   <module>r     s  "     
    C C     0 ) F CLCLCLCL +, ' ? x  	xtCy''9!::;(3-169:y/9:  /!2G!;< j$s),c12	SE8E#w2C,D#EEF 
#
xtE(C-4H/I3/N)OOP 8j 8 %inn& ,.d3i() .;
 ; BD Dc,=!=> C79 S$s)^ 4 9
 ^^--h7  )+ T#Y + +/9==A:>E;	cE;E;  E;
 #3-E; ""56E; $$9:E; ##67E; 
E;P	c  
	8 E &*484 +/9==A:>4	c44  4 	"	4
   014 #3-4 ""564 $$9:4 ##674 
4
4x +/9==A:>)C	c)C)C  )C
 #3-)C ""56)C $$9:)C ##67)C 
)CX d#"'!* " $" Cx  d#!A ! $! d#' ' $'eCHo %S	70B*C HS#XH
4hm$%w./HXc] W sCx T#Y 5cG);#< HtCy HU4hm8L3Mw3V-W H
HSM G S	 ,T#s(^ ,d3i.@(A ,JCH~J
4hm$%w./J&HSM &G &S#X &: %S	70B*C 
4hm$%w./.(3- .' .j . 7    (o ' ,.sCx8 ,U49gCU=V ,J#s(#J
4hm$%w./JLSMLL S!L &) 5KS1 5eDIw<N6O 5
O38O
4hm$%w./OOSMOO cOG  + +7 +&eCj U49g+=%> HSzH
4hm$%w./H)Xc] )W )s ) 	)1 (0 (0 1-16 27 2.27 	,1 (1	;$( Yt_  "+
D$
KeD"y 7# 7$ 7  6 HXvhn-E$F RV  D$UCL9 L9 DL9^
x 
 Z
 378
8I8 hx~./8 	8. 37	
	hx~./	 49h		&8C= 	&H 	& 	& 379
9hx~./9 c]9& 372
2hx~./2 
#Y2 372
2hx~./2 2 37	)5
38
)5
)5 )5 hx~./	)5
 )5` 37	
38

  hx~./	
 D 	d1gtAwd1gtAwQ'(wDIuT#Y^4eooEFGDIuT#Y^445Gad}a aAg"#qc1f#aS(C5#:../	
 
eAqDk iAq#I6O  
 
eAq!Gn 3q!QPS|CT9U  
 
d1g )Bq#vJ2G  

 
g )E#J2G  
 
hud{&; 	%PS*@U  
+"7HcUD[,A#AB+uSz+\ 

 37	!!W
QV*  hx~./	
  
 

 37	"1a4[
aCi.  hx~./	
  
 

 37	"1a7^
aAsl
  hx~./	
  
 

 37	%seTk2
*  hx~./	
  
 37	T"7HcUD[,A#ABT
*T T hx~./	T
 T 

 37	!!W
QV*  hx~./	
  
 

 37	"1a4[
aCi.  hx~./	
  
 

 37	"1a7^
aAsl
  hx~./	
  
 

 37	%seTk2
*  hx~./	
  
 37	U"7HcUD[,A#ABU
*U U hx~./	U
 U 37%
C5$;
%
% hx~./% 
	% 37%
C5$;
%
% hx~./% 
	% 

 37	!W
QW+  hx~./	
 
 
 

 37	1a4[
aDj/  hx~./	
 
 
 

 37	1a7^
aAtm
  hx~./	
 
 
 37	MM
+M M hx~./	M
 
M 

 37	!W
QW+  hx~./	
 
 
 

 37	1a4[
aDj/  hx~./	
 
 
 

 37	1a7^
aAtm
  hx~./	
 
 
 37	MM
+M M hx~./	M
 
M* 37
 hx~./ d3i	D + + +<* <
 02 d3+, 1!T !T_ !TH 2?  2x  2F &&79JK Q X # # ,s x  
h 3  I$H $ $	$
 I     	 
6 
V 
S	 
 37B
Bhx~./B 4gsl#$h./B4 378
8hx~./8 
%
80 37



 hx~./
 eGSL!"	
B 37	 L
38
 L
 L  L hx~./	 L
  LF)w )3 )
 ' c rM   