<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import , division , print_function , with_statement , unicode_literals <EOL> import logging <EOL> from . import util , exc <EOL> logger = logging . getLogger ( __name__ ) <EOL> class Pane ( util . TmuxMappingObject , util . TmuxRelationalObject ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , window = None , ** kwargs ) : <EOL> if not window : <EOL> raise ValueError ( '<STR_LIT>' ) <EOL> self . window = window <EOL> self . session = self . window . session <EOL> self . server = self . session . server <EOL> self . _pane_id = kwargs [ '<STR_LIT>' ] <EOL> self . server . _update_panes ( ) <EOL> @ property <EOL> def _TMUX ( self , * args ) : <EOL> attrs = { <EOL> '<STR_LIT>' : self . _pane_id <EOL> } <EOL> def by ( val , * args ) : <EOL> for key , value in attrs . items ( ) : <EOL> try : <EOL> if attrs [ key ] != val [ key ] : <EOL> return False <EOL> except KeyError : <EOL> return False <EOL> return True <EOL> return list ( filter ( by , self . server . _panes ) ) [ <NUM_LIT:0> ] <EOL> def cmd ( self , cmd , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if not any ( arg . startswith ( '<STR_LIT>' ) for arg in args ) : <EOL> args = ( '<STR_LIT>' , self . get ( '<STR_LIT>' ) ) + args <EOL> return self . server . cmd ( cmd , * args , ** kwargs ) <EOL> def send_keys ( self , cmd , enter = True ) : <EOL> """<STR_LIT>""" <EOL> self . cmd ( '<STR_LIT>' , '<STR_LIT:U+0020>' + cmd ) <EOL> if enter : <EOL> self . enter ( ) <EOL> def clear ( self ) : <EOL> """<STR_LIT>""" <EOL> self . send_keys ( '<STR_LIT>' ) <EOL> def reset ( self ) : <EOL> """<STR_LIT>""" <EOL> self . cmd ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def split_window ( self , attach = False ) : <EOL> """<STR_LIT>""" <EOL> return self . window . split_window ( <EOL> target = self . get ( '<STR_LIT>' ) , <EOL> attach = attach <EOL> ) <EOL> def set_width ( self , width ) : <EOL> """<STR_LIT>""" <EOL> self . resize_pane ( width = width ) <EOL> def set_height ( self , height ) : <EOL> """<STR_LIT>""" <EOL> self . resize_pane ( height = height ) <EOL> def resize_pane ( self , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> if '<STR_LIT>' in kwargs : <EOL> proc = self . cmd ( '<STR_LIT>' , '<STR_LIT>' % int ( kwargs [ '<STR_LIT>' ] ) ) <EOL> elif '<STR_LIT:width>' in kwargs : <EOL> proc = self . cmd ( '<STR_LIT>' , '<STR_LIT>' % int ( kwargs [ '<STR_LIT:width>' ] ) ) <EOL> else : <EOL> proc = self . cmd ( '<STR_LIT>' , args [ <NUM_LIT:0> ] ) <EOL> if proc . stderr : <EOL> raise exc . TmuxpException ( proc . stderr ) <EOL> self . server . _update_panes ( ) <EOL> return self <EOL> def enter ( self ) : <EOL> """<STR_LIT>""" <EOL> self . cmd ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> def select_pane ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . window . select_pane ( self . get ( '<STR_LIT>' ) ) <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" % ( <EOL> self . __class__ . __name__ , <EOL> self . get ( '<STR_LIT>' ) , <EOL> self . window <EOL> ) </s>
