X Tutup
Skip to content

Commit aa79d3f

Browse files
committed
Fix some warnings, allow easier checking with pychecker.
committer: Bob Farrell <bob@keys.(none)>
1 parent 79d2c11 commit aa79d3f

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.pyc

.pycheckrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
blacklist = ['pyparsing', 'code', 'pygments/lexer']

bpython.py

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,9 @@
2929
import sys
3030
import curses
3131
import code
32-
import codeop
3332
import traceback
3433
import re
3534
import time
36-
import math
3735
import urllib
3836
import rlcompleter
3937
import inspect
@@ -61,6 +59,8 @@ class Dummy( object ):
6159
alphas, alphanums, printables, ParseException
6260
OPTS.arg_spec = True
6361

62+
DO_RESIZE = False
63+
6464
# TODO:
6565
#
6666
# C-l doesn't repaint the screen yet.
@@ -200,6 +200,7 @@ def __init__( self, scr, interp, statusbar=None, idle=None):
200200
self.tablen = None
201201
self.s = ''
202202
self.list_win_visible = False
203+
self._C = {}
203204

204205
if not OPTS.arg_spec:
205206
return
@@ -1487,23 +1488,24 @@ def main( scr ):
14871488
repl.repl()
14881489
return repl.getstdout()
14891490

1490-
tb = None
1491-
try:
1492-
o = curses.wrapper( main )
1493-
except:
1494-
tb = traceback.format_exc()
1495-
# I don't know why this is necessary; without it the wrapper doesn't always
1496-
# do its job.
1497-
if stdscr is not None:
1498-
stdscr.keypad(0)
1499-
curses.echo()
1500-
curses.nocbreak()
1501-
curses.endwin()
1502-
1503-
sys.stdout = sys.__stdout__
1504-
if tb:
1505-
print tb
1506-
sys.exit(1)
1507-
1508-
sys.stdout.write( o ) # Fake stdout data so everything's still visible after exiting
1509-
sys.stdout.flush()
1491+
if __name__ == '__main__':
1492+
tb = None
1493+
try:
1494+
o = curses.wrapper( main )
1495+
except:
1496+
tb = traceback.format_exc()
1497+
# I don't know why this is necessary; without it the wrapper doesn't always
1498+
# do its job.
1499+
if stdscr is not None:
1500+
stdscr.keypad(0)
1501+
curses.echo()
1502+
curses.nocbreak()
1503+
curses.endwin()
1504+
1505+
sys.stdout = sys.__stdout__
1506+
if tb:
1507+
print tb
1508+
sys.exit(1)
1509+
1510+
sys.stdout.write( o ) # Fake stdout data so everything's still visible after exiting
1511+
sys.stdout.flush()

0 commit comments

Comments
 (0)
X Tutup