<s> """<STR_LIT>""" <EOL> from __future__ import unicode_literals <EOL> from prompt_toolkit . keys import Keys <EOL> from prompt_toolkit . terminal . vt100_input import ANSI_SEQUENCES <EOL> __all__ = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ) <EOL> def pymux_key_to_prompt_toolkit_key_sequence ( key ) : <EOL> """<STR_LIT>""" <EOL> if key . lower ( ) . startswith ( '<STR_LIT>' ) : <EOL> key = '<STR_LIT>' + key [ <NUM_LIT:4> : ] <EOL> elif key . lower ( ) . startswith ( '<STR_LIT>' ) : <EOL> key = '<STR_LIT>' + key [ <NUM_LIT:2> : ] <EOL> elif key . lower ( ) . startswith ( '<STR_LIT>' ) : <EOL> key = '<STR_LIT>' + key [ <NUM_LIT:2> : ] <EOL> try : <EOL> return PYMUX_TO_PROMPT_TOOLKIT_KEYS [ key ] <EOL> except KeyError : <EOL> if len ( key ) == <NUM_LIT:1> : <EOL> return ( key , ) <EOL> else : <EOL> raise ValueError ( '<STR_LIT>' % ( key , ) ) <EOL> _PROMPT_TOOLKIT_KEY_TO_VT100 = dict ( <EOL> ( key , vt100_data ) for vt100_data , key in ANSI_SEQUENCES . items ( ) ) <EOL> def prompt_toolkit_key_to_vt100_key ( key , application_mode = False ) : <EOL> """<STR_LIT>""" <EOL> application_mode_keys = { <EOL> Keys . Up : '<STR_LIT>' , <EOL> Keys . Left : '<STR_LIT>' , <EOL> Keys . Right : '<STR_LIT>' , <EOL> Keys . Down : '<STR_LIT>' , <EOL> } <EOL> if key == '<STR_LIT:\n>' : <EOL> return '<STR_LIT:\r>' <EOL> elif application_mode and key in application_mode_keys : <EOL> return application_mode_keys . get ( key ) <EOL> else : <EOL> return _PROMPT_TOOLKIT_KEY_TO_VT100 . get ( key , key ) <EOL> PYMUX_TO_PROMPT_TOOLKIT_KEYS = { <EOL> '<STR_LIT>' : ( '<STR_LIT:U+0020>' ) , <EOL> '<STR_LIT>' : ( Keys . ControlA , ) , <EOL> '<STR_LIT>' : ( Keys . ControlB , ) , <EOL> '<STR_LIT>' : ( Keys . ControlC , ) , <EOL> '<STR_LIT>' : ( Keys . ControlD , ) , <EOL> '<STR_LIT>' : ( Keys . ControlE , ) , <EOL> '<STR_LIT>' : ( Keys . ControlF , ) , <EOL> '<STR_LIT>' : ( Keys . ControlG , ) , <EOL> '<STR_LIT>' : ( Keys . ControlH , ) , <EOL> '<STR_LIT>' : ( Keys . ControlI , ) , <EOL> '<STR_LIT>' : ( Keys . ControlJ , ) , <EOL> '<STR_LIT>' : ( Keys . ControlK , ) , <EOL> '<STR_LIT>' : ( Keys . ControlL , ) , <EOL> '<STR_LIT>' : ( Keys . ControlM , ) , <EOL> '<STR_LIT>' : ( Keys . ControlN , ) , <EOL> '<STR_LIT>' : ( Keys . ControlO , ) , <EOL> '<STR_LIT>' : ( Keys . ControlP , ) , <EOL> '<STR_LIT>' : ( Keys . ControlQ , ) , <EOL> '<STR_LIT>' : ( Keys . ControlR , ) , <EOL> '<STR_LIT>' : ( Keys . ControlS , ) , <EOL> '<STR_LIT>' : ( Keys . ControlT , ) , <EOL> '<STR_LIT>' : ( Keys . ControlU , ) , <EOL> '<STR_LIT>' : ( Keys . ControlV , ) , <EOL> '<STR_LIT>' : ( Keys . ControlW , ) , <EOL> '<STR_LIT>' : ( Keys . ControlX , ) , <EOL> '<STR_LIT>' : ( Keys . ControlY , ) , <EOL> '<STR_LIT>' : ( Keys . ControlZ , ) , <EOL> '<STR_LIT>' : ( Keys . ControlLeft , ) , <EOL> '<STR_LIT>' : ( Keys . ControlRight , ) , <EOL> '<STR_LIT>' : ( Keys . ControlUp , ) , <EOL> '<STR_LIT>' : ( Keys . ControlDown , ) , <EOL> '<STR_LIT>' : ( Keys . ControlBackslash , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlA , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlB , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlC , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlD , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlE , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlF , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlG , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlH , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlI , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlJ , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlK , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlL , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlM , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlN , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlO , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlP , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlQ , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlR , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlS , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlT , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlU , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlV , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlW , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlX , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlY , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlZ , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlLeft , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlRight , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlUp , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlDown , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . ControlBackslash , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:a>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:b>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:c>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:d>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:e>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:f>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:g>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:h>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:i>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:k>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:l>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:m>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:n>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:o>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:p>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:q>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:r>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:s>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:t>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:u>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:v>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:w>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:x>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:y>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:z>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:0>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:1>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:2>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:3>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:4>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT:5>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . Up ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . Down , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . Left , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , Keys . Right , ) , <EOL> '<STR_LIT>' : ( Keys . Left , ) , <EOL> '<STR_LIT>' : ( Keys . Right , ) , <EOL> '<STR_LIT>' : ( Keys . Up , ) , <EOL> '<STR_LIT>' : ( Keys . Down , ) , <EOL> '<STR_LIT>' : ( Keys . Backspace , ) , <EOL> '<STR_LIT>' : ( Keys . BackTab , ) , <EOL> '<STR_LIT>' : ( Keys . Delete , ) , <EOL> '<STR_LIT>' : ( Keys . Insert , ) , <EOL> '<STR_LIT>' : ( Keys . End , ) , <EOL> '<STR_LIT>' : ( Keys . ControlJ , ) , <EOL> '<STR_LIT>' : ( Keys . Home , ) , <EOL> '<STR_LIT>' : ( Keys . Escape , ) , <EOL> '<STR_LIT>' : ( Keys . Tab , ) , <EOL> '<STR_LIT>' : ( Keys . F1 , ) , <EOL> '<STR_LIT>' : ( Keys . F2 , ) , <EOL> '<STR_LIT>' : ( Keys . F3 , ) , <EOL> '<STR_LIT>' : ( Keys . F4 , ) , <EOL> '<STR_LIT>' : ( Keys . F5 , ) , <EOL> '<STR_LIT>' : ( Keys . F6 , ) , <EOL> '<STR_LIT>' : ( Keys . F7 , ) , <EOL> '<STR_LIT>' : ( Keys . F8 , ) , <EOL> '<STR_LIT>' : ( Keys . F9 , ) , <EOL> '<STR_LIT>' : ( Keys . F10 , ) , <EOL> '<STR_LIT>' : ( Keys . F11 , ) , <EOL> '<STR_LIT>' : ( Keys . F12 , ) , <EOL> '<STR_LIT>' : ( Keys . F13 , ) , <EOL> '<STR_LIT>' : ( Keys . F14 , ) , <EOL> '<STR_LIT>' : ( Keys . F15 , ) , <EOL> '<STR_LIT>' : ( Keys . F16 , ) , <EOL> '<STR_LIT>' : ( Keys . F17 , ) , <EOL> '<STR_LIT>' : ( Keys . F18 , ) , <EOL> '<STR_LIT>' : ( Keys . F19 , ) , <EOL> '<STR_LIT>' : ( Keys . F20 , ) , <EOL> '<STR_LIT>' : ( Keys . PageDown , ) , <EOL> '<STR_LIT>' : ( Keys . PageDown , ) , <EOL> '<STR_LIT>' : ( Keys . PageDown , ) , <EOL> '<STR_LIT>' : ( Keys . PageUp , ) , <EOL> '<STR_LIT>' : ( Keys . PageUp , ) , <EOL> '<STR_LIT>' : ( Keys . PageUp , ) , <EOL> } </s>
