Use less ambiguous line iteration variable name

In diff.py the line iteration inline function relied on an iterable
named "l" (lower-case L) which is easily confused with the number 1
in some poorly-designed fonts. Because this is the only occurrence
for which newer pycodestyle is objecting, just go ahead and adjust
it rather than altering our style checks.

Also temporarily pin Pygments to deal which a regression which
arises in 2.7.3 and later.

Change-Id: I29cc8e5680d3fed3645b26f8b03d2ca299d974b0
This commit is contained in:
Jeremy Stanley 2021-02-01 18:47:17 +00:00
parent d66b0e82fb
commit 1970b75415
2 changed files with 8 additions and 8 deletions

View File

@ -58,18 +58,18 @@ class DiffRenderer(object):
end -= 1
end += 1
if start or end:
def do(l):
last = end + len(l['line'])
if l['action'] == 'add':
def do(iterline):
last = end + len(iterline['line'])
if iterline['action'] == 'add':
tag = 'ins'
else:
tag = 'del'
l['line'] = u'%s<%s>%s</%s>%s' % (
l['line'][:start],
iterline['line'] = u'%s<%s>%s</%s>%s' % (
iterline['line'][:start],
tag,
l['line'][start:last],
iterline['line'][start:last],
tag,
l['line'][last:]
iterline['line'][last:]
)
do(line)
do(next)

View File

@ -2,7 +2,7 @@ six
Jinja2
Werkzeug<0.16
Pygments<2.6;python_version<'3'
Pygments;python_version>='3'
Pygments<2.7.3;python_version>='3'
SQLAlchemy
PyMySQL
simplejson