<s> """<STR_LIT>""" <EOL> from __future__ import absolute_import <EOL> import __main__ <EOL> from collections import namedtuple <EOL> import re <EOL> import os <EOL> import sys <EOL> from jedi import Interpreter <EOL> from jedi . api . helpers import completion_parts <EOL> from jedi . parser . user_context import UserContext <EOL> def setup_readline ( namespace_module = __main__ ) : <EOL> """<STR_LIT>""" <EOL> class JediRL ( object ) : <EOL> def complete ( self , text , state ) : <EOL> """<STR_LIT>""" <EOL> if state == <NUM_LIT:0> : <EOL> sys . path . insert ( <NUM_LIT:0> , os . getcwd ( ) ) <EOL> try : <EOL> interpreter = Interpreter ( text , [ namespace_module . __dict__ ] ) <EOL> path = UserContext ( text , ( <NUM_LIT:1> , len ( text ) ) ) . get_path_until_cursor ( ) <EOL> path , dot , like = completion_parts ( path ) <EOL> before = text [ : len ( text ) - len ( like ) ] <EOL> completions = interpreter . completions ( ) <EOL> finally : <EOL> sys . path . pop ( <NUM_LIT:0> ) <EOL> self . matches = [ before + c . name_with_symbols for c in completions ] <EOL> try : <EOL> return self . matches [ state ] <EOL> except IndexError : <EOL> return None <EOL> try : <EOL> import readline <EOL> except ImportError : <EOL> print ( "<STR_LIT>" ) <EOL> else : <EOL> readline . set_completer ( JediRL ( ) . complete ) <EOL> readline . parse_and_bind ( "<STR_LIT>" ) <EOL> readline . parse_and_bind ( "<STR_LIT>" ) <EOL> readline . parse_and_bind ( "<STR_LIT>" ) <EOL> readline . parse_and_bind ( "<STR_LIT>" ) <EOL> readline . parse_and_bind ( "<STR_LIT>" ) <EOL> readline . set_completer_delims ( '<STR_LIT>' ) <EOL> def version_info ( ) : <EOL> """<STR_LIT>""" <EOL> Version = namedtuple ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> from jedi import __version__ <EOL> tupl = re . findall ( '<STR_LIT>' , __version__ ) <EOL> return Version ( * [ x if i == <NUM_LIT:3> else int ( x ) for i , x in enumerate ( tupl ) ] ) </s>
