X Tutup
Skip to content

Commit 3cc42cb

Browse files
committed
PEP-8 conformance
1 parent 24e478c commit 3cc42cb

File tree

1 file changed

+30
-18
lines changed

1 file changed

+30
-18
lines changed

bpython/cli.py

Lines changed: 30 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -200,35 +200,38 @@ def DEBUG(s):
200200
def get_color(name):
201201
return colors[OPTS.color_scheme[name].lower()]
202202

203+
203204
def get_colpair(name):
204205
return curses.color_pair(get_color(name) + 1)
205206

207+
206208
def make_colors():
207209
"""Init all the colours in curses and bang them into a dictionary"""
208210

209211
# blacK, Red, Green, Yellow, Blue, Magenta, Cyan, White, Default:
210212
c = {
211-
'k' : 0,
212-
'r' : 1,
213-
'g' : 2,
214-
'y' : 3,
215-
'b' : 4,
216-
'm' : 5,
217-
'c' : 6,
218-
'w' : 7,
219-
'd' : -1,
213+
'k': 0,
214+
'r': 1,
215+
'g': 2,
216+
'y': 3,
217+
'b': 4,
218+
'm': 5,
219+
'c': 6,
220+
'w': 7,
221+
'd': -1,
220222
}
221223
for i in range(63):
222224
if i > 7:
223225
j = i // 8
224226
else:
225227
j = c[OPTS.color_scheme['background']]
226-
curses.init_pair(i+1, i % 8, j)
228+
curses.init_pair(i + 1, i % 8, j)
227229

228230
return c
229231

230232

231233
class CLIRepl(Repl):
234+
232235
def __init__(self, scr, interp, statusbar=None, idle=None):
233236
Repl.__init__(self, interp, idle)
234237
interp.writetb = self.writetb
@@ -357,7 +360,8 @@ def complete(self, tab=False):
357360
self.show_list(self.matches, self.argspec)
358361
except curses.error:
359362
# XXX: This is a massive hack, it will go away when I get
360-
# cusswords into a good enough state that we can start using it.
363+
# cusswords into a good enough state that we can start
364+
# using it.
361365
self.list_win.border()
362366
self.list_win.refresh()
363367
self.list_win_visible = False
@@ -464,8 +468,8 @@ def end(self, refresh=True):
464468
self.scr.move(y, x)
465469
if refresh:
466470
self.scr.refresh()
467-
return True
468471

472+
return True
469473

470474
def fwd(self):
471475
"""Same as back() but, well, forward"""
@@ -718,11 +722,13 @@ def p_key(self, key):
718722
self.undo()
719723
return ''
720724

721-
elif key in ('KEY_UP', ) + key_dispatch[OPTS.up_one_line_key]: # Cursor Up/C-p
725+
elif key in ('KEY_UP', ) + key_dispatch[OPTS.up_one_line_key]:
726+
# Cursor Up/C-p
722727
self.back()
723728
return ''
724729

725-
elif key in ('KEY_DOWN', ) + key_dispatch[OPTS.down_one_line_key]: # Cursor Down/C-n
730+
elif key in ('KEY_DOWN', ) + key_dispatch[OPTS.down_one_line_key]:
731+
# Cursor Down/C-n
726732
self.fwd()
727733
return ''
728734

@@ -1086,7 +1092,8 @@ def lsize():
10861092
self.list_win.addstr('\n ')
10871093

10881094
if self.docstring is not None:
1089-
self.list_win.addstr('\n' + docstring_string, get_colpair('comment'))
1095+
self.list_win.addstr('\n' + docstring_string,
1096+
get_colpair('comment'))
10901097
# XXX: After all the trouble I had with sizing the list box (I'm not very good
10911098
# at that type of thing) I decided to do this bit of tidying up here just to
10921099
# make sure there's no unnececessary blank lines, it makes things look nicer.
@@ -1352,9 +1359,9 @@ def init_wins(scr, cols):
13521359
# problems that needed dirty hackery to fix. :)
13531360

13541361
# TODO:
1355-
#
1362+
#
13561363
# This should show to be configured keys from ~/.bpython/config
1357-
#
1364+
#
13581365
statusbar = Statusbar(scr, main_win,
13591366
" <%s> Exit <%s> Rewind <%s> Save <%s> Pastebin <%s> Pager" %
13601367
(OPTS.exit_key, OPTS.undo_key, OPTS.save_key, OPTS.pastebin_key,
@@ -1426,15 +1433,19 @@ def do_resize(caller):
14261433
caller.resize()
14271434
# The list win resizes itself every time it appears so no need to do it here.
14281435

1436+
14291437
class FakeDict(object):
14301438
"""Very simple dict-alike that returns a constant value for any key -
14311439
used as a hacky solution to using a colours dict containing colour codes if
14321440
colour initialisation fails."""
1441+
14331442
def __init__(self, val):
14341443
self._val = val
1444+
14351445
def __getitem__(self, k):
14361446
return self._val
14371447

1448+
14381449
def newwin(*args):
14391450
"""Wrapper for curses.newwin to automatically set background colour on any
14401451
newly created window."""
@@ -1578,7 +1589,8 @@ def main(args=None, locals_=None):
15781589

15791590
setlocale(LC_ALL, '')
15801591

1581-
path = os.path.expanduser('~/.bpythonrc') # migrating old configuration file
1592+
path = os.path.expanduser('~/.bpythonrc')
1593+
# migrating old configuration file
15821594
if os.path.isfile(path):
15831595
migrate_rc(path)
15841596
loadini(OPTS, options.config)

0 commit comments

Comments
 (0)
X Tutup