class_docstr: Convert strings to dvi files using TeX, caching the results to a directory.
  
  The cache directory is called ``tex.cache`` and is located in the directory
  returned by `.get_cachedir`.
  
  Repeated calls to this constructor always return the same instance.
class_docstr_tok: ["Convert","strings","to","dvi","files","using","TeX",",","caching","the","results","to","a","directory",".","The","cache","directory","is","called","``","tex.cache","``","and","is","located","in","the","directory","returned","by","`",".get_cachedir","`",".","Repeated","calls","to","this","constructor","always","return","the","same","instance","."]
docstr: Return a filename based on a hash of the string, fontsize, and dpi.
docstr_tok: ["Return","a","filename","based","on","a","hash","of","the","string",",","fontsize",",","and","dpi","."]
code: def get_basefile(cls, tex, fontsize, dpi=None):
      """
      Return a filename based on a hash of the string, fontsize, and dpi.
      """
      src = cls._get_tex_source(tex, fontsize) + str(dpi)
      filehash = hashlib.md5(src.encode("utf-8")).hexdigest()
      filepath = Path(cls._texcache)
  
      num_letters, num_levels = 2, 2
      for i in range(0, num_letters * num_levels, num_letters):
          filepath = filepath / Path(filehash[i : i + 2])
  
      filepath.mkdir(parents=True, exist_ok=True)
      return os.path.join(filepath, filehash)
  
imports: import functools
  import hashlib
  import logging
  import os
  from pathlib import Path
  import subprocess
  from tempfile import TemporaryDirectory
  import numpy
  import matplotlib
  from matplotlib import _api, cbook, dviread
label_desc: Use image node_id 4 for calling the TexManager obj's underlying member method code with example usage: obj.get_basefile(cls, tex, fontsize, dpi) and returns: os