MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / _make_fontconfig_parser

Function _make_fontconfig_parser

lib/matplotlib/_fontconfig_pattern.py:56–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54
55@cache # The parser instance is a singleton.
56def _make_fontconfig_parser():
57 def comma_separated(elem):
58 return elem + ZeroOrMore(Suppress(",") + elem)
59
60 family = Regex(fr"([^{_family_punc}]|(\\[{_family_punc}]))*")
61 size = Regex(r"([0-9]+\.?[0-9]*|\.[0-9]+)")
62 name = Regex(r"[a-z]+")
63 value = Regex(fr"([^{_value_punc}]|(\\[{_value_punc}]))*")
64 prop = Group((name + Suppress("=") + comma_separated(value)) | one_of(_CONSTANTS))
65 return (
66 Optional(comma_separated(family)("families"))
67 + Optional("-" + comma_separated(size)("sizes"))
68 + ZeroOrMore(":" + prop("properties*"))
69 + StringEnd()
70 )
71
72
73# `parse_fontconfig_pattern` is a bottleneck during the tests because it is

Callers 1

parse_fontconfig_patternFunction · 0.85

Calls 1

comma_separatedFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…