
    yh3                        % S r SSKrSSKqSSKrSSKrSSKrSSKJr   SSKJ	r	  SSKJr  SSKJr  \R                  " S\SS	9  \r\r[        R*                  rS,S
 jr\" 5       rS rS rS r " S S5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\5      r! " S S\5      r" " S S\"5      r# " S S\"5      r$S,S  jr%S! r&S" r'S# r(S$ r)\*\+\,4r-S% r.S,S& jr/S,S' jr0S,S( jr1S)\!\\\2\"\\$\\\\(0r3\\La  \#\3\'   \S* \4\00r5\4\\Rl                  4   \7S+'   \3R                  5       r8\5R                  5       r9g! \
 a     GN.f = f)-z>Pickle related utilities. Perhaps this should be called 'can'.    N)FunctionType)codeutil)
get_logger)import_itemz@ipykernel.pickleutil is deprecated. It has moved to ipyparallel.   )
stacklevelc                 @   ^  U 4S jn[        UR                  S   5      $ )zMthe type of a closure cell doesn't seem to be importable,
so just create one
c                     > T $ N )as   lc:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\ipykernel/pickleutil.pyinner_get_cell_type.<locals>.inner%   s        r   )type__closure__)r   r   s   ` r   _get_cell_typer       s     
 !!!$%%r   c                     [        U [        5      (       aA  [        S5      n[        U R                  UR                  U R
                  U R                  5      n SU l        U $ )zdecorator for making functions appear as interactively defined.
This results in the function being linked to the user_ns as globals()
instead of the module globals().
__main__)
isinstancer   
__import____code____dict____name____defaults__
__module__)fmainmods     r   interactiver    2   sQ     !\""Z(JJJJNN	
 ALHr   c                  ~    SSK n U q SSKJn  Xl        [
        R                  [        S5        g! [         a     N'f = f)ziuse dill to expand serialization support

adds support for object methods and closures to serialization.
r   N	serialize)dillpickle	ipykernelr#   ImportErrorcan_mappopr   )r$   r#   s     r   use_dillr*   G   sB      F '   KKd#     / 
<<c                  ~    SSK n U q SSKJn  Xl        [
        R                  [        S5        g! [         a     N'f = f)zpuse cloudpickle to expand serialization support

adds support for object methods and closures to serialization.
r   Nr"   )cloudpickler%   r&   r#   r'   r(   r)   r   )r-   r#   s     r   use_cloudpickler.   `   sB    
  F'' ' KKd#  r+   c                   ,    \ rS rSrSrSS jrSS jrSrg)	CannedObjectz   zA canned object.Nc                     U=(       d    / U l         [        R                  " U5      U l        [        U5      U l        U H,  n[        U R                  U[        [        X5      5      5        M.     / U l        g)a  can an object for safe pickling

Parameters
----------
obj
    The object to be canned
keys : list (optional)
    list of attribute names that will be explicitly canned / uncanned
hook : callable (optional)
    An optional extra callable,
    which can do additional processing of the uncanned object.

Notes
-----
large data may be offloaded into the buffers list,
used for zero-copy transfers.
N)keyscopyobjcanhooksetattrgetattrbuffers)selfr5   r3   r7   keys        r   __init__CannedObject.__init__}   sV    $ JB	99S>I	CDHHc3ws'8#9:  r   c                    Uc  0 nU R                   nU R                   H"  n[        X#[        [	        X#5      U5      5        M$     U R
                  (       a,  [        U R
                  U5      U l        U R                  X!5        U R                   $ )zGet an object.)r5   r3   r8   uncanr9   r7   )r;   gr5   r<   s       r   
