<s> from rl import readline <EOL> from threading import Thread , Timer <EOL> from sys import stdout <EOL> from struct import unpack <EOL> from fcntl import ioctl <EOL> from termios import TIOCGWINSZ <EOL> prompt = '<STR_LIT>' <EOL> def clear_readline ( ) : <EOL> _ , cols = unpack ( '<STR_LIT>' , ioctl ( stdout , TIOCGWINSZ , '<STR_LIT>' ) ) <EOL> length = len ( readline . get_line_buffer ( ) ) + len ( prompt ) <EOL> lines = length / cols <EOL> stdout . write ( '<STR_LIT>' ) <EOL> stdout . write ( '<STR_LIT>' * lines ) <EOL> stdout . write ( '<STR_LIT>' ) <EOL> def interrupt ( ) : <EOL> clear_readline ( ) <EOL> print ( '<STR_LIT>' ) <EOL> readline . redisplay ( True ) <EOL> Timer ( <NUM_LIT:2> , interrupt ) . start ( ) <EOL> def cli ( ) : <EOL> while True : <EOL> raw_input ( prompt ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> Thread ( target = cli ) . start ( ) <EOL> Timer ( <NUM_LIT:2> , interrupt ) . start ( ) </s>
