From 11bfc01d1ffd9a7e3ce76c0675135179e6a9e245 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 11 Sep 2018 10:07:21 +1000 Subject: [PATCH] sphinxext: Use unicode_literals docutils consistently uses unicode values, so for better python2 compatability use unicode_literals. Remove the now unnecessary unicode cast for the debug logging. Going through every line is also a good case for lazy binding of the arguments -- this way the string is only built when LOG.debug() is actually active. Change-Id: I50556a7efddaa168f4e5d96400d7388cecbb2033 --- reno/sphinxext.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reno/sphinxext.py b/reno/sphinxext.py index e805e7c..5b99993 100644 --- a/reno/sphinxext.py +++ b/reno/sphinxext.py @@ -9,6 +9,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +from __future__ import unicode_literals import os.path @@ -111,7 +112,7 @@ class ReleaseNotesDirective(rst.Directive): source_name = '<%s %s>' % (__name__, branch or 'current branch') result = statemachine.ViewList() for line_num, line in enumerate(text.splitlines(), 1): - LOG.debug(u'{:>4d}: {}'.format(line_num, line)) + LOG.debug('%4d: %s', line_num, line) result.append(line, source_name, line_num) node = nodes.section()