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

Method _parse_cached

lib/matplotlib/mathtext.py:89–105  ·  view source on GitHub ↗
(self, s, dpi, prop, antialiased, load_glyph_flags)

Source from the content-addressed store, hash-verified

87
88 @functools.lru_cache(50)
89 def _parse_cached(self, s, dpi, prop, antialiased, load_glyph_flags):
90 if prop is None:
91 prop = FontProperties()
92 fontset_class = _api.getitem_checked(
93 self._font_type_mapping, fontset=prop.get_math_fontfamily())
94 fontset = fontset_class(prop, load_glyph_flags)
95 fontsize = prop.get_size_in_points()
96
97 if self._parser is None: # Cache the parser globally.
98 self.__class__._parser = _mathtext.Parser()
99
100 box = self._parser.parse(s, fontset, fontsize, dpi)
101 output = _mathtext.ship(box)
102 if self._output_type == "vector":
103 return output.to_vector()
104 elif self._output_type == "raster":
105 return output.to_raster(antialiased=antialiased)
106
107
108def math_to_image(s, filename_or_obj, prop=None, dpi=None, format=None,

Callers 1

parseMethod · 0.95

Calls 5

get_math_fontfamilyMethod · 0.95
FontPropertiesClass · 0.90
to_vectorMethod · 0.80
to_rasterMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected