#NEWLINE# @ contextlib . contextmanager #NEWLINE# def completion( completer = None ) : #NEWLINE# #INDENT# delims = '()[]{} ' #NEWLINE# if ( not completer ) : #NEWLINE# #INDENT# completer = Completer ( ) #NEWLINE# #UNINDENT# if docomplete : #NEWLINE# #INDENT# readline . set_completer ( completer . complete ) #NEWLINE# readline . set_completer_delims ( delims ) #NEWLINE# history = os . path . expanduser ( '~/.hy-history' ) #NEWLINE# readline . parse_and_bind ( 'set blink-matching-paren on' ) #NEWLINE# try : #NEWLINE# #INDENT# readline . read_history_file ( history ) #NEWLINE# #UNINDENT# except IOError : #NEWLINE# #INDENT# open ( history , 'a' ) . close ( ) #NEWLINE# #UNINDENT# readline . parse_and_bind ( readline_bind ) #NEWLINE# #UNINDENT# ( yield ) #NEWLINE# if docomplete : #NEWLINE# #INDENT# readline . write_history_file ( history )