+
    ^|i                         R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIHtH	t	H
t
 ^ RIHt ^ RIHt RR ltR tR tR	 t]	 ! R
 R]4      4       tR tR# )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                     V P                   P                  R / 4      pVf7   VP                  4        F   w  r4V P                  P	                  W44       K"  	  R# V P                  P	                  WV,          4       R# )stored_aliasesN)dbgetitemsalias_managerdefine_alias)ipalias	staliaseskvs   &&   ?/usr/lib/python3/dist-packages/IPython/extensions/storemagic.pyrestore_aliasesr      s`    		*B/I}??$CA ))!. %
 	%%eu-=>    c                 N   V P                   pVP                  R 4       F9  p\        P                  P	                  V4      p W,          pW@P
                  V&   K;  	  R#   \         d=    \        RT,          4       \        R\        P                  ! 4       ^ ,          4        K  i ; i)autorestore/*zEUnable to restore variable '%s', ignoring (use %%store -d to forget!)zThe error was:N)
r
   keysospathbasenameuser_nsKeyErrorprintsysexc_info)r   r
   keyjustkeyobjs   &    r   refresh_variablesr%   #   s    	Bww'''""3'	&'C #&JJw (
  	7Y\ccd"CLLN1$56	7s   AAB$#B$c                 X    V P                   P                  R . 4      V P                  R&   R# )dhist_dhN)r
   r   r   r   s   &r   restore_dhistr*   2   s    		'"-BJJur   c                 H    \        V 4       \        V 4       \        V 4       R # N)r%   r   r*   r)   s   &r   restore_datar-   6   s    bB"r   c                      a a ] tR t^<t oRt]! RRR7      P                  RR7      tV 3R lt]	]
R
R l4       4       tR	tVtV ;t# )StoreMagicszILightweight persistence for python variables.

Provides the %store magic.FzdIf True, any %store-d variables will be automatically restored
        when IPython starts.
        )helpT)configc                   < \         \        V `  VR 7       V P                  P                  P                  V 4       V P                  '       d   \        V P                  4       R# R# ))shellN)superr/   __init__r3   configurablesappendautorestorer-   )selfr3   	__class__s   &&r   r5   StoreMagics.__init__H   sJ    k4))6

  ''-$ r   c                	   V P                  VRRR7      w  r#VP                  4       pV P                  pVP                  pRV9   d    V^ ,          p VRV,            R# R	V9   d   VP                  R
4       F  p	Wi K  	  R# RV9   d@   V'       d+   V F"  p
 VRV
,           ,          pWP                  V
&   K$  	  R# \        V4       R# V'       g   VP                  R
4      pVP                  4        V'       d   \        \        \         V4      4      pM^ p\        R4       R\#        V4      ,           R,           pVP$                  pV FM  p\&        P(                  P+                  V4      p\        VV\-        V! VR4      4      R,          3,          4       KO  	  R# \!        V4      ^8  Ed]   V^,          P/                  R4      '       Ed>   \&        P(                  P1                  V^,          P3                  R4      P3                  4       4      pV^,          P/                  R4      '       d   \5        VRRR7      pM\5        VRRR7      pT;_uu_ 4        VP7                  V^ ,          4      p\        RV^ ,          : RVP8                  P:                  : RV: R24       \=        V\"        4      '       g   ^ RIHp V! VV4       M9VPA                  V4       VPC                  R4      '       g   VPA                  R4       RRR4       R# V F  p
 VP                  V
,          p\E        \F        PH                  ! V4      RR 4      pVR!8X  d,   \        \J        PL                  ! R"V
: R#V: R$24      4        R# WRV
,           &   \        R%V
: RVP8                  P:                  : R&24       K  	  R#   \         d   p\        RT,          4      ThRp?ii ; i  \         d   p\        R4      ThRp?ii ; i  \         d9     \        YZR7        EKz    \         d    \        RT
,          4         EK  i ; ii ; i  + '       g   i     R# ; i  \         d{    T
p TPN                  PQ                  T4      pM&  \R         d   p\        R'T,          4      ThRp?ii ; iTP%                  R(/ 4      pTTT&   TTR(&   \        R)T: R*T: R&24         R# i ; i)+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dz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>:N2   N>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splitr3   r
   BaseExceptionr   
IndexErrorr   r   r   r   r   r-   sortmaxmaplenstrr   r   r   r   repr
startswith
expanduserlstripopenevr:   rJ   
isinstancerH   writeendswithgetattrinspect	getmoduletextwrapdedentr   retrieve_alias
ValueError)r9   parameter_soptsargslargsr   r
   todeler   argr$   varssizefmtr   varr#   fnamfilrH   modnamenamecmdr   s   &&                       r   storeStoreMagics.storeN   s   \ ''Ex'H
{{}ZZUU$;RQR>E12 D[WW_-E . D[C. #!56 +.

3   R  77?+DIIK3sD>*<=s4y.*C&&C''**3/cWd3sO+D&Ec&JKKL  4y1}a!3!3C!8!8ww))$q'..*=*D*D*FG7%%d++tS7;CtS7;CS%%Q.CtAww..6 7 &sC001sC(		#"||D11IIdO   N**S/C  &g&7&7&<j"MG*,hoo
  #C/) + , 14,.S]]5K5KLM; A % R$%AE%IJPQQR  S !JKQRRS" $ JJ+B::' J!"BS"HIIJJH S    DP ..==dC% P()@4)GHaOP !#'7 ;I&)IdO+4B'(T3?@s   	O 
N* O/BP5*P5Q	*O5OOO,O''O,/P2;PP.(P2-P..P25Q		SQ32S3R>RR3SS )rK   )rJ   
__module____qualname____firstlineno____doc__r   tagr8   r5   r   r   rw   __static_attributes____classdictcell____classcell__)r:   __classdict__s   @@r   r/   r/   <   sZ     " u	 
cc	 % VN  VN VNr   r/   c                0    V P                  \        4       R# )zLoad the extension in IPython.N)register_magicsr/   r)   s   &r   load_ipython_extensionr      s    {#r   r,   )r}   ra   r   r    rc   IPython.core.errorr   IPython.core.magicr   r   r   IPython.testing.skipdoctestr   	traitletsr   r   r%   r*   r-   r/   r   ry   r   r   <module>r      s\   	 " ! ) ? ? 4 ?&. iN& iN iNX$r   