get_objectCannedObject.get_object   si    9Ahh99CCeGC$5q9:  99dii+DIIIcxxr   )r:   r7   r3   r5   )NNr   r   r   __qualname____firstlineno____doc__r=   rB   __static_attributes__r   r   r   r0   r0   z   s    4r   r0   c                   .    \ rS rSrSrS rS rSS jrSrg)		Reference   z/object for wrapping a remote reference by name.c                 d    [        U[        5      (       d  [        SU-  5      eXl        / U l        g)zInitialize the reference.zillegal name: %rN)r   str	TypeErrornamer:   )r;   rO   s     r   r=   Reference.__init__   s,    $$$.566	r   c                      SU R                   -  $ )z%Get the string repr of the reference.z<Reference: %r>)rO   )r;   s    r   __repr__Reference.__repr__   s     499,,r   Nc                 8    Uc  0 n[        U R                  U5      $ )zGet an object in the reference.)evalrO   )r;   rA   s     r   rB   Reference.get_object   s    9ADIIq!!r   )r:   rO   r   )	r   r   rE   rF   rG   r=   rR   rB   rH   r   r   r   rJ   rJ      s    9-"r   rJ   c                   (    \ rS rSrSrS rSS jrSrg)
CannedCell   zCan a closure cellc                 8    [        UR                  5      U l        g)zInitialize the canned cell.N)r6   cell_contents)r;   cells     r   r=   CannedCell.__init__   s     !3!34r   Nc                 Z   ^ [        U R                  U5      mU4S jnUR                  S   $ )zGet an object in the cell.c                     > T $ )zInner function.r   r[   s   r   r   $CannedCell.get_object.<locals>.inner   s	      r   r   )r@   r[   r   )r;   rA   r   r[   s      @r   rB   CannedCell.get_object   s-    d00!4	!   ##r   r`   r   rD   r   r   r   rX   rX      s    5$r   rX   c                   .    \ rS rSrSrS rS rSS jrSrg)	CannedFunction   zCan a function.c                    U R                  U5        UR                  U l        U   UR                  (       a,  UR                   Vs/ s H  n[	        U5      PM     snU l        OSU l        U   UR                  nU(       a  [        S U 5       5      U l        OSU l        UR                  =(       d    SU l
        UR                  U l        / U l        gs  snf )zInitialize the canNc              3   8   #    U  H  n[        U5      v   M     g 7fr   )r6   ).0r\   s     r   	<genexpr>*CannedFunction.__init__.<locals>.<genexpr>   s      ?wtTws   r   )_check_typer   coder   r6   defaultsr   tupleclosurer   moduler   r:   )r;   r   fdro   s       r   r=   CannedFunction.__init__   s    JJ	>>/0~~>~SW~>DM DM--  ?w ??DLDLll0j

 ?s   Cc                 <    [        U[        5      (       d   S5       eg )NzNot a function type)r   r   r;   r5   s     r   rk   CannedFunction._check_type   s    #|,,C.CC,r   Nc                   ^ U R                   R                  S5      (       d<  [        U R                   5        [        R                  U R                      R
                  mTc  0 mU R                  (       a  [        U4S jU R                   5       5      OSnU R                  (       a  [        U4S jU R                   5       5      OSn[        U R                  TU R                  X#5      $ )zGet an object out of the can.__Nc              3   <   >#    U  H  n[        UT5      v   M     g 7fr   r@   )rh   cfdrA   s     r   ri   ,CannedFunction.get_object.<locals>.<genexpr>   s     @-3sA-   c              3   <   >#    U  H  n[        UT5      v   M     g 7fr   ry   )rh   r\   rA   s     r   ri   r{      s     @<4dA<r|   )rp   
startswithr   sysmodulesr   rm   rn   ro   r   rl   r   )r;   rA   rm   ro   s    `  r   rB   CannedFunction.get_object   s     {{%%d++t{{#DKK(11A9ADHMM5@$--@@W[DHLL%@4<<@@VZDIIq$--KKr   )r   r:   ro   rl   rm   rp   r   	r   r   rE   rF   rG   r=   rk   rB   rH   r   r   r   rd   rd      s    *DLr   rd   c                   .    \ rS rSrSrS rS rSS jrSrg)	CannedClass   zA canned class object.c                    U R                  U5        UR                  U l        [        U[        5      (       + U l        0 U l        UR                  R                  5        H%  u  p#US;  d  M  [        U5      U R                  U'   M'     U R
                  (       a  / OUR                  5       nUSS  Vs/ s H  n[        U5      PM     snU l        / U l        gs  snf )Initialize the can.)__weakref__r      N)rk   r   rO   r   r   	old_style_canned_dictr   itemsr6   mroparentsr:   )r;   clskvr   cs         r   r=   CannedClass.__init__   s    LL	'T22LL&&(DA33'*1v!!!$ ) NNb	(+AB01A0 1s   1Cc                 <    [        U[        5      (       d   S5       eg )NzNot a class type)r   
class_typert   s     r   rk   CannedClass._check_type  s    #z**>,>>*r   Nc           	         ^ [        U4S jU R                   5       5      n[        U R                  U[	        U R
                  TS95      $ )zGet an object from the can.c              3   <   >#    U  H  n[        UT5      v   M     g 7fr   ry   )rh   prA   s     r   ri   )CannedClass.get_object.<locals>.<genexpr>  s     :\a\r|   )rA   )rn   r   r   rO   
uncan_dictr   )r;   rA   r   s    ` r   rB   CannedClass.get_object
  s7    :T\\::DIIw
43D3D(JKKr   )r   r:   rO   r   r   r   r   r   r   r   r   r      s     ?Lr   r   c                   (    \ rS rSrSrS rSS jrSrg)CannedArrayi  zA canned numpy array.c                    SSK Jn  UR                  U l        UR                  R                  (       a  UR                  R
                  OUR                  R                  U l        SU l        [        UR                  5      S:X  a  SU l        OsUR                  S:X  a  SU l        O[UR                  R                  (       a@  [        S UR                  R                  R                  5        5       5      (       a  SU l        U R                  (       a"  [        R                  " U[        5      /U l        gU" USS9n[        U5      /U l        g)	r   r   )ascontiguousarrayFTOc              3   0   #    U  H  u  pUS :H  v   M     g7f)r   Nr   )rh   dtszs      r   ri   'CannedArray.__init__.<locals>.<genexpr>  s     %X>WFBbCi>Ws   Ndtype)numpyr   shaper   fieldsdescrrM   pickledsumanyvaluesr%   dumpsPICKLE_PROTOCOLr:   buffer)r;   r5   r   s      r   r=   CannedArray.__init__  s    +YY
(+		(8(8SYY__ciimm
syy>QDLYY#DLYY#%Xcii>N>N>U>U>W%X"X"XDL<<"LLo>?DL $Ct4C"3K=DLr   Nc                     SSK Jn  U R                  S   nU R                  (       a  [        R
                  " U5      $ U" X0R                  S9R                  U R                  5      $ )zGet the object.r   )
frombufferr   )	r   r   r:   r   r%   loadsr   reshaper   )r;   rA   r   datas       r   rB   CannedArray.get_object)  sF    $||A<<<<%%$jj199$**EEr   )r:   r   r   r   r   rD   r   r   r   r   r     s    ),Fr   r   c                   x    \ rS rSrSr\S\R                  \\	\R                  4   S\	4S j5       rS rS
S jrS	rg)CannedBytesi4  zA canned bytes object.bufreturnc                     [        U [        5      (       a  U R                  5       $ [        U [        5      (       d  [        U 5      $ U $ )z+Cast a buffer or memoryview object to bytes)r   
memoryviewtobytesbytes)r   s    r   wrapCannedBytes.wrap7  s9     c:&&;;= #u%%:
r   c                     U/U l         g)r   Nr:   rt   s     r   r=   CannedBytes.__init__@  s    ur   Nc                 B    U R                   S   nU R                  U5      $ )zGet the canned object.r   )r:   r   )r;   rA   r   s      r   rB   CannedBytes.get_objectD  s    ||Ayyr   r   r   )r   r   rE   rF   rG   staticmethodtypingUnionr   r   SupportsBytesr   r=   rB   rH   r   r   r   r   r   4  sE     &,,z5&2F2FFG E  r   r   c                       \ rS rSrSr\rSrg)CannedBufferiJ  zA canned buffer.r   N)r   r   rE   rF   rG   r   r   rH   r   r   r   r   r   J  s
    Dr   r   c                       \ rS rSrSr\rSrg)CannedMemoryViewiP  zA canned memory view.r   N)r   r   rE   rF   rG   r   r   rH   r   r   r   r   r   P  s
    Dr   r   c                 h   [        5       nUR                  S5        [        U R                  5       5       H;  u  p4[	        U[
        5      (       d  M   [        U5      nU R                  U5      X'   M=     g! [         a2    U(       a  X1;  a  UR                  SUSS9  U R                  U5         M{  f = f)z(import any string-keys in a type mappingzImporting canning mapz canning class not importable: %rT)exc_infoN)
r   debuglistr   r   rM   r   r)   	Exceptionerror)mappingoriginallogr<   _r   s         r   _import_mappingr   [  s    
,CII%&w}}'c30!#&  '{{3/ (  ! 3II@#PTIUC 	!s   A558B10B1c                 r   ^  [        U[        5      (       a  [        U 4S jU 5       5      $ [        T 5      UL $ )zFlike isinstance(obj, check), but strict

This won't catch subclasses.
c              3   >   >#    U  H  n[        T5      UL v   M     g 7fr   )r   )rh   r   r5   s     r   ri   istype.<locals>.<genexpr>r  s     5u49#us   )r   rn   r   r   )r5   checks   ` r   istyper   l  s2    
 %5u5559r   c                     Sn[         R                  5        H8  u  p#[        U[        5      (       a  Sn  O[	        X5      (       d  M0  U" U 5      s  $    U(       a  [        [         [        5        [        U 5      $ U $ )zprepare an object for picklingFT)r(   r   r   rM   r   r   _original_can_mapr6   )r5   import_neededr   canners       r   r6   r6   v  se     M}}c3 M##; '  	!233xJr   c                 f    [        U [        5      (       a  U R                  S:X  a  [        U 5      $ U $ )zCan a class object.r   )r   r   r   r   )r5   s    r   	can_classr     s*    #z""s~~'C3Jr   c                     [        U [        5      (       a*  0 nU R                  5        H  u  p#[        U5      X'   M     U$ U $ )zcan the *values* of a dict)r   dictr   r6   )r5   newobjr   r   s       r   can_dictr     s;    c4IIKDAAFI  Jr   c                     [        U [        5      (       a-  [        U 5      nU" U  Vs/ s H  n[        U5      PM     sn5      $ U $ s  snf )zcan the elements of a sequence)r   sequence_typesr   r6   )r5   tis      r   can_sequencer     s@    c>""I#&#Q#a&#&''J '   Ac                     Sn[         R                  5        H8  u  p4[        U[        5      (       a  Sn  O[        X5      (       d  M0  U" X5      s  $    U(       a  [	        [         [
        5        [        X5      $ U $ )zinvert canningFT)	uncan_mapr   r   rM   r   _original_uncan_mapr@   )r5   rA   r   r   uncanners        r   r@   r@     sh     M"*c3 McC## +  		#67S}Jr   c                     [        U [        5      (       a*  0 nU R                  5        H  u  p4[        XA5      X#'   M     U$ U $ )zUncan a dict object.)r   r   r   r@   )r5   rA   r   r   r   s        r   r   r     s;    c4IIKDAaFI  Jr   c           	          [        U [        5      (       a-  [        U 5      nU" U  Vs/ s H  n[        X15      PM     sn5      $ U $ s  snf )zUncan a sequence.)r   r   r   r@   )r5   rA   r   r   s       r   uncan_sequencer     s@    c>""Is+s!%+s+,,J ,r   znumpy.ndarrayc                 $    U R                  U5      $ r   )rB   )r5   rA   s     r   <lambda>r     s    !2r   r   r   ):rG   r4   r%   r   r   warningstypesr   ipyparallel.serializer   r'   traitlets.logr   traitlets.utils.importstringr   warnDeprecationWarningr   r   r   r   DEFAULT_PROTOCOLr   r   	cell_typer    r*   r.   r0   rJ   rX   rd   r   r   r   r   r   r   r   r6   r   r   r   rn   setr   r   r@   r   r   r   r(   r   r   Any__annotations__r   r   r   r   r   <module>r     s   D   
   	. % 4 F 

))& 	*$2$4( (V" ",$ $$&L\ &LRL, L4!F, !FH, ,; { 0"* s#( [.	; z	 
"GFO 2*%	4fjj !  LLN nn& m  		s   E
 
EE