
    Mh                         d Z ddlZddlmZ defdZdefdZdefdZdefdZdefd	Zdefd
Z	defdZ
defdZdefdZdefdZdefdZdef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                 l    | j                             d           | j                                          dS )zAuto-close parenthesis()Ncurrent_bufferinsert_textcursor_leftr   s    e/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/IPython/terminal/shortcuts/auto_match.pyparenthesisr      4    	$$T***	$$&&&&&    c                 l    | j                             d           | j                                          dS )zAuto-close brackets[]Nr   r   s    r   bracketsr      r   r   c                 l    | j                             d           | j                                          dS )zAuto-close braces{}Nr   r   s    r   bracesr      r   r   c                 l    | j                             d           | j                                          dS )zAuto-close double quotesz""Nr   r   s    r   double_quoter      r   r   c                 l    | j                             d           | j                                          dS )zAuto-close single quotesz''Nr   r   s    r   single_quoter   $   r   r   c                 n    | j                             d           | j                             d           dS )z$Auto-close docstring (double quotes)z""""   Nr   r   s    r   docstring_double_quotesr   *   6    	$$V,,,	$$Q'''''r   c                 n    | j                             d           | j                             d           dS )z$Auto-close docstring (single quotes)z''''r   Nr   r   s    r   docstring_single_quotesr   0   r   r   c                    t          j        d| j        j        j                  }|r|                    d          nd}| j                            d|z              | j                            t          |          dz              dS )z%Auto-close parenthesis in raw strings.*(r|R)[\"'](-*)    r      N	rematchr   documentcurrent_line_before_cursorgroupr	   r
   lenr   matchesdashess      r   raw_string_parenthesisr/   6       h%@ G ")0W]]1bF	$$TF]333	$$S[[1_55555r   c                    t          j        d| j        j        j                  }|r|                    d          nd}| j                            d|z              | j                            t          |          dz              dS )z!Auto-close bracker in raw stringsr!   r"   r#   r   r$   Nr%   r,   s      r   raw_string_bracketr2   A   r0   r   c                    t          j        d| j        j        j                  }|r|                    d          nd}| j                            d|z              | j                            t          |          dz              dS )z Auto-close braces in raw stringsr!   r"   r#   r   r$   Nr%   r,   s      r   raw_string_bracesr4   L   r0   r   c                 8    | j                                          dS )zdSkip over automatically added parenthesis/quote.

    (rather than adding another parenthesis/quote)N)r   cursor_rightr   s    r   	skip_overr7   W   s     
%%'''''r   c                 j    | j                                          | j                                          dS )zDelete auto-closed parenthesisN)r   deletedelete_before_cursorr   s    r   delete_pairr;   ^   s2    	!!!	--/////r   )([{)__doc__r&   prompt_toolkit.key_bindingr   r   r   r   r   r   r   r   r/   r2   r4   r7   r;   auto_match_parensauto_match_parens_raw_string r   r   <module>rD      s    
			 4 4 4 4 4 4'} ' ' ' ''M ' ' ' ''- ' ' ' '' ' ' ' '' ' ' ' '(= ( ( ( ((= ( ( ( (6- 6 6 6 66m 6 6 6 66] 6 6 6 6(] ( ( ( (0} 0 0 0 0 &H6BB 			      r   