Patchwork [3,of,3,py3] hgmanpage: use a py2 and py3 compatible iterable protocol

login
register
mail settings
Submitter Philippe Pepiot
Date April 4, 2019, 5:09 p.m.
Message ID <c180963580407113ef80.1554397793@euler.in.philpep.org>
Download mbox | patch
Permalink /patch/39479/
State Accepted
Headers show

Comments

Philippe Pepiot - April 4, 2019, 5:09 p.m.
# HG changeset patch
# User Philippe Pepiot <philippe.pepiot@logilab.fr>
# Date 1554397717 -7200
#      Thu Apr 04 19:08:37 2019 +0200
# Node ID c180963580407113ef801ebf98a3f799b9b8cef5
# Parent  1cfe2d1794ee65647bc95615e5d032cc6e54352c
[py3] hgmanpage: use a py2 and py3 compatible iterable protocol

Patch

diff --git a/doc/hgmanpage.py b/doc/hgmanpage.py
--- a/doc/hgmanpage.py
+++ b/doc/hgmanpage.py
@@ -335,7 +335,7 @@  class Translator(nodes.NodeVisitor):
                 elif style.endswith('roman'):
                     self._indent = 5
 
-            def next(self):
+            def __next__(self):
                 if self._style == 'bullet':
                     return self.enum_style[self._style]
                 elif self._style == 'emdash':
@@ -353,6 +353,9 @@  class Translator(nodes.NodeVisitor):
                     return res.lower()
                 else:
                     return "%d." % self._cnt
+
+            next = __next__
+
             def get_width(self):
                 return self._indent
             def __repr__(self):