§
    �ŸjÚY  ã                   ó‚  — d Z ddlmZ ddlmZmZmZ 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mZmZ ddlmZ  G d„ d	¦  «        Zg d
¢Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ efd„ efd„ efgZe                     d„ d„ fg¦  «         d„ Z G d„ d¦  «        Zg d¢Zdd„Z eddfd„Z!e G d„ de¦  «        ¦   «         Z"d„ Z#dS ) aÙ  IPython extension to reload modules before executing user code.

``autoreload`` reloads modules automatically before entering the execution of
code typed at the IPython prompt.

This makes for example the following workflow possible:

.. sourcecode:: ipython

   In [1]: %load_ext autoreload

   In [2]: %autoreload 2

   In [3]: from foo import some_function

   In [4]: some_function()
   Out[4]: 42

   In [5]: # open foo.py in an editor and change some_function to return 43

   In [6]: some_function()
   Out[6]: 43

The module was reloaded without reloading it explicitly, and the object
imported with ``from foo import ...`` was also updated.

Usage
=====

The following magic commands are provided:

``%autoreload``, ``%autoreload now``

    Reload all modules (except those excluded by ``%aimport``)
    automatically now.

``%autoreload 0``, ``%autoreload off``

    Disable automatic reloading.

``%autoreload 1``, ``%autoreload explicit``

    Reload all modules imported with ``%aimport`` every time before
    executing the Python code typed.

``%autoreload 2``, ``%autoreload all``

    Reload all modules (except those excluded by ``%aimport``) every
    time before executing the Python code typed.

``%autoreload 3``, ``%autoreload complete``

    Same as 2/all, but also adds any new objects in the module. See
    unit test at IPython/extensions/tests/test_autoreload.py::test_autoload_newly_added_objects

  Adding ``--print`` or ``-p`` to the ``%autoreload`` line will print autoreload activity to
  standard out. ``--log`` or ``-l`` will do it to the log at INFO level; both can be used
  simultaneously.

``%aimport``

    List modules which are to be automatically imported or not to be imported.

``%aimport foo``

    Import module 'foo' and mark it to be autoreloaded for ``%autoreload 1``

``%aimport foo, bar``

    Import modules 'foo', 'bar' and mark them to be autoreloaded for ``%autoreload 1``

``%aimport -foo``

    Mark module 'foo' to not be autoreloaded.

Caveats
=======

Reloading Python modules in a reliable way is in general difficult,
and unexpected things may occur. ``%autoreload`` tries to work around
common pitfalls by replacing function code objects and parts of
classes previously in the module with new versions. This makes the
following things to work:

- Functions and classes imported via 'from xxx import foo' are upgraded
  to new versions when 'xxx' is reloaded.

- Methods and properties of classes are upgraded on reload, so that
  calling 'c.foo()' on an object 'c' created before the reload causes
  the new code for 'foo' to be executed.

Some of the known remaining caveats are:

- Replacing code objects does not always succeed: changing a @property
  in a class to an ordinary method or a method to a member variable
  can cause problems (but in old objects only).

- Functions that are removed (eg. via monkey-patching) from a module
  before it is reloaded are not upgraded.

- C extension modules cannot be reloaded, and so cannot be autoreloaded.

- While comparing Enum and Flag, the 'is' Identity Operator is used (even in the case '==' has been used (Similar to the 'None' keyword)).

