Ejemplo n.º 1
0
def parse(s):
    """Returns a FmtStr object from a bpython-formatted colored string"""
    rest = s
    stuff = []
    while True:
        if not rest:
            break
        start, rest = peel_off_string(rest)
        stuff.append(start)
    return (sum((fs_from_match(d) for d in stuff[1:]), fs_from_match(stuff[0]))
            if len(stuff) > 0 else FmtStr())
Ejemplo n.º 2
0
 def test_actual_init(self):
     FmtStr()
Ejemplo n.º 3
0
def add_things(n):
    part = Chunk('hi', {'fg': 36})
    whole = FmtStr(part)
    return sum([whole for _ in range(n)], FmtStr())