U
    ýÇ-eù  ã                   @   sÜ   d Z ddlZddlmZ edœdd„Zedœdd„Zedœd	d
„Zedœdd„Zedœdd„Zedœdd„Z	edœdd„Z
edœdd„Zedœdd„Zedœdd„Zedœdd„Zedœdd„ZeeedœZeeedœZdS )z¹
Utilities function for keybinding with prompt toolkit.

This will be bound to specific key press and filter modes,
like whether we are in edit mode, and whether the completer is open.
é    N)ÚKeyPressEvent©Úeventc                 C   s   | j  d¡ | j  ¡  dS )zAuto-close parenthesisú()N©Úcurrent_bufferÚinsert_textÚcursor_leftr   © r
   úf/var/www/html/Darija-Ai-Train/env/lib/python3.8/site-packages/IPython/terminal/shortcuts/auto_match.pyÚparenthesis   s    r   c                 C   s   | j  d¡ | j  ¡  dS )zAuto-close bracketsú[]Nr   r   r
   r
   r   Úbrackets   s    r   c                 C   s   | j  d¡ | j  ¡  dS )zAuto-close bracesú{}Nr   r   r
   r
   r   Úbraces   s    r   c                 C   s   | j  d¡ | j  ¡  dS )zAuto-close double quotesz""Nr   r   r
   r
   r   Údouble_quote   s    r   c                 C   s   | j  d¡ | j  ¡  dS )zAuto-close single quotesz''Nr   r   r
   r
   r   Úsingle_quote#   s    r   c                 C   s   | j  d¡ | j  d¡ dS )z$Auto-close docstring (double quotes)z""""é   Nr   r   r
   r
   r   Údocstring_double_quotes)   s    r   c                 C   s   | j  d¡ | j  d¡ dS )z$Auto-close docstring (single quotes)z''''r   Nr   r   r
   r
   r   Údocstring_single_quotes/   s    r   c                 C   sL   t  d| jjj¡}|r | d¡nd}| j d| ¡ | j t|ƒd ¡ dS )z%Auto-close parenthesis in raw stringsú.*(r|R)[\"'](-*)é   Ú r   é   N©	ÚreÚmatchr   ZdocumentZcurrent_line_before_cursorÚgroupr   r	   Úlen©r   ÚmatchesÚdashesr
   r
   r   Úraw_string_parenthesis5   s    þr"   c                 C   sL   t  d| jjj¡}|r | d¡nd}| j d| ¡ | j t|ƒd ¡ dS )z!Auto-close bracker in raw stringsr   r   r   r   r   Nr   r   r
   r
   r   Úraw_string_bracket@   s    þr#   c                 C   sL   t  d| jjj¡}|r | d¡nd}| j d| ¡ | j t|ƒd ¡ dS )z Auto-close braces in raw stringsr   r   r   r   r   Nr   r   r
   r
   r   Úraw_string_bracesK   s    þr$   c                 C   s   | j  ¡  dS )zdSkip over automatically added parenthesis/quote.

    (rather than adding another parenthesis/quote)N)r   Zcursor_rightr   r
   r
   r   Ú	skip_overV   s    r%   c                 C   s   | j  ¡  | j  ¡  dS )zDelete auto-closed parenthesisN)r   ÚdeleteZdelete_before_cursorr   r
   r
   r   Údelete_pair]   s    
r'   )ú(ú[Ú{)Ú__doc__r   Zprompt_toolkit.key_bindingr   r   r   r   r   r   r   r   r"   r#   r$   r%   r'   Zauto_match_parensZauto_match_parens_raw_stringr
   r
   r
   r   Ú<module>   s&   ý