- Reloading a module, or importing the same module by a different name, creates new Enums. These may look the same, but are not.
é    )Úmagic_arguments)ÚMagicsÚmagics_classÚ
line_magicTN)Úimport_moduleÚreload)Úsource_from_cachec                   óH   — e Zd ZdZ	 dZ	 dZ	 d
d„Zd„ Zd„ Zd„ Z	d„ Z
dd	„ZdS )ÚModuleReloaderFTNc                 ó˜   — i | _         i | _        i | _        i | _        i | _        || _        d„ | _        |                      dd¬¦  «         d S )Nc                 ó   — d S ©N© ©Úmsgs    új/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/IPython/extensions/autoreload.pyú<lambda>z)ModuleReloader.__init__.<locals>.<lambda>¨   s   €  4€ ó    TF)Ú	check_allÚ	do_reload)ÚfailedÚmodulesÚskip_modulesÚold_objectsÚmodules_mtimesÚshellÚ_reportÚcheck)Úselfr   s     r   Ú__init__zModuleReloader.__init__š   sY   € àˆŒàˆŒàˆÔàˆÔà ˆÔØˆŒ
ð (Ð'ˆŒð 	�
Š
˜T¨Uˆ
Ñ3Ô3Ð3Ð3Ð3r   c                 óN   — 	 | j         |= n# t          $ r Y nw xY wd| j        |<   dS )z-Skip reloading the named module in the futureTN)r   ÚKeyErrorr   ©r   Úmodule_names     r   Úmark_module_skippedz"ModuleReloader.mark_module_skipped­   sG   € ð	Ø”˜[Ð)Ð)øÝð 	ð 	ð 	ØˆDð	øøøà)-ˆÔ˜+Ñ&Ð&Ð&ó   ‚ ‹
—c                 óN   — 	 | j         |= n# t          $ r Y nw xY wd| j        |<   dS )z9Reload the named module in the future (if it is imported)TN)r   r"   r   r#   s     r   Úmark_module_reloadablez%ModuleReloader.mark_module_reloadableµ   sG   € ð	ØÔ! +Ð.Ð.øÝð 	ð 	ð 	ØˆDð	øøøà$(ˆŒ�[Ñ!Ð!Ð!r&   c                 ó¬   — |                       |¦  «         t          |¦  «         |                     d¦  «        d         }t          j        |         }||fS )zìImport a module, and mark it reloadable

        Returns
        -------
        top_module : module
            The imported module if it is top-level, or the top-level
        top_name : module
            Name of top_module

        ú.r   )r(   r   ÚsplitÚsysr   )r   r$   Útop_nameÚ
top_modules       r   Úaimport_modulezModuleReloader.aimport_module½   sU   € ð 	×#Ò# KÑ0Ô0Ð0å�kÑ"Ô"Ð"Ø×$Ò$ SÑ)Ô)¨!Ô,ˆÝ”[ Ô*ˆ
Ø˜8Ð#Ð#r   c                 óŠ  — t          |d¦  «        r|j        €dS t          |dd ¦  «        dv rdS |j        }t          j                             |¦  «        \  }}|                     ¦   «         dk    r|}n"	 t          |¦  «        }n# t          $ r Y dS w xY w	 t          j	        |¦  «        j
        }n# t          $ r Y dS w xY w||fS )NÚ__file__)NNÚ__name__)NÚ__mp_main__Ú__main__z.py)Úhasattrr1   ÚgetattrÚosÚpathÚsplitextÚlowerr	   Ú
ValueErrorÚstatÚst_mtimeÚOSError)r   ÚmoduleÚfilenamer8   ÚextÚpy_filenameÚpymtimes          r   Úfilename_and_mtimez!ModuleReloader.filename_and_mtimeÏ   sõ   € Ý�v˜zÑ*Ô*ð 	¨f¬oÐ.EØ�:å�6˜: tÑ,Ô,Ð0QÐQÐQà�:à”?ˆÝ”G×$Ò$ XÑ.Ô.‰	ˆˆcà�9Š9‰;Œ;˜%ÒÐØ"ˆKˆKð"Ý/°Ñ9Ô9��øÝð "ð "ð "Ø!�z�zð"øøøð	Ý”g˜kÑ*Ô*Ô3ˆGˆGøÝð 	ð 	ð 	Ø�:�:ð	øøøð ˜GÐ#Ð#s$   Á4B Â
BÂBÂB0 Â0
B>Â=B>c           
      ó¨  — | j         s|sdS |s| j        r,t          t          j                             ¦   «         ¦  «        }n&t          | j                             ¦   «         ¦  «        }|D �]g}t          j                             |d¦  «        }|| j        v rŒ-|                      |¦  «        \  }}|€ŒH	 || j	        |         k    rŒ[	 | j
                             |d¦  «        |k    rŒ|n# t          $ r || j	        |<   Y Œ“w xY w|| j	        |<   |rÄ|                      d|› d�¦  «         	 | j        r"t          |t          | j        | j        ¦  «         nt          |t          | j        ¦  «         || j
        v r| j
        |= �Œ#  t%          d                     |t)          j        d¦  «        ¦  «        t          j        ¬¦  «         || j
        |<   Y �ŒdxY w�ŒidS )z/Check whether some modules need to be reloaded.NzReloading 'z'.z[autoreload of {} failed: {}]é
   )Úfile)Úenabledr   Úlistr,   r   ÚkeysÚgetr   rD   r   r   r"   r   Úautoload_objÚsuperreloadr   r   r   ÚprintÚformatÚ	tracebackÚ
