templater: make it clearer that _flatten() omits None
authorYuya Nishihara <yuya@tcha.org>
Thu, 18 Aug 2016 15:55:07 +0900
changeset 29815 0d5cc0c18b4e
parent 29814 cbf9984a7957
child 29816 034412ca28c3
templater: make it clearer that _flatten() omits None
mercurial/templater.py
--- a/mercurial/templater.py	Thu Aug 18 17:25:10 2016 +0200
+++ b/mercurial/templater.py	Thu Aug 18 15:55:07 2016 +0900
@@ -917,17 +917,19 @@
     '''yield a single stream from a possibly nested set of iterators'''
     if isinstance(thing, str):
         yield thing
+    elif thing is None:
+        pass
     elif not util.safehasattr(thing, '__iter__'):
-        if thing is not None:
-            yield str(thing)
+        yield str(thing)
     else:
         for i in thing:
             if isinstance(i, str):
                 yield i
+            elif i is None:
+                pass
             elif not util.safehasattr(i, '__iter__'):
-                if i is not None:
-                    yield str(i)
-            elif i is not None:
+                yield str(i)
+            else:
                 for j in _flatten(i):
                     yield j