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

Method __init__

lib/matplotlib/backends/backend_pgf.py:267–284  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

265 return self._expect("\n*")
266
267 def __init__(self):
268 # create a tmp directory for running latex, register it for deletion
269 self._tmpdir = TemporaryDirectory()
270 self.tmpdir = self._tmpdir.name
271 self._finalize_tmpdir = weakref.finalize(self, self._tmpdir.cleanup)
272
273 # test the LaTeX setup to ensure a clean startup of the subprocess
274 self._setup_latex_process(expect_reply=False)
275 stdout, stderr = self.latex.communicate("\n\\makeatletter\\@@end\n")
276 if self.latex.returncode != 0:
277 raise LatexError(
278 f"LaTeX errored (probably missing font or error in preamble) "
279 f"while processing the following input:\n"
280 f"{self._build_latex_header()}",
281 stdout)
282 self.latex = None # Will be set up on first use.
283 # Per-instance cache.
284 self._get_box_metrics = functools.lru_cache(self._get_box_metrics)
285
286 def _setup_latex_process(self, *, expect_reply=True):
287 # Open LaTeX process for real work; register it for deletion. On

Callers

nothing calls this directly

Calls 4

_setup_latex_processMethod · 0.95
_build_latex_headerMethod · 0.95
LatexErrorClass · 0.85
finalizeMethod · 0.45

Tested by

no test coverage detected