format_excÚstderr)r   r   r   r   ÚmodnameÚmrB   rC   s           r   r   zModuleReloader.checké   s,  € ð Œ|ð 	 Ið 	ØˆFàð 	0˜œð 	0Ý�3œ;×+Ò+Ñ-Ô-Ñ.Ô.ˆGˆGå˜4œ<×,Ò,Ñ.Ô.Ñ/Ô/ˆGàð '	7ñ '	7ˆGÝ”—’ ¨Ñ.Ô.ˆAà˜$Ô+Ð+Ð+Øà#'×#:Ò#:¸1Ñ#=Ô#=Ñ ˆK˜ØÐ"ØðØ˜dÔ1°'Ô:Ò:Ð:Øð ;ð ”;—?’? ;°Ñ5Ô5¸Ò@Ð@Øð Aøõ	 ð ð ð Ø/6�Ô# GÑ,Ø�ðøøøð ,3ˆDÔ Ñ(ð ð 7Ø—’Ð6¨7Ð6Ð6Ð6Ñ7Ô7Ð7ð7ØÔ(ð AÝ# A¥v¨tÔ/?ÀÄÑLÔLÐLÐLå# A¥v¨tÔ/?Ñ@Ô@Ð@Ø" d¤kÐ1Ð1Ø œK¨Ð4ùøð7ÝØ7×>Ò>Ø#¥YÔ%9¸"Ñ%=Ô%=ñô õ !œZð	ñ ô ð ð 07�D”K Ñ,Ð,Ñ,øøøñ!7ð/'	7ð '	7s    Â2C&Ã&C=Ã<C=Ä&AE=Å=AGr   )FT)r2   Ú
__module__Ú__qualname__rH   r   rL   r    r%   r(   r/   rD   r   r   r   r   r   r   �   s�   € € € € € Ø€GØ*à€IØDà€LØ=ð4ð 4ð 4ð 4ð&.ð .ð .ð)ð )ð )ð$ð $ð $ð$$ð $ð $ð427ð 27ð 27ð 27ð 27ð 27r   r   )Ú__code__Ú__defaults__Ú__doc__Ú__closure__Ú__globals__Ú__dict__c           	      óˆ   — t           D ]9}	 t          | |t          ||¦  «        ¦  «         Œ## t          t          f$ r Y Œ6w xY wdS )z%Upgrade the code object of a functionN)Ú
func_attrsÚsetattrr6   ÚAttributeErrorÚ	TypeError)ÚoldÚnewÚnames      r   Úupdate_functionre   -  sd   € åð ð ˆð	Ý�C˜�w s¨DÑ1Ô1Ñ2Ô2Ð2Ð2øÝ¥	Ð*ð 	ð 	ð 	ØˆDð	øøøðð s   ‹+«?¾?c                 ó’   — t          j        | ¦  «        }|D ]/}t          |¦  «        | u rt                               |d|¦  «         Œ0dS )zšUse garbage collector to find all instances that refer to the old
    class definition and update their __class__ to point to the new class
    definitionÚ	__class__N)ÚgcÚget_referrersÚtypeÚobjectÚ__setattr__)rb   rc   ÚrefsÚrefs       r   Úupdate_instancesro   6  sW   € õ
 Ô˜CÑ Ô €Dàð 6ð 6ˆÝ�‰9Œ9˜ÐÐÝ×Ò˜s K°Ñ5Ô5Ð5øð6ð 6r   c           	      óø  — t          | j                             ¦   «         ¦  «        D ]¹}t          | |¦  «        }	 t          ||¦  «        }||k    du rŒ,nD# t          $ r, 	 t          | |¦  «         n# t          t          f$ r Y nw xY wY Œbt          $ r Y nw xY wt          ||¦  «        rŒ‚	 t          | |t          ||¦  «        ¦  «         Œ£# t          t          f$ r Y Œ¶w xY wt          |j                             ¦   «         ¦  «        D ]b}|t          | j                             ¦   «         ¦  «        vr8	 t          | |t          ||¦  «        ¦  «         ŒK# t          t          f$ r Y Œ^w xY wŒct          | |¦  «         dS )zjReplace stuff in the __dict__ of a class, and upgrade
    method code objects, and add new methods, if anyTN)rI   r\   rJ   r6   r`   Údelattrra   r;   Úupdate_genericr_   ro   )rb   rc   ÚkeyÚold_objÚnew_objs        r   Úupdate_classrv   B  sê  € õ �C”L×%Ò%Ñ'Ô'Ñ(Ô(ð ð ˆÝ˜#˜sÑ#Ô#ˆð	Ý˜c 3Ñ'Ô'ˆGð ˜7Ò" tÐ+Ð+Øð ,øåð 	ð 	ð 	ðÝ˜˜SÑ!Ô!Ð!Ð!øÝ"¥IÐ.ð ð ð Ø�ðøøøàˆHÝð 	ð 	ð 	ð ˆDð	øøøõ
 ˜' 7Ñ+Ô+ð 	Øð	Ý�C˜�g c¨3Ñ/Ô/Ñ0Ô0Ð0Ð0øÝ¥	Ð*ð 	ð 	ð 	ØˆDð	øøøõ �C”L×%Ò%Ñ'Ô'Ñ(Ô(ð ð ˆØ•d˜3œ<×,Ò,Ñ.Ô.Ñ/Ô/Ð/Ð/ðÝ˜˜S¥'¨#¨sÑ"3Ô"3Ñ4Ô4Ð4Ð4øÝ"¥IÐ.ð ð ð Ø�ðøøøð 0õ �S˜#ÑÔÐÐÐs_   ºAÁ
BÁA0Á/BÁ0BÂBÂBÂBÂ		BÂBÂ*C
Ã
CÃCÄ2EÅE&Å%E&c                 ó¢   — t          | j        |j        ¦  «         t          | j        |j        ¦  «         t          | j        |j        ¦  «         dS )z+Replace get/set/del functions of a propertyN)rr   ÚfdelÚfgetÚfset)rb   rc   s     r   Úupdate_propertyr{   l  sD   € å�3”8˜SœXÑ&Ô&Ð&Ý�3”8˜SœXÑ&Ô&Ð&Ý�3”8˜SœXÑ&Ô&Ð&Ð&Ð&r   c                 óB   — t          | |¦  «        ot          ||¦  «        S r   )Ú
isinstance)ÚaÚbÚtyps      r   Úisinstance2r�   s  s!   € Ý�a˜ÑÔÐ4¥*¨Q°Ñ"4Ô"4Ð4r   c                 ó.   — t          | |t          ¦  «        S r   )r�   rj   ©r~   r   s     r   r   r   x  s   € •+˜a ¥DÑ)Ô)€ r   c                 ó8   — t          | |t          j        ¦  «        S r   )r�   ÚtypesÚFunctionTyperƒ   s     r   r   r   y  s   € •+˜a ¥EÔ$6Ñ7Ô7€ r   c                 ó.   — t          | |t          ¦  «        S r   )r�   Úpropertyrƒ   s     r   r   r   z  s   € •+˜a ¥HÑ-Ô-€ r   c                 ó8   — t          | |t          j        ¦  «        S r   )r�   r…   Ú
MethodTyperƒ   s     r   r   r     s   € � Q¨­5Ô+;Ñ<Ô<€ r   c                 ó6   — t          | j        |j        ¦  «        S r   )re   Ú__func__rƒ   s     r   r   r   €  s   € �¨¬°Q´ZÑ@Ô@€ r   c                 óV   — t           D ] \  }} || |¦  «        r || |¦  «          dS Œ!dS )NTF)ÚUPDATE_RULES)r~   r   Ú
type_checkÚupdates       r   rr   rr   †  sL   € Ý*ð ð Ñˆ
�FØˆ:�a˜ÑÔð 	ØˆF�1�a‰LŒLˆLØ�4�4ð	ð ˆ5r   c                   ó   — e Zd Zd„ Zd„ ZdS )Ú	StrongRefc                 ó   — || _         d S r   ©Úobj)r   r•   s     r   r    zStrongRef.__init__�  s   € ØˆŒˆˆr   c                 ó   — | j         S r   r”   ©r   s    r   Ú__call__zStrongRef.__call__’  s	   € ØŒxˆr   N)r2   rU   rV   r    r˜   r   r   r   r’   r’   Ž  s2   € € € € € ðð ð ðð ð ð ð r   r’   )r2   rY   Ú__package__Ú
__loader__Ú__spec__r1   Ú
__cached__Ú__builtins__Fc                 ó  — t          |d¦  «        o|j        | j        k    }|r|s|t          v rdS n|sdS | j        |f}	 |                     |g ¦  «                             t          j        |¦  «        ¦  «         n# t          $ r Y nw xY wdS )NrU   FT)	r5   rU   r2   Ú	mod_attrsÚ
setdefaultÚappendÚweakrefrn   ra   )r?   Údrd   r•   ÚautoloadÚ	in_modulers   s          r   Ú
append_objr¦   ¢  s±   € Ý˜˜\Ñ*Ô*ÐP¨s¬~ÀÄÒ/P€IØð àð 	˜T¥YÐ.Ð.Ø�5øàð 	Ø�5àŒ?˜DÐ
!€CðØ	�Š�S˜"ÑÔ×$Ò$¥W¤[°Ñ%5Ô%5Ñ6Ô6Ð6Ð6øÝð ð ð Øˆðøøøàˆ4s   ¿;A; Á;
BÂBc                 óÆ  — |€i }t          | j                             ¦   «         ¦  «        D ]m\  }}t          | |||¦  «        sŒ| j        |f}	 |                     |g ¦  «                             t          j        |¦  «        ¦  «         Œ^# t          $ r Y Œjw xY w	 | j         
                    ¦   «         }| j        }| j                             ¦   «          || j        d<   |d         | j        d<   n# t          t          t          f$ r Y nw xY w	  || ¦  «        } n #  | j                             |¦  «         ‚ xY wt          | j                             ¦   «         ¦  «        D ]‚\  }}	| j        |f}||vr&|�|dk    st          | |||	d¦  «        sŒ.|	|j        |<   g }
||         D ]4} |¦   «         }|€Œ|
                     |¦  «         t!          ||	¦  «         Œ5|
r|
||<   Œ||= Œƒ| S )a2  Enhanced version of the builtin reload function.

    superreload remembers objects previously in the module, and

    - upgrades the class dictionary of every old class in the module
    - upgrades the code object of every old function and method
    - clears the module's namespace before reloading

    Nr2   rš   ÚEnumT)rI   r\   Úitemsr¦   r2   r    r¡   r¢   rn   ra   ÚcopyÚclearr`   r"   r�   Úuser_nsrr   )r?   r   r   r   rd   r•   rs   Úold_dictÚold_nameru   Únew_refsÚold_refrt   s                r   rM   rM   ´  sV  € ð ÐØˆõ ˜&œ/×/Ò/Ñ1Ô1Ñ2Ô2ð ð ‰	ˆˆcÝ˜& +¨t°SÑ9Ô9ð 	ØØŒ Ð%ˆð	Ø×"Ò" 3¨Ñ+Ô+×2Ò2µ7´;¸sÑ3CÔ3CÑDÔDÐDÐDøÝð 	ð 	ð 	ØˆDð	øøøðà”?×'Ò'Ñ)Ô)ˆØ”?ˆØŒ×ÒÑÔÐØ&.ˆŒ˜
