Example #1
0
 def __iter__(self):
     s = reduce(
         lambda acc, el: acc << (
             el if isinstance(el, self.__class__) else [el]
         ),
         takewhile(lambda el: el is not None, self.array),
         Stream()
     )
     return iter(s)
Example #2
0
File: art.py Project: Answeror/blog
    def __init__(self, name, path, text, hint):
        self.name = name
        self.path = path

        lines = text.split('\n')

        self.head = yaml.load('\n'.join(takewhile(lambda s: s.strip(), lines)))
        if 'type' not in self.head:
            self.head['type'] = hint

        self.raw = '\n'.join(
            dropwhile(
                lambda s: not s.strip(),
                dropwhile(lambda s: s.strip(), lines)
            )
        )
Example #3
0
File: trie.py Project: soasme/fn.py
 def __iter__(self):
     s = reduce(
         lambda acc, el: acc <<
         (el if isinstance(el, self.__class__) else [el]),
         takewhile(lambda el: el is not None, self.array), Stream())
     return iter(s)