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 @@ class Tab: # {{{
self.new_special_window(special_window) self.new_special_window(special_window)
else: else:
self.cwd = session_tab.cwd or args.directory self.cwd = session_tab.cwd or args.directory
l = session_tab.layout l0 = session_tab.layout
self.current_layout = all_layouts[l](opts, borders.border_width, self.windows) self.current_layout = all_layouts[l0](opts, borders.border_width, self.windows)
self.startup(session_tab) self.startup(session_tab)
def startup(self, session_tab): def startup(self, session_tab):

View File

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

View File

@ -211,11 +211,11 @@ class TestGraphics(BaseTest):
cw, ch = 10, 20 cw, ch = 10, 20
s, dx, dy, put_image, put_ref, layers, rect_eq = put_helpers(self, cw, ch) s, dx, dy, put_image, put_ref, layers, rect_eq = put_helpers(self, cw, ch)
self.ae(put_image(s, 10, 20)[1], 'OK') self.ae(put_image(s, 10, 20)[1], 'OK')
l = layers(s) l0 = layers(s)
self.ae(len(l), 1) self.ae(len(l0), 1)
rect_eq(l[0]['src_rect'], 0, 0, 1, 1) rect_eq(l0[0]['src_rect'], 0, 0, 1, 1)
rect_eq(l[0]['dest_rect'], -1, 1, -1 + dx, 1 - dy) rect_eq(l0[0]['dest_rect'], -1, 1, -1 + dx, 1 - dy)
self.ae(l[0]['group_count'], 1) self.ae(l0[0]['group_count'], 1)
self.ae(s.cursor.x, 1), self.ae(s.cursor.y, 0) 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) 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) l2 = layers(s)
@ -261,8 +261,8 @@ class TestGraphics(BaseTest):
self.ae(s.grman.image_count, 3) 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}) self.ae(layers(s)[0]['src_rect'], {'left': 0.0, 'top': 0.0, 'right': 1.0, 'bottom': 1.0})
s.index(), s.index() s.index(), s.index()
l = layers(s) l0 = layers(s)
self.ae(len(l), 3) self.ae(len(l0), 3)
self.ae(layers(s)[0]['src_rect'], {'left': 0.0, 'top': 0.5, 'right': 1.0, 'bottom': 1.0}) self.ae(layers(s)[0]['src_rect'], {'left': 0.0, 'top': 0.5, 'right': 1.0, 'bottom': 1.0})
s.index() s.index()
self.ae(s.grman.image_count, 2) self.ae(s.grman.image_count, 2)