Skip to content

Commit c32eceb

Browse files
committed
flake8 cleanup
1 parent 08f19a0 commit c32eceb

File tree

3 files changed

+20
-18
lines changed

3 files changed

+20
-18
lines changed

tests/test_lists.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@ def test_lists():
88
expect = '\t<ul>\n\t\t<li>one</li>\n\t\t<li>two</li>\n\t\t<li>three</li>\n\t</ul>'
99
assert result == expect
1010

11+
1112
def test_nested_list():
12-
l = List('ol', indent_level=1)
13-
l.add_item('li', 'test')
13+
lst = List('ol', indent_level=1)
14+
lst('li', 'test')
1415
s = List('ol', indent_level=2)
1516
s.add_item('li', 'another one')
16-
l.add_item('li', s)
17-
result = l.process()
17+
lst('li', s)
18+
result = lst()
1819
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t\t<li>another one</li>\n\t\t</ol></li>\n\t</ol>'
1920
assert result == expect
2021

21-
l = List('ol', indent_level=1)
22-
l.add_item('li', 'test')
22+
lst = List('ol', indent_level=1)
23+
lst('li', 'test')
2324
s1 = List('ol', indent_level=2)
2425
s1.add_item('li', 'another one')
2526
s2 = List('ul', indent_level=3)
2627
s2.add_item('li', 'point one')
2728
s2.add_item('li', 'point two')
2829
s1.add_item('li', s2)
2930
s1.add_item('li', 'moar item')
30-
l.add_item('li', s1)
31-
result = l.process()
31+
lst('li', s1)
32+
result = lst()
3233
expect = '\t<ol>\n\t\t<li>test\n\t\t<ol>\n\t\t\t<li>another one\n\t\t\t<ul>\n\t\t\t\t<li>point one</li>\n\t\t\t\t<li>point two</li>\n\t\t\t</ul></li>\n\t\t\t<li>moar item</li>\n\t\t</ol></li>\n\t</ol>'
3334
assert result == expect
3435

textile/core.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -293,16 +293,16 @@ def textileLists(self, text):
293293
def fTextileList(self, match):
294294
text = re.split(r'\n(?=[*#;:]+\s)', match.group(), flags=re.M)
295295
pt = ''
296-
result = []
296+
# result = []
297297
ls = OrderedDict()
298298
for i, line in enumerate(text):
299-
try:
300-
nextline = text[i + 1]
301-
except IndexError:
302-
nextline = ''
299+
# try:
300+
# nextline = text[i + 1]
301+
# except IndexError:
302+
# nextline = ''
303303

304304
m = re.search(r"^(?P<tl>[#*;:]+)(?P<st>_|\d+)?(?P<atts>{0})[ .]?"
305-
"(?P<content>.*)?$".format(cls_re_s), line, re.S)
305+
"(?P<content>.*)?$".format(cls_re_s), line, re.S)
306306
tl, start, atts, content = m.groups()
307307
attributes = parse_attributes(atts)
308308
content = content.strip()
@@ -371,15 +371,15 @@ def fTextileList(self, match):
371371
_list.add_item(litem, content)
372372
elif showitem:
373373
# itemtag = ("\n{0}\t<{1}>{2}".format(tabs, litem, content) if
374-
# showitem else '')
374+
# showitem else '')
375375
_sublist = List('{0}l'.format(ltype), attributes)
376376
# line = "<{0}l{1}{2}>{3}".format(ltype, atts, start, itemtag)
377377
_sublist.add_item(litem, content, attributes)
378378
_list.add_item(litem, _sublist)
379379
# line = _sublist.process()
380380
else:
381381
# line = ("\t<{0}{1}>{2}".format(litem, atts, content) if
382-
# showitem else '')
382+
# showitem else '')
383383
_list.add_item(litem, content, attributes)
384384
# line = '{0}{1}'.format(tabs, line)
385385

@@ -402,8 +402,8 @@ def fTextileList(self, match):
402402
# This else exists in the original php version. I'm not sure how
403403
# to come up with a case where the line would not match. I think
404404
# it may have been necessary due to the way php returns matches.
405-
#else:
406-
#line = "{0}\n".format(line)
405+
# else:
406+
# line = "{0}\n".format(line)
407407
# result.append(line)
408408
return self.doTagBr(litem, _list.process())
409409

textile/objects/list.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from textile.utils import generate_tag
22

3+
34
class List(object):
45
def __init__(self, listtype, attributes={}, indent_level=0):
56
super(List, self).__init__()

0 commit comments

Comments
 (0)