mercurial/templater.py
changeset 11305 d4cafcb63f77
parent 10855 62216faed067
child 12402 b014f998959d
equal deleted inserted replaced
11304:8c377f2feee1 11305:d4cafcb63f77
    15 def _flatten(thing):
    15 def _flatten(thing):
    16     '''yield a single stream from a possibly nested set of iterators'''
    16     '''yield a single stream from a possibly nested set of iterators'''
    17     if isinstance(thing, str):
    17     if isinstance(thing, str):
    18         yield thing
    18         yield thing
    19     elif not hasattr(thing, '__iter__'):
    19     elif not hasattr(thing, '__iter__'):
    20         if i is not None:
    20         if thing is not None:
    21             yield str(thing)
    21             yield str(thing)
    22     else:
    22     else:
    23         for i in thing:
    23         for i in thing:
    24             if isinstance(i, str):
    24             if isinstance(i, str):
    25                 yield i
    25                 yield i