Ñ#Ø(0°Ô(>ˆŒ˜Ñ%Ð%øÝ•~¥xÐ0ð ð ð ØˆðøøøðØ�˜‘”ˆˆøðàŒ×Ò˜xÑ(Ô(Ð(Øøøøõ ˜fœo×3Ò3Ñ5Ô5Ñ6Ô6ð !ð !‰ˆˆgØŒ Ð%ˆØ�kÐ!Ð!ð �Ø˜6’>�>Ý! &¨+°t¸WÀdÑKÔKð "ð Ø")ˆEŒM˜$ÑàˆØ" 3Ô'ð 	-ð 	-ˆGØ�g‘i”iˆGØˆØØ�OŠO˜GÑ$Ô$Ð$Ý˜7 GÑ,Ô,Ð,Ð,àð 	!Ø'ˆK˜ÑÐà˜CÐ Ð à€Ms1   Á;B	Â	
BÂBÂAC. Ã.DÄDÄD ÄD5c                   ó&  ‡ — e Zd Zˆ fd„Ze ej        ¦   «          ej        deddd¬¦  «         ej        ddd	d
d¬¦  «         ej        ddd	d
d¬¦  «        dd„¦   «         ¦   «         ¦   «         ¦   «         ¦   «         Zedd„¦   «         Z	d„ Z
d„ Zˆ xZS )ÚAutoreloadMagicsc                 óØ   •—  t          ¦   «         j        |i |¤Ž t          | j        ¦  «        | _        d| j        _        d| j        _        t          t          j	        ¦  «        | _
        d S )NF)Úsuperr    r   r   Ú	_reloaderr   rL   Úsetr,   r   Úloaded_modules)r   r~   Úkwrg   s      €r   r    zAutoreloadMagics.__init__  s\   ø€ Ø�‰ŒÔ˜!Ð"˜rÐ"Ð"Ð"Ý'¨¬
