Format: application/x-python-code
⬇ Download File (2.8 KB)
   1  o
   2  
   3  ��h��@s�dZddlZddlmZdefdd�Zdefdd�Zdefd	d
   4  �Zdefdd�Zdefd
   5  d�Zdefdd�Z	defdd�Z
   6  defdd�Zdefdd�Zdefdd�Z
   7  defdd�Zdefdd�Zeeed�Zeee
   8  d�ZdS)z�
   9  Utilities function for keybinding with prompt toolkit.
  10  
  11  This will be bound to specific key press and filter modes,
  12  like whether we are in edit mode, and whether the completer is open.
  13  �N)�
  14  KeyPressEvent�eventcC�|j�d�|j��dS)zAuto-close parenthesis�()N��current_buffer�insert_text�cursor_left�r�r�[c:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/terminal/shortcuts/auto_match.py�parenthesis�r
  15  cCr)zAuto-close brackets�[]Nrr
  16  rrr�bracketsrrcCr)zAuto-close braces�{}Nrr
  17  rrr�bracesrrcCr)zAuto-close double quotesz""Nrr
  18  rrr�double_quoterrcCr)zAuto-close single quotesz''Nrr
  19  rrr�single_quote$rrcC�|j�d�|j�d�dS)z$Auto-close docstring (double quotes)z""""�Nrr
  20  rrr�docstring_double_quotes*�rcCr)z$Auto-close docstring (single quotes)z''''rNrr
  21  rrr�docstring_single_quotes0rrcC�Lt�d|jjj�}|r|�d�nd}|j�d|�|j�t|�d�dS)z%Auto-close parenthesis in raw strings�.*(r|R)[\"'](-*)��r�N�	�re�matchrZdocumentZcurrent_line_before_cursor�grouprr	�len�r�matches�dashesrrr�raw_string_parenthesis6��r'cCr)z!Auto-close bracker in raw stringsrrrrrNrr$rrr�raw_string_bracketAr(r)cCr)z Auto-close braces in raw stringsrrrrrNrr$rrr�raw_string_bracesLr(r*cCs|j��dS)zdSkip over automatically added parenthesis/quote.
  22  
  23      (rather than adding another parenthesis/quote)N)rZcursor_rightr
  24  rrr�	skip_overWsr+cCs|j��|j��dS)zDelete auto-closed parenthesisN)r�deleteZdelete_before_cursorr
  25  rrr�delete_pair^s
  26  r-)�(�[�{)�__doc__r Zprompt_toolkit.key_bindingrr
  27  rrrrrrr'r)r*r+r-Zauto_match_parensZauto_match_parens_raw_stringrrrr�<module>s(
  28  