<s> """<STR_LIT>""" <EOL> import glob , os , shlex , sys <EOL> import inspect <EOL> from time import time <EOL> from zipimport import zipimporter <EOL> from IPython . core import ipapi <EOL> from IPython . core . error import TryNext <EOL> ip = ipapi . get ( ) <EOL> def vcs_completer ( commands , event ) : <EOL> """<STR_LIT>""" <EOL> cmd_param = event . line . split ( ) <EOL> if event . line . endswith ( '<STR_LIT:U+0020>' ) : <EOL> cmd_param . append ( '<STR_LIT>' ) <EOL> if cmd_param [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> cmd_param = cmd_param [ <NUM_LIT:1> : ] <EOL> if len ( cmd_param ) == <NUM_LIT:2> or '<STR_LIT>' in cmd_param : <EOL> return commands . split ( ) <EOL> return ip . Completer . file_matches ( event . symbol ) <EOL> svn_commands = """<STR_LIT>""" <EOL> def svn_completer ( self , event ) : <EOL> return vcs_completer ( svn_commands , event ) <EOL> hg_commands = """<STR_LIT>""" <EOL> def hg_completer ( self , event ) : <EOL> """<STR_LIT>""" <EOL> return vcs_completer ( hg_commands , event ) <EOL> __bzr_commands = None <EOL> def bzr_commands ( ) : <EOL> global __bzr_commands <EOL> if __bzr_commands is not None : <EOL> return __bzr_commands <EOL> out = os . popen ( '<STR_LIT>' ) <EOL> __bzr_commands = [ l . split ( ) [ <NUM_LIT:0> ] for l in out ] <EOL> return __bzr_commands <EOL> def bzr_completer ( self , event ) : <EOL> """<STR_LIT>""" <EOL> cmd_param = event . line . split ( ) <EOL> if event . line . endswith ( '<STR_LIT:U+0020>' ) : <EOL> cmd_param . append ( '<STR_LIT>' ) <EOL> if len ( cmd_param ) > <NUM_LIT:2> : <EOL> cmd = cmd_param [ <NUM_LIT:1> ] <EOL> param = cmd_param [ - <NUM_LIT:1> ] <EOL> output_file = ( param == '<STR_LIT>' ) <EOL> if cmd == '<STR_LIT>' : <EOL> return bzr_commands ( ) <EOL> elif cmd in [ '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:version>' , <EOL> '<STR_LIT>' ] and not output_file : <EOL> return [ ] <EOL> else : <EOL> return ip . Completer . file_matches ( event . symbol ) <EOL> return bzr_commands ( ) <EOL> def apt_get_packages ( prefix ) : <EOL> out = os . popen ( '<STR_LIT>' ) <EOL> for p in out : <EOL> if p . startswith ( prefix ) : <EOL> yield p . rstrip ( ) <EOL> apt_commands = """<STR_LIT>""" <EOL> def apt_completer ( self , event ) : <EOL> """<STR_LIT>""" <EOL> cmd_param = event . line . split ( ) <EOL> if event . line . endswith ( '<STR_LIT:U+0020>' ) : <EOL> cmd_param . append ( '<STR_LIT>' ) <EOL> if cmd_param [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> cmd_param = cmd_param [ <NUM_LIT:1> : ] <EOL> if len ( cmd_param ) == <NUM_LIT:2> or '<STR_LIT>' in cmd_param : <EOL> return apt_commands . split ( ) <EOL> return list ( apt_get_packages ( event . symbol ) ) </s>
