ó
    Ñ]jè  ã                   ó¢   • S 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	J
r
  SSKJr  SSKJr  SS jrS rS	 rS
 r\	 " S S\5      5       rS rg)zõ
%store magic for lightweight persistence.

Stores variables, aliases and macros in IPython's database.

To automatically restore stored variables at startup, add this to your
:file:`ipython_config.py` file::

  c.StoreMagics.autorestore = True
é    N)Ú
UsageError)ÚMagicsÚmagics_classÚ
line_magic)Úskip_doctest)ÚBoolc                 óè   • U R                   R                  S0 5      nUc5  UR                  5        H   u  p4U R                  R	                  X45        M"     g U R                  R	                  XU   5        g )NÚstored_aliases)ÚdbÚgetÚitemsÚalias_managerÚdefine_alias)ÚipÚaliasÚ	staliasesÚkÚvs        ÚZ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/IPython/extensions/storemagic.pyÚrestore_aliasesr      s`   € Ø—‘—	‘	Ð*¨BÓ/€IØ�}Ø—?‘?Ö$‰CˆAð ×Ñ×)Ñ)¨!Ö.ò %ð
 	×Ñ×%Ñ% e°uÑ-=Õ>ó    c                 ó2  • U R                   nUR                  S5       H5  n[        R                  R	                  U5      n X   nX@R
                  U'   M7     g ! [         a4    [        SU-  5        [        S[        R                  " 5       S   5         Mw  f = f)Núautorestore/*zEUnable to restore variable '%s', ignoring (use %%store -d to forget!)zThe error was:r   )
r   ÚkeysÚosÚpathÚbasenameÚuser_nsÚKeyErrorÚprintÚsysÚexc_info)r   r   ÚkeyÚjustkeyÚobjs        r   Úrefresh_variablesr&   #   s‚   € Ø	�‰€BØ�w‰w�Ö'ˆä—'‘'×"Ñ" 3Ó'ˆð	&Ø‘'ˆCð #&�J‰J�wÓò (øô
 ó 	7ÜÐYÐ\cÑcÔdÜÐ"¤C§L¢L£N°1Ñ$5×6ð	7ús   ÁAÁ:BÂBc                 óV   • U R                   R                  S/ 5      U R                  S'   g )NÚdhistÚ_dh)r   r   r   ©r   s    r   Úrestore_dhistr+   2   s   € ØŸ™Ÿ	™	 '¨"Ó-€B‡J�JˆuÒr   c                 óF   • [        U 5        [        U 5        [        U 5        g ©N)r&   r   r+   r*   s    r   Úrestore_datar.   6   s   € Ü�bÔÜ�BÔÜ�"Õr   c                   ór   ^ • \ rS rSrSr\" SSS9R                  SS9rU 4S jr\	\
SS	 j5       5       rS
rU =r$ )ÚStoreMagicsé<   zILightweight persistence for python variables.

Provides the %store magic.FzdIf True, any %store-d variables will be automatically restored
        when IPython starts.
        )ÚhelpT)Úconfigc                 óÀ   >• [         [        U ]  US9  U R                  R                  R                  U 5        U R                  (       a  [        U R                  5        g g )N)Úshell)Úsuperr0   Ú__init__r5   ÚconfigurablesÚappendÚautorestorer.   )Úselfr5   Ú	__class__s     €r   r7   ÚStoreMagics.__init__H   sG   ø€ ÜŒk˜4Ñ)°Ð)Ñ6Ø�
