<s> from __future__ import ( unicode_literals , division , absolute_import , print_function ) <EOL> from powerline . renderers . shell import ShellRenderer <EOL> from powerline . renderers . shell . readline import ReadlineRenderer <EOL> from powerline . theme import Theme <EOL> class IPythonRenderer ( ShellRenderer ) : <EOL> '''<STR_LIT>''' <EOL> def get_segment_info ( self , segment_info , mode ) : <EOL> r = self . segment_info . copy ( ) <EOL> r [ '<STR_LIT>' ] = segment_info <EOL> return r <EOL> def get_theme ( self , matcher_info ) : <EOL> if matcher_info == '<STR_LIT>' : <EOL> return self . theme <EOL> else : <EOL> match = self . local_themes [ matcher_info ] <EOL> try : <EOL> return match [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> match [ '<STR_LIT>' ] = Theme ( <EOL> theme_config = match [ '<STR_LIT>' ] , <EOL> main_theme_config = self . theme_config , <EOL> ** self . theme_kwargs <EOL> ) <EOL> return match [ '<STR_LIT>' ] <EOL> def shutdown ( self ) : <EOL> self . theme . shutdown ( ) <EOL> for match in self . local_themes . values ( ) : <EOL> if '<STR_LIT>' in match : <EOL> match [ '<STR_LIT>' ] . shutdown ( ) <EOL> def render ( self , ** kwargs ) : <EOL> return super ( ShellRenderer , self ) . render ( ** kwargs ) <EOL> def do_render ( self , segment_info , ** kwargs ) : <EOL> segment_info . update ( client_id = '<STR_LIT>' ) <EOL> return super ( IPythonRenderer , self ) . do_render ( <EOL> segment_info = segment_info , <EOL> ** kwargs <EOL> ) <EOL> class IPythonPromptRenderer ( IPythonRenderer , ReadlineRenderer ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> class IPythonNonPromptRenderer ( IPythonRenderer ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> class RendererProxy ( object ) : <EOL> '''<STR_LIT>''' <EOL> def __init__ ( self , ** kwargs ) : <EOL> old_widths = { } <EOL> self . non_prompt_renderer = IPythonNonPromptRenderer ( old_widths = old_widths , ** kwargs ) <EOL> self . prompt_renderer = IPythonPromptRenderer ( old_widths = old_widths , ** kwargs ) <EOL> def render_above_lines ( self , * args , ** kwargs ) : <EOL> return self . non_prompt_renderer . render_above_lines ( * args , ** kwargs ) <EOL> def render ( self , is_prompt , * args , ** kwargs ) : <EOL> return ( self . prompt_renderer if is_prompt else self . non_prompt_renderer ) . render ( <EOL> * args , ** kwargs ) <EOL> def shutdown ( self , * args , ** kwargs ) : <EOL> self . prompt_renderer . shutdown ( * args , ** kwargs ) <EOL> self . non_prompt_renderer . shutdown ( * args , ** kwargs ) <EOL> renderer = RendererProxy </s>
