U
    ýÇ-eÆ  ã                   @   s6   d Z ddlZddlmZ e d¡ZG dd„ deƒZdS )z)Support for interactive macros in IPythoné    N)ÚDEFAULT_ENCODINGz#\s*coding[:=]\s*([-\w.]+)c                   @   s8   e Zd ZdZdd„ Zdd„ Zdd„ Zdd	„ Zd
d„ ZdS )ÚMacroz‘Simple class to store the value of macros as strings.

    Macro is just a callable that executes a string of IPython
    input when called.
    c                 C   sj   g }d}|  ¡ D ](}t |¡}|r.| d¡}q| |¡ qd |¡}t|tƒr\| |pXt	¡}|d | _
dS )z?store the macro value, as a single string which can be executedNé   Ú
)Ú
splitlinesÚcoding_declarationÚmatchÚgroupÚappendÚjoinÚ
isinstanceÚbytesÚdecoder   Úvalue)ÚselfÚcodeÚlinesÚencÚlineZcoding_match© r   úS/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/IPython/core/macro.pyÚ__init__   s    


zMacro.__init__c                 C   s   | j S ©N©r   ©r   r   r   r   Ú__str__&   s    zMacro.__str__c                 C   s   dt | jƒ S )NzIPython.macro.Macro(%s))Úreprr   r   r   r   r   Ú__repr__)   s    zMacro.__repr__c                 C   s
   d| j iS )z% needed for safe pickling via %store r   r   r   r   r   r   Ú__getstate__,   s    zMacro.__getstate__c                 C   s:   t |tƒrt| j|j ƒS t |tƒr2t| j| ƒS t‚d S r   )r   r   r   ÚstrÚ	TypeError)r   Úotherr   r   r   Ú__add__0   s
    

zMacro.__add__N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r"   r   r   r   r   r      s   r   )r&   ÚreZIPython.utils.encodingr   Úcompiler   Úobjectr   r   r   r   r   Ú<module>   s   	
