Esempio n. 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)
Esempio n. 2
0
File: art.py Progetto: 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)
            )
        )
Esempio n. 3
0
File: trie.py Progetto: 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)