‰
× Ñ ×'Ñ'¨Ô-Ø××Ü˜Ÿ™Õ$ð r   c                 ó®  • U R                  USSS9u  p#UR                  5       nU R                  nUR                  nSU;   a   US   n USU-   	 gS
U;   a  UR                  S5       H  n	Xi	 M     gSU;   a4  U(       a!  U H  n
 USU
-      nXµR                  U
'   M     g[        U5        gU(       d¸  UR                  S5      nUR                  5         U(       a  [        [        [         U5      5      nOSn[        S5        S[#        U5      -   S-   nUR$                  nU HE  n[&        R(                  R+                  U5      n[        UU[-        U" US5      5      SS 4-  5        MG     g[!        U5      S:”  Ga5  US   R/                  S5      (       Ga  [&        R(                  R1                  US   R3                  S5      R3                  5       5      nUS   R/                  S5      (       a  [5        USSS9nO[5        USSS9nU   UR7                  US   5      n[        SUS   < SUR8                  R:                  < SU< S35        [=        U["        5      (       d  SSKJn  U" UU5        O8URA                  U5        URC                  S 5      (       d  URA                  S 5        SSS5        gU H“  n
 UR                  U
   n[E        [F        RH                  " U5      S!S"5      nUS#:X  a*  [        [J        RL                  " S$U
< S%U< S&35      5          gX¶SU
-   '   [        S'U
< SUR8                  R:                  < S(35        M•     g! [         a  n[        SU-  5      UeSnAff = f! [         a  n[        S	5      UeSnAff = f! [         a0     [        XZS9   GM   ! [         a    [        SU
-  5          GM=  f = ff = f! , (       d  f       g= f! [         at    U
n URN                  RQ                  U5      nO!! [R         a  n[        S)U-  5      UeSnAff = fUR%                  S*0 5      nUUU'   UUS*'   [        S+U< S,U< S(35           gf = f)-aŽ  Lightweight persistence for python variables.

Example::

  In [1]: l = ['hello',10,'world']
  In [2]: %store l
  Stored 'l' (list)
  In [3]: exit

  (IPython session is closed and started again...)

  ville@badger:~$ ipython
  In [1]: l
  NameError: name 'l' is not defined
  In [2]: %store -r
  In [3]: l
  Out[3]: ['hello', 10, 'world']

Usage:

* ``%store``          - Show list of all variables and their current
                        values
* ``%store spam bar`` - Store the *current* value of the variables spam
                        and bar to disk
* ``%store -d spam``  - Remove the variable and its value from storage
* ``%store -z``       - Remove all variables from storage
* ``%store -r``       - Refresh all variables, aliases and directory history
                        from store (overwrite current vals)
* ``%store -r spam bar`` - Refresh specified variables and aliases from store
                           (delete current val)
* ``%store foo >a.txt``  - Store value of foo to new file a.txt
* ``%store foo >>a.txt`` - Append value of foo to file a.txt

It should be noted that if you change the value of a variable, you
need to %store it again if you want to persist the new value.

Note also that the variables will need to be pickleable; most basic
python types can be safely %store'd.

Also aliases can be %store'd across sessions.
To remove an alias from the storage, use the %unalias magic.
ÚdrzÚstring)ÚmodeÚdr   zautorestore/zCan't delete variable '%s'Nz'You must provide the variable to forgetÚzr   Úr)r   zno stored variable or alias %sz(Stored variables and their in-db values:z%-zs -> %sz<unavailable>é2   é   Ú>z>>Úazutf-8)ÚencodingÚwz	Writing 'z' (z) to file 'z'.)ÚpprintÚ
Ú__name__Ú Ú__main__z                         Warning:z is a  
                        Proper storage of interactively declared classes (or instances
                        of those classes) is not possible! Only instances
                        of classes in real modules on file system can be %store'd.
                        zStored 'Ú)zUnknown variable '%s'r
   zAlias stored: z ()*Úparse_optionsÚsplitr5   r   ÚBaseExceptionr   Ú
IndexErrorr   r   r   r   r    r.   ÚsortÚmaxÚmapÚlenÚstrr   r   r   r   ÚreprÚ
startswithÚ
expanduserÚlstripÚopenÚevr<   rM   Ú
isinstancerK   ÚwriteÚendswithÚgetattrÚinspectÚ	getmoduleÚtextwrapÚdedentr   Úretrieve_aliasÚ
ValueError)r;   Úparameter_sÚoptsÚargslÚargsr   r   ÚtodelÚer   Úargr%   ÚvarsÚsizeÚfmtr   Úvarr$   ÚfnamÚfilrK   ÚmodnameÚnameÚcmdr   s                            r   ÚstoreÚStoreMagics.storeN   s  € ð\ ×'Ñ'¨°E¸xÐ'ÐH‰
ˆØ�{‰{‹}ˆØ�Z‰ZˆØ�U‰Uˆà�$‹;ðRØ˜Q™�ðRØ˜>¨EÑ1Ñ2ð �D‹[Ø—W‘W˜_Ö-�Ø’Eò .ð �D‹[ÞÛ�Cð.Ø  °#Ñ!5Ñ6˜ð +.Ÿ
™
 3›ò  ô ˜RÕ ö Ø—7‘7˜?Ó+ˆDØ�I‰IŒKÞÜœ3œs D›>Ó*‘à�äÐ<Ô=Ø”s˜4“y‘. Ñ*ˆCØ—&‘&ˆCÛ�ÜŸ'™'×*Ñ*¨3Ó/�ä�c˜W¤d©3¨s°OÓ+DÓ&EÀcÀrÐ&JÐKÑKÖLò ô �4‹y˜1Œ}  a¡×!3Ñ!3°C×!8Ò!8Ü—w‘w×)Ñ)¨$¨q©'¯.©.¸Ó*=×*DÑ*DÓ*FÓG�Ø˜‘7×%Ñ% d×+Ñ+Ü˜t S°7Ñ;‘Cä˜t S°7Ñ;�CÚØŸ%™%  Q¡›.�CÝ¸tÀA¼wØŸ™×.Ô.³ð6ô 7ô & s¬C×0Ñ0Ý1Ù˜s CÕ(àŸ	™	 #œØ"Ÿ|™|¨D×1Ñ1ØŸI™I dœO÷ ð ó �ðNØŸ*™* S™/�Cô  &¤g×&7Ò&7¸Ó&<¸jÈ"ÓM�GØ *Ó,ÜœhŸo›oó
  #£Cð/)ó +ô ,ñ à14˜¨Ñ,Ñ.Ý³°S·]±]×5KÔ5KÐLÖMò; øôA %ó RÜ$Ð%AÀEÑ%IÓJÐPQÐQûðRûô ó SÜ Ð!JÓKÐQRÐRûðSûô" $ó JðJÜ+¨BÖ:øÜ'ó JÜ!Ð"BÀSÑ"H×IÑIðJúðJú÷H ”Sð ûô  ó à�DðPØ ×.Ñ.×=Ñ=¸dÓC™øÜ%ó PÜ(Ð)@À4Ñ)GÓHÈaÐOûðPúð !#§¡Ð'7¸Ó ;�IØ&)�I˜d‘OØ+4�BÐ'Ñ(Ý³T»3Ð?Ô@Úðús�   ÁM* Á	M	 ÂNÈB!OÊ5OÍ	
M'ÍM"Í"M'Í*
NÍ4N Î NÎ
OÎ	N Î N>Î8OÎ=N>Î>OÏ
OÏQÏ#O?Ï>QÏ?
PÐ	PÐPÐ3QÑQ© )rN   )rM   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   Útagr:   r7   r   r   rz   Ú__static_attributes__Ú__classcell__)r<   s   @r   r0   r0   <   sQ   ø† ñ"ñ �uð	ñ÷ 
�c�€cÐð	 õ%ð ØóVNó ó öVNr   r0   c                 ó.   • U R                  [        5        g)zLoad the extension in IPython.N)Úregister_magicsr0   r*   s    r   Úload_ipython_extensionr†   é   s   € à×Ñ”{Õ#r   r-   )r€   rd   r   r!   rf   ÚIPython.core.errorr   ÚIPython.core.magicr   r   r   ÚIPython.testing.skipdoctestr   Ú	traitletsr   r   r&   r+   r.   r0   r†   r|   r   r   Ú<module>r‹      s\   ðñ	÷ "× !å )ß ?Ñ ?Ý 4Ý ô?ò&ò.òð ôiN�&ó iNó ðiNóX$r   