Ñ3Ô3ˆŒØ#(ˆŒÔ Ø&+ˆŒÔ#Ý!¥#¤+Ñ.Ô.ˆÔÐÐr   ÚmodeÚnowú?aG  blank or 'now' - Reload all modules (except those excluded by %%aimport)
             automatically now.

             '0' or 'off' - Disable automatic reloading.

             '1' or 'explicit' - Reload only modules imported with %%aimport every
             time before executing the Python code typed.

             '2' or 'all' - Reload all modules (except those excluded by %%aimport)
             every time before executing the Python code typed.

             '3' or 'complete' - Same as 2/all, but also but also adds any new
             objects in the module.
             )rj   ÚdefaultÚnargsÚhelpz-pz--printÚ
store_trueFz1Show autoreload activity using `print` statements)Úactionr¼   r¾   z-lz--logz)Show autoreload activity using the loggerÚ c                 óT  ‡‡— t          j        | j        |¦  «        }|j                             ¦   «         }t
          Št          j        d¦  «        }|j        Šˆˆfd„}|j        du r|j	        du rd„ | j
        _        nA|j        du r#|j	        du r|| j
        _        n"‰| j
        _        n|j	        du r‰| j
        _        |dk    s|dk    r| j
                             d¦  «         dS |dk    s|d	k    rd| j
        _        dS |d
