From 1970b754158ec98a072e15cbfc15e42bfff7d1fc Mon Sep 17 00:00:00 2001 From: Jeremy Stanley Date: Mon, 1 Feb 2021 18:47:17 +0000 Subject: [PATCH] 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 --- lodgeit/lib/diff.py | 14 +++++++------- requirements.txt | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lodgeit/lib/diff.py b/lodgeit/lib/diff.py index 6aefdbd..3c4e033 100644 --- a/lodgeit/lib/diff.py +++ b/lodgeit/lib/diff.py @@ -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' % ( - l['line'][:start], + iterline['line'] = u'%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) diff --git a/requirements.txt b/requirements.txt index 3f63568..ddb8d37 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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