diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/.pycheckrc b/.pycheckrc new file mode 100644 index 0000000..e7050fa --- /dev/null +++ b/.pycheckrc @@ -0,0 +1 @@ +blacklist = ['pyparsing', 'code', 'pygments/lexer'] diff --git a/bpython.py b/bpython.py index 0a6526d..c44deae 100644 --- a/bpython.py +++ b/bpython.py @@ -29,11 +29,9 @@ import os import sys import curses import code -import codeop import traceback import re import time -import math import urllib import rlcompleter import inspect @@ -61,6 +59,8 @@ from pyparsing import Forward, Suppress, QuotedString, dblQuotedString, \ alphas, alphanums, printables, ParseException OPTS.arg_spec = True +DO_RESIZE = False + # TODO: # # C-l doesn't repaint the screen yet. @@ -200,6 +200,7 @@ class Repl( object ): self.tablen = None self.s = '' self.list_win_visible = False + self._C = {} if not OPTS.arg_spec: return @@ -1487,23 +1488,24 @@ def main( scr ): repl.repl() return repl.getstdout() -tb = None -try: - o = curses.wrapper( main ) -except: - tb = traceback.format_exc() -# I don't know why this is necessary; without it the wrapper doesn't always -# do its job. - if stdscr is not None: - stdscr.keypad(0) - curses.echo() - curses.nocbreak() - curses.endwin() +if __name__ == '__main__': + tb = None + try: + o = curses.wrapper( main ) + except: + tb = traceback.format_exc() + # I don't know why this is necessary; without it the wrapper doesn't always + # do its job. + if stdscr is not None: + stdscr.keypad(0) + curses.echo() + curses.nocbreak() + curses.endwin() -sys.stdout = sys.__stdout__ -if tb: - print tb - sys.exit(1) + sys.stdout = sys.__stdout__ + if tb: + print tb + sys.exit(1) -sys.stdout.write( o ) # Fake stdout data so everything's still visible after exiting -sys.stdout.flush() + sys.stdout.write( o ) # Fake stdout data so everything's still visible after exiting + sys.stdout.flush()