k    s|dk    r&d| j
        _        d| j
        _        d| j
        _        dS |dk    s|dk    r&d| j
        _        d| j
        _        d| j
        _        dS |dk    s|dk    r&d| j
        _        d| j
        _        d| j
        _        dS t!          d|› d�¦  «        ‚)a¸  %autoreload => Reload modules automatically

        %autoreload or %autoreload now
        Reload all modules (except those excluded by %aimport) automatically
        now.

        %autoreload 0 or %autoreload off
        Disable automatic reloading.

        %autoreload 1 or %autoreload explicit
        Reload only modules imported with %aimport every time before executing
        the Python code typed.

        %autoreload 2 or %autoreload all
        Reload all modules (except those excluded by %aimport) every time
        before executing the Python code typed.

        %autoreload 3 or %autoreload complete
        Same as 2/all, but also but also adds any new objects in the module. See
        unit test at IPython/extensions/tests/test_autoreload.py::test_autoload_newly_added_objects

        The optional arguments --print and --log control display of autoreload activity. The default
        is to act silently; --print (or -p) will print out the names of modules that are being
        reloaded, and --log (or -l) outputs them to the log at INFO level.

        Reloading Python modules in a reliable way is in general
        difficult, and unexpected things may occur. %autoreload tries to
        work around common pitfalls by replacing function code objects and
        parts of classes previously in the module with new versions. This
        makes the following things to work:

        - Functions and classes imported via 'from xxx import foo' are upgraded
          to new versions when 'xxx' is reloaded.

        - Methods and properties of classes are upgraded on reload, so that
          calling 'c.foo()' on an object 'c' created before the reload causes
          the new code for 'foo' to be executed.

        Some of the known remaining caveats are:

        - Replacing code objects does not always succeed: changing a @property
          in a class to an ordinary method or a method to a member variable
          can cause problems (but in old objects only).

        - Functions that are removed (eg. via monkey-patching) from a module
          before it is reloaded are not upgraded.

        - C extension modules cannot be reloaded, and so cannot be
          autoreloaded.

        Ú
