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
This commit is contained in:
Ian Wienand 2018-09-11 10:07:21 +10:00
parent 355e1674be
commit 11bfc01d1f
1 changed files with 2 additions and 1 deletions

View File

@ -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()