Apparently pep8 now just does not let you use the name l

This is one of the most hilarious bugs in pep8 I have come across
This commit is contained in:
Kovid Goyal 2017-10-23 17:37:18 +05:30
parent 8b54df31ef
commit 2443d76ac3
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 45 additions and 45 deletions

View File

@ -57,8 +57,8 @@ def __init__(self, opts, args, on_title_change, session_tab=None, special_window
self.new_special_window(special_window)
else:
self.cwd = session_tab.cwd or args.directory
l = session_tab.layout
self.current_layout = all_layouts[l](opts, borders.border_width, self.windows)
l0 = session_tab.layout
self.current_layout = all_layouts[l0](opts, borders.border_width, self.windows)
self.startup(session_tab)
def startup(self, session_tab):

View File

@ -19,10 +19,10 @@ def create_lbuf(*lines):
maxw = max(map(len, lines))
ans = LineBuf(len(lines), maxw)
prev_full_length = False
for i, l in enumerate(lines):
ans.line(i).set_text(l, 0, len(l), C())
for i, l0 in enumerate(lines):
ans.line(i).set_text(l0, 0, len(l0), C())
ans.set_continued(i, prev_full_length)
prev_full_length = len(l) == maxw
prev_full_length = len(l0) == maxw
return ans
@ -38,8 +38,8 @@ def test_linebuf(self):
old.set_attribute(REVERSE, False)
for y in range(old.ynum):
for x in range(old.xnum):
l = old.line(y)
c = l.cursor_from(x)
l0 = old.line(y)
c = l0.cursor_from(x)
self.assertFalse(c.reverse)
self.assertTrue(c.bold)
self.assertFalse(old.is_continued(0))
@ -147,23 +147,23 @@ def test_line(self):
lb.line(lb.ynum)
with self.assertRaises(IndexError):
lb.line(0)[lb.xnum]
l = lb.line(0)
l.set_text(' ', 0, len(' '), C())
l.add_combining_char(0, '1')
self.ae(l[0], ' 1')
l.add_combining_char(0, '2')
self.ae(l[0], ' 12')
l.add_combining_char(0, '3')
self.ae(l[0], ' 13')
self.ae(l[1], '\0')
self.ae(str(l), ' 13')
l0 = lb.line(0)
l0.set_text(' ', 0, len(' '), C())
l0.add_combining_char(0, '1')
self.ae(l0[0], ' 1')
l0.add_combining_char(0, '2')
self.ae(l0[0], ' 12')
l0.add_combining_char(0, '3')
self.ae(l0[0], ' 13')
self.ae(l0[1], '\0')
self.ae(str(l0), ' 13')
t = 'Testing with simple text'
lb = LineBuf(2, len(t))
l = lb.line(0)
l.set_text(t, 0, len(t), C())
self.ae(str(l), t)
l.set_text('a', 0, 1, C())
self.assertEqual(str(l), 'a' + t[1:])
l0 = lb.line(0)
l0.set_text(t, 0, len(t), C())
self.ae(str(l0), t)
l0.set_text('a', 0, 1, C())
self.assertEqual(str(l0), 'a' + t[1:])
c = C(3, 5)
c.bold = c.italic = c.reverse = c.strikethrough = True
@ -174,16 +174,16 @@ def test_line(self):
self.ae(c, c2)
c2.bold = False
self.assertNotEqual(c, c2)
l.set_text(t, 0, len(t), C())
l.apply_cursor(c2, 3)
self.assertEqualAttributes(c2, l.cursor_from(3))
l.apply_cursor(c2, 0, len(l))
for i in range(len(l)):
self.assertEqualAttributes(c2, l.cursor_from(i))
l.apply_cursor(c3, 0)
self.assertEqualAttributes(c3, l.cursor_from(0))
l.copy_char(0, l, 1)
self.assertEqualAttributes(c3, l.cursor_from(1))
l0.set_text(t, 0, len(t), C())
l0.apply_cursor(c2, 3)
self.assertEqualAttributes(c2, l0.cursor_from(3))
l0.apply_cursor(c2, 0, len(l0))
for i in range(len(l0)):
self.assertEqualAttributes(c2, l0.cursor_from(i))
l0.apply_cursor(c3, 0)
self.assertEqualAttributes(c3, l0.cursor_from(0))
l0.copy_char(0, l0, 1)
self.assertEqualAttributes(c3, l0.cursor_from(1))
t = '0123456789'
lb = LineBuf(1, len(t))
@ -225,8 +225,8 @@ def create(t):
for trail in '.,]>)\\':
lx = create("http://xyz.com" + trail)
self.ae(lx.url_end_at(0), len(lx) - 2)
l = create("ftp://abc/")
self.ae(l.url_end_at(0), len(l) - 1)
l0 = create("ftp://abc/")
self.ae(l0.url_end_at(0), len(l0) - 1)
l2 = create("http://-abcd] ")
self.ae(l2.url_end_at(0), len(l2) - 3)
@ -281,9 +281,9 @@ def test_rewrap_simple(self):
self.ae(lb2.line(i), lb.line(i + 2))
def line_comparison(self, buf, *lines):
for i, l in enumerate(lines):
for i, l0 in enumerate(lines):
l2 = buf.line(i)
self.ae(l, str(l2))
self.ae(l0, str(l2))
def line_comparison_rewrap(self, lb, *lines):
lb2 = LineBuf(len(lines), max(map(len, lines)))
@ -382,8 +382,8 @@ def test_historybuf(self):
def test_ansi_repr(self):
lb = filled_line_buf()
l = lb.line(0)
self.ae(l.as_ansi(), '\x1b[0m00000')
l0 = lb.line(0)
self.ae(l0.as_ansi(), '\x1b[0m00000')
a = []
lb.as_ansi(a.append)
self.ae(a, ['\x1b[0m' + str(lb.line(i)) + '\n' for i in range(lb.ynum)])

View File

@ -211,11 +211,11 @@ def test_image_put(self):
cw, ch = 10, 20
s, dx, dy, put_image, put_ref, layers, rect_eq = put_helpers(self, cw, ch)
self.ae(put_image(s, 10, 20)[1], 'OK')
l = layers(s)
self.ae(len(l), 1)
rect_eq(l[0]['src_rect'], 0, 0, 1, 1)
rect_eq(l[0]['dest_rect'], -1, 1, -1 + dx, 1 - dy)
self.ae(l[0]['group_count'], 1)
l0 = layers(s)
self.ae(len(l0), 1)
rect_eq(l0[0]['src_rect'], 0, 0, 1, 1)
rect_eq(l0[0]['dest_rect'], -1, 1, -1 + dx, 1 - dy)
self.ae(l0[0]['group_count'], 1)
self.ae(s.cursor.x, 1), self.ae(s.cursor.y, 0)
put_ref(s, num_cols=s.columns, x_off=2, y_off=1, width=3, height=5, cell_x_off=3, cell_y_off=1, z=-1)
l2 = layers(s)
@ -261,8 +261,8 @@ def test_gr_scroll(self):
self.ae(s.grman.image_count, 3)
self.ae(layers(s)[0]['src_rect'], {'left': 0.0, 'top': 0.0, 'right': 1.0, 'bottom': 1.0})
s.index(), s.index()
l = layers(s)
self.ae(len(l), 3)
l0 = layers(s)
self.ae(len(l0), 3)
self.ae(layers(s)[0]['src_rect'], {'left': 0.0, 'top': 0.5, 'right': 1.0, 'bottom': 1.0})
s.index()
self.ae(s.grman.image_count, 2)