autoreloadc                 ó4   •—  ‰| ¦  «          ‰| ¦  «         d S r   r   )r   ÚlÚps    €€r   Úplz'AutoreloadMagics.autoreload.<locals>.pli  s!   ø€ ØˆAˆc‰FŒFˆFØˆAˆc‰FŒFˆFˆFˆFr   Fc                 ó   — d S r   r   r   s    r   r   z-AutoreloadMagics.autoreload.<locals>.<lambda>n  s   € °€ r   TrÁ   rº   Ú0ÚoffÚ1ÚexplicitÚ2ÚallÚ3ÚcompletezUnrecognized autoreload mode "z".N)r   Úparse_argstringrÃ   r¹   r:   rN   ÚloggingÚ	getLoggerÚinfoÚlogrµ   r   r   rH   r   rL   r;   )r   ÚlineÚargsr¹   ÚloggerrÇ   rÅ   rÆ   s         @@r   rÃ   zAutoreloadMagics.autoreload  sç  øø€ õp Ô.¨t¬ÀÑEÔEˆØŒy�ŠÑ Ô ˆåˆåÔ" <Ñ0Ô0ˆàŒKˆð	ð 	ð 	ð 	ð 	ð 	ð Œ:˜ÐÐ 4¤8¨uÐ#4Ð#4Ø%5Ð%5ˆDŒNÔ"Ð"ØŒZ˜4ÐÐØŒx˜4ÐÐØ)+�”Ô&Ð&à)*�”Ô&Ð&ØŒX˜ÐÐØ%&ˆDŒNÔ"à�2Š:ˆ:˜ š˜ØŒN× Ò  Ñ&Ô&Ð&Ð&Ð&Ø�SŠ[ˆ[˜D EšM˜MØ%*ˆDŒNÔ"Ð"Ð"Ø�SŠ[ˆ[˜D JÒ.Ð.Ø%)ˆDŒNÔ"Ø',ˆDŒNÔ$Ø*/ˆDŒNÔ'Ð'Ð'Ø�SŠ[ˆ[˜D EšM˜MØ%)ˆDŒNÔ"Ø'+ˆDŒNÔ$Ø*/ˆDŒNÔ'Ð'Ð'Ø�SŠ[ˆ[˜D JÒ.Ð.Ø%)ˆDŒNÔ"Ø'+ˆDŒNÔ$Ø*.ˆDŒNÔ'Ð'Ð'åÐF¸dÐFÐFÐFÑGÔGÐGr   Nc                 ó  — |}|sÞt          | j        j                             ¦   «         ¦  «        }t          | j        j                             ¦   «         ¦  «        }|€t
          j        }| j        j        r|                     d¦  «         n+|                     dd 	                    |¦  «        z  ¦  «         |                     dd 	                    |¦  «        z  ¦  «         dS d„ | 
                    d¦  «        D ¦   «         D ]‡}|                     d¦  «        r7|d	d…                              ¦   «         }| j                             |¦  «         ŒN| j                             |¦  «        \  }}| j                             ||i¦  «         ŒˆdS )
a"  %aimport => Import modules for automatic reloading.

        %aimport
        List modules to automatically import and not to import.

        %aimport foo
        Import module 'foo' and mark it to be autoreloaded for %autoreload explicit

        %aimport foo, bar
        Import modules 'foo', 'bar' and mark them to be autoreloaded for %autoreload explicit

        %aimport -foo, bar
        Mark module 'foo' to not be autoreloaded for %autoreload explicit, all, or complete, and 'bar'
        to be autoreloaded for mode explicit.
        Nz&Modules to reload:
all-except-skipped
zModules to reload:
%s
ú z
Modules to skip:
%s
c                 ó6   — g | ]}|                      ¦   «         ‘ŒS r   )Ústrip)Ú.0Ú_s     r   ú
<listcomp>z,AutoreloadMagics.aimport.<locals>.<listcomp>§  s    € ÐBÐBÐB¨!˜AŸGšG™IœIÐBÐBÐBr   ú,ú-é   )Úsortedrµ   r   rJ   r   r,   Ústdoutr   ÚwriteÚjoinr+   Ú
startswithrÜ   r%   r/   r   Úpush)	r   Úparameter_sÚstreamrS   Ú	to_reloadÚto_skipÚ_moduler.   r-   s	            r   ÚaimportzAutoreloadMagics.aimportŠ  s~  € ð" ˆØð 	<Ý˜tœ~Ô5×:Ò:Ñ<Ô<Ñ=Ô=ˆIÝ˜Tœ^Ô8×=Ò=Ñ?Ô?Ñ@Ô@ˆGØˆ~Ýœ�ØŒ~Ô'ð OØ—’ÐGÑHÔHÐHÐHà—’Ð7¸#¿(º(À9Ñ:MÔ:MÑMÑNÔNÐNØ�LŠLÐ3°c·h²h¸wÑ6GÔ6GÑGÑHÔHÐHÐHÐHàBÐB¨w¯}ª}¸SÑ/AÔ/AÐBÑBÔBð <ð <�Ø×%Ò% cÑ*Ô*ð <Ø% a b bœk×/Ò/Ñ1Ô1�GØ”N×6Ò6°wÑ?Ô?Ð?Ð?à+/¬>×+HÒ+HÈÑ+QÔ+QÑ(�J ð ”J—O’O X¨zÐ$:Ñ;Ô;Ð;Ð;ð<ð <r   c                 óf   — | j         j        r$	 | j                              ¦   «          d S #  Y d S xY wd S r   )rµ   rH   r   r—   s    r   Úpre_run_cellzAutoreloadMagics.pre_run_cell±  sH   € ØŒ>Ô!ð 	ðØ”×$Ò$Ñ&Ô&Ð&Ð&Ð&øðØ��øøøð		ð 	s   Ž) ©.c                 ó  — t          t          j        ¦  «        | j        z
  }|D ]@}| j                             t          j        |         ¦  «        \  }}|�|| j        j        |<   ŒA| j                             |¦  «         dS )zFCache the modification times of any modules imported in this executionN)r¶   r,   r   r·   rµ   rD   r   r�   )r   Únewly_loaded_modulesrS   rÞ   rC   s        r   Úpost_execute_hookz"AutoreloadMagics.post_execute_hook¸  s   € å"¥3¤;Ñ/Ô/°$Ô2EÑEÐØ+ð 	Að 	AˆGØœ×:Ò:½3¼;ÀwÔ;OÑPÔP‰JˆAˆwØÐ"Ø9@�”Ô-¨gÑ6øàÔ×"Ò"Ð#7Ñ8Ô8Ð8Ð8Ð8r   )rÁ   )rÁ   N)r2   rU   rV   r    r   r   ÚargumentÚstrrÃ   rî   rð   ró   Ú__classcell__)rg   s   @r   r²   r²   ÿ  sM  ø€ € € € € ð/ð /ð /ð /ð /ð Ø$€_Ô$Ñ&Ô&Ø€_ÔØØØØððñ ô ð( €_ÔØØØØØ@ðñ ô ð €_ÔØØØØØ8ðñ ô ð\Hð \Hð \Hñô ñô ñ)ô ñ 'Ô&ñ „ZðH\Hð| ð$<ð $<ð $<ñ „Zð$<ðLð ð ð9ð 9ð 9ð 9ð 9ð 9ð 9r   r²   c                 óÎ   — t          | ¦  «        }|                      |¦  «         | j                             d|j        ¦  «         | j                             d|j        ¦  «         dS )zLoad the extension in IPython.rð   Úpost_executeN)r²   Úregister_magicsÚeventsÚregisterrð   ró   )ÚipÚauto_reloads     r   Úload_ipython_extensionrþ   Ã  s_   € å" 2Ñ&Ô&€KØ×Ò�{Ñ#Ô#Ð#Ø„I×Ò�~ {Ô'?Ñ@Ô@Ð@Ø„I×Ò�~ {Ô'DÑEÔEÐEÐEÐEr   )F)$rY   ÚIPython.corer   ÚIPython.core.magicr   r   r   Ú__skip_doctest__r7   r,   rP   r…   r¢   rh   rÒ   Ú	importlibr   r   Úimportlib.utilr	   r   r^   re   ro   rv   r{   r�   rŽ   Úextendrr   r’   rŸ   r¦   rM   r²   rþ   r   r   r   ú<module>r     s}  ððið iðV )Ð (Ð (Ð (Ð (Ð (Ø ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?Ð ?àÐ ð$ 
€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ø €€€Ø €€€Ø 	€	€	€	Ø €€€Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,ðK7ð K7ð K7ð K7ð K7ñ K7ô K7ð K7ðfð ð €
ðð ð ð	6ð 	6ð 	6ð'ð 'ð 'ðT'ð 'ð 'ð5ð 5ð 5ð
 *Ð)¨<Ð8Ø7Ð7¸ÐIØ-Ð-¨Ð?ð€ð
 × Ò ð =Ð<Ø@Ð@ð	
ðñô ð ðð ð ðð ð ð ð ñ ô ð ð	ð 	ð 	€	ðð ð ð ð$  &°4¸tð Cð Cð Cð CðV ð@9ð @9ð @9ð @9ð @9�vñ @9ô @9ñ „ð@9ðFFð Fð Fð Fð Fr   