X Tutup
Skip to content

Commit f6ff8d3

Browse files
committed
More PEP-8 conformance
1 parent 2c906bf commit f6ff8d3

File tree

3 files changed

+22
-25
lines changed

3 files changed

+22
-25
lines changed

bpython/cli.py

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def bs(self, delete_tabs=True):
302302

303303
self.s = self.s[:-n]
304304
else:
305-
self.s = self.s[:-self.cpos-1] + self.s[-self.cpos:]
305+
self.s = self.s[:-self.cpos - 1] + self.s[-self.cpos:]
306306

307307
self.print_line(self.s, clr=True)
308308

@@ -407,8 +407,8 @@ def cw(self):
407407
l = len(self.s)
408408

409409
if (not self.s or
410-
(not self.s[l-1].isalnum() and
411-
self.s[l-1] not in ('.', '_'))):
410+
(not self.s[l - 1].isalnum() and
411+
self.s[l - 1] not in ('.', '_'))):
412412
return
413413

414414
i = 1
@@ -605,7 +605,7 @@ def mkargspec(self, topline, down):
605605
ty = self.list_win.getbegyx()[0]
606606
if not down and ty > 0:
607607
h += 1
608-
self.list_win.mvwin(ty-1, 1)
608+
self.list_win.mvwin(ty - 1, 1)
609609
self.list_win.resize(h, w)
610610
elif down and h + r < maxh - ty:
611611
h += 1
@@ -699,7 +699,7 @@ def p_key(self, key):
699699
if key is None:
700700
return ''
701701

702-
if key == chr(8): # C-Backspace (on my computer anyway!)
702+
if key == chr(8): # C-Backspace (on my computer anyway!)
703703
self.clrtobol()
704704
key = '\n'
705705
# Don't return; let it get handled
@@ -711,14 +711,14 @@ def p_key(self, key):
711711
self.complete()
712712
return ''
713713

714-
elif key == 'KEY_DC': # Del
714+
elif key == 'KEY_DC': # Del
715715
self.delete()
716716
self.complete()
717717
# Redraw (as there might have been highlighted parens)
718718
self.print_line(self.s)
719719
return ''
720720

721-
elif key in key_dispatch[OPTS.undo_key]: # C-r
721+
elif key in key_dispatch[OPTS.undo_key]: # C-r
722722
self.undo()
723723
return ''
724724

@@ -732,31 +732,31 @@ def p_key(self, key):
732732
self.fwd()
733733
return ''
734734

735-
elif key == 'KEY_LEFT': # Cursor Left
735+
elif key == 'KEY_LEFT': # Cursor Left
736736
self.mvc(1)
737737
# Redraw (as there might have been highlighted parens)
738738
self.print_line(self.s)
739739

740-
elif key == 'KEY_RIGHT': # Cursor Right
740+
elif key == 'KEY_RIGHT': # Cursor Right
741741
self.mvc(-1)
742742
# Redraw (as there might have been highlighted parens)
743743
self.print_line(self.s)
744744

745-
elif key in ("KEY_HOME", '^A', chr(1)): # home or ^A
745+
elif key in ("KEY_HOME", '^A', chr(1)): # home or ^A
746746
self.home()
747747
# Redraw (as there might have been highlighted parens)
748748
self.print_line(self.s)
749749

750-
elif key in ("KEY_END", '^E', chr(5)): # end or ^E
750+
elif key in ("KEY_END", '^E', chr(5)): # end or ^E
751751
self.end()
752752
# Redraw (as there might have been highlighted parens)
753753
self.print_line(self.s)
754754

755-
elif key in key_dispatch[OPTS.cut_to_buffer_key]: # cut to buffer
755+
elif key in key_dispatch[OPTS.cut_to_buffer_key]: # cut to buffer
756756
self.cut_to_buffer()
757757
return ''
758758

759-
elif key in key_dispatch[OPTS.yank_from_buffer_key]: # yank from buffer
759+
elif key in key_dispatch[OPTS.yank_from_buffer_key]: # yank from buffer
760760
self.yank_from_buffer()
761761
return ''
762762

@@ -1024,13 +1024,13 @@ def lsize():
10241024

10251025
if items:
10261026
# visible items (we'll append until we can't fit any more in)
1027-
v_items = [items[0][:max_w-3]]
1027+
v_items = [items[0][:max_w - 3]]
10281028
lsize()
10291029
else:
10301030
v_items = []
10311031

10321032
for i in items[1:]:
1033-
v_items.append(i[:max_w-3])
1033+
v_items.append(i[:max_w - 3])
10341034
if not lsize():
10351035
del v_items[-1]
10361036
v_items[-1] = '...'
@@ -1056,7 +1056,6 @@ def lsize():
10561056
t = max_w
10571057
w = t
10581058

1059-
10601059
if height_offset and display_rows + 5 >= max_h:
10611060
del v_items[-(cols * (height_offset)):]
10621061

@@ -1077,7 +1076,6 @@ def lsize():
10771076
if v_items:
10781077
self.list_win.addstr('\n ')
10791078

1080-
10811079
for ix, i in enumerate(v_items):
10821080
padding = (wl - len(i)) * ' '
10831081
if i == current_item:
@@ -1121,7 +1119,7 @@ def size(self):
11211119
h, w = stdscr.getmaxyx()
11221120
self.y = 0
11231121
self.w = w
1124-
self.h = h-1
1122+
self.h = h - 1
11251123
self.x = 0
11261124

11271125
def tab(self):
@@ -1236,7 +1234,7 @@ def size(self):
12361234
"""Set instance attributes for x and y top left corner coordinates
12371235
and width and heigth for the window."""
12381236
h, w = gethw()
1239-
self.y = h-1
1237+
self.y = h - 1
12401238
self.w = w
12411239
self.h = 1
12421240
self.x = 0
@@ -1285,8 +1283,8 @@ def bs(s):
12851283
if x == ix:
12861284
return s
12871285
s = s[:-1]
1288-
self.win.delch(y, x-1)
1289-
self.win.move(y, x-1)
1286+
self.win.delch(y, x - 1)
1287+
self.win.move(y, x - 1)
12901288
return s
12911289

12921290
o = ''
@@ -1322,7 +1320,7 @@ def settext(self, s, c=None, p=False):
13221320

13231321
self.win.erase()
13241322
if len(s) >= self.w:
1325-
s = s[:self.w-1]
1323+
s = s[:self.w - 1]
13261324

13271325
self.s = s
13281326
if c:
@@ -1352,7 +1350,7 @@ def init_wins(scr, cols):
13521350

13531351
h, w = gethw()
13541352

1355-
main_win = newwin(h-1, w, 0, 0)
1353+
main_win = newwin(h - 1, w, 0, 0)
13561354
main_win.scrollok(True)
13571355
main_win.keypad(1)
13581356
# Thanks to Angus Gibson for pointing out this missing line which was causing

bpython/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@ def loadini(struct, configfile):
112112
path = os.path.expanduser('~/.bpython/%s.theme' % (color_scheme_name,))
113113
load_theme(struct, path, config_path)
114114

115-
116115
# checks for valid key configuration this part still sucks
117116
for key in (struct.pastebin_key, struct.save_key):
118117
key_dispatch[key]

bpython/gtk_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def update_matches(self, matches):
211211

212212

213213
class ReplWidget(gtk.TextView, repl.Repl):
214-
__gsignals__ = dict(#key_press_event=None,
214+
__gsignals__ = dict( # key_press_event=None,
215215
button_press_event=None,
216216
focus_in_event=None,
217217
focus_out_event=None,

0 commit comments

Comments
 (0)
X Tutup