class_docstr: A bytecode cache that stores bytecode on the filesystem.  It accepts
  two arguments: The directory where the cache items are stored and a
  pattern string that is used to build the filename.
  
  If no directory is specified a default cache directory is selected.  On
  Windows the user's temp directory is used, on UNIX systems a directory
  is created for the user in the system temp directory.
  
  The pattern can be used to have multiple separate caches operate on the
  same directory.  The default pattern is ``'__jinja2_%s.cache'``.  ``%s``
  is replaced with the cache key.
  
  >>> bcc = FileSystemBytecodeCache('/tmp/jinja_cache', '%s.cache')
  
  This bytecode cache supports clearing of the cache using the clear method.
class_docstr_tok: ["A","bytecode","cache","that","stores","bytecode","on","the","filesystem",".","It","accepts","two","arguments",":","The","directory","where","the","cache","items","are","stored","and","a","pattern","string","that","is","used","to","build","the","filename",".","If","no","directory","is","specified","a","default","cache","directory","is","selected",".","On","Windows","the","user","'s","temp","directory","is","used",",","on","UNIX","systems","a","directory","is","created","for","the","user","in","the","system","temp","directory",".","The","pattern","can","be","used","to","have","multiple","separate","caches","operate","on","the","same","directory",".","The","default","pattern","is","``","'__jinja2_","%","s.cache","'","``",".","``","%","s","``","is","replaced","with","the","cache","key",".",">",">",">","bcc","=","FileSystemBytecodeCache","(","'\/tmp\/jinja_cache","'",",","'","%","s.cache","'",")","This","bytecode","cache","supports","clearing","of","the","cache","using","the","clear","method","."]
code: def _get_default_cache_dir(self) -> str:
      def _unsafe_dir() -> "te.NoReturn":
          raise RuntimeError(
              "Cannot determine safe temp directory.  You "
              "need to explicitly provide one."
          )
  
      tmpdir = tempfile.gettempdir()
  
      # On windows the temporary directory is used specific unless
      # explicitly forced otherwise.  We can just use that.
      if os.name == "nt":
          return tmpdir
      if not hasattr(os, "getuid"):
          _unsafe_dir()
  
      dirname = f"_jinja2-cache-{os.getuid()}"
      actual_dir = os.path.join(tmpdir, dirname)
  
      try:
          os.mkdir(actual_dir, stat.S_IRWXU)
      except OSError as e:
          if e.errno != errno.EEXIST:
              raise
      try:
          os.chmod(actual_dir, stat.S_IRWXU)
          actual_dir_stat = os.lstat(actual_dir)
          if (
              actual_dir_stat.st_uid != os.getuid()
              or not stat.S_ISDIR(actual_dir_stat.st_mode)
              or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU
          ):
              _unsafe_dir()
      except OSError as e:
          if e.errno != errno.EEXIST:
              raise
  
      actual_dir_stat = os.lstat(actual_dir)
      if (
          actual_dir_stat.st_uid != os.getuid()
          or not stat.S_ISDIR(actual_dir_stat.st_mode)
          or stat.S_IMODE(actual_dir_stat.st_mode) != stat.S_IRWXU
      ):
          _unsafe_dir()
  
      return actual_dir
  
imports: import errno
  import fnmatch
  import marshal
  import os
  import pickle
  import stat
  import sys
  import tempfile
  import typing
  from hashlib import sha1
  from io import BytesIO
  from types import CodeType
label_desc: Use image node_id 2 for calling the FileSystemBytecodeCache obj's underlying member method code with example usage: obj._get_default_cache_dir() and returns: actual_dir, tmpdir