MCPcopy Index your code
hub / github.com/bpython/bpython / parse

Function parse

bpython/curtsiesfrontend/parse.py:50–61  ·  view source on GitHub ↗

Returns a FmtStr object from a bpython-formatted colored string

(s: str)

Source from the content-addressed store, hash-verified

48
49
50def parse(s: str) -> FmtStr:
51 """Returns a FmtStr object from a bpython-formatted colored string"""
52 rest = s
53 stuff = []
54 while rest:
55 start, rest = peel_off_string(rest)
56 stuff.append(start)
57 return (
58 sum((fs_from_match(d) for d in stuff[1:]), fs_from_match(stuff[0]))
59 if len(stuff) > 0
60 else FmtStr()
61 )
62
63
64def fs_from_match(d: dict[str, Any]) -> FmtStr:

Callers 1

formatMethod · 0.90

Calls 3

peel_off_stringFunction · 0.85
fs_from_matchFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected