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

Function fs_from_match

bpython/curtsiesfrontend/parse.py:64–86  ·  view source on GitHub ↗
(d: dict[str, Any])

Source from the content-addressed store, hash-verified

62
63
64def fs_from_match(d: dict[str, Any]) -> FmtStr:
65 atts = {}
66 color = "default"
67 if d["fg"]:
68 # this isn't according to spec as I understand it
69 if d["fg"].isupper():
70 d["bold"] = True
71 # TODO figure out why boldness isn't based on presence of \x02
72
73 color = CNAMES[d["fg"].lower()]
74 if color != "default":
75 atts["fg"] = FG_COLORS[color]
76 if d["bg"]:
77 if d["bg"] == "I":
78 # hack for finding the "inverse"
79 color = INVERSE_COLORS[color]
80 else:
81 color = CNAMES[d["bg"].lower()]
82 if color != "default":
83 atts["bg"] = BG_COLORS[color]
84 if d["bold"]:
85 atts["bold"] = True
86 return fmtstr(d["string"], **atts)
87
88
89peel_off_string_re = LazyReCompile(

Callers 1

parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected