class_docstr: This class regularly exports the EvalSavedModel.
  
  In addition to exporting, this class also garbage collects stale exports.
class_docstr_tok: ["This","class","regularly","exports","the","EvalSavedModel",".","In","addition","to","exporting",",","this","class","also","garbage","collects","stale","exports","."]
docstr: Deletes older exports, retaining only a given number of the most recent.
  
  Export subdirectories are assumed to be named with monotonically increasing
  integers; the most recent are taken to be those with the largest values.
  
  Args:
    export_dir_base: the base directory under which each export is in a
      versioned subdirectory.
docstr_tok: ["Deletes","older","exports",",","retaining","only","a","given","number","of","the","most","recent",".","Export","subdirectories","are","assumed","to","be","named","with","monotonically","increasing","integers",";","the","most","recent","are","taken","to","be","those","with","the","largest","values",".","Args",":","export_dir_base",":","the","base","directory","under","which","each","export","is","in","a","versioned","subdirectory","."]
code: def _garbage_collect_exports(self, export_dir_base: str):
      """Deletes older exports, retaining only a given number of the most recent.
  
      Export subdirectories are assumed to be named with monotonically increasing
      integers; the most recent are taken to be those with the largest values.
  
      Args:
        export_dir_base: the base directory under which each export is in a
          versioned subdirectory.
      """
      if self._exports_to_keep is None:
          return
  
      def _export_version_parser(path):
          # create a simple parser that pulls the export_version from the directory.
          filename = os.path.basename(path.path)
          if not (len(filename) == 10 and filename.isdigit()):
              return None
          return path._replace(export_version=int(filename))
  
      # pylint: disable=protected-access
      keep_filter = gc._largest_export_versions(self._exports_to_keep)
      delete_filter = gc._negation(keep_filter)
      for p in delete_filter(
          gc._get_paths(export_dir_base, parser=_export_version_parser)
      ):
          try:
              gfile.DeleteRecursively(p.path)
          except errors_impl.NotFoundError as e:
              tf_logging.warn(
                  "Can not delete %s recursively: %s", p.path, e
              )
  
imports: from collections import abc
  import contextlib
  import os
  import types
  from typing import Callable, Dict, List, Optional, Union
  from tensorflow import estimator
  from tensorflow_model_analysis.eval_saved_model import export
  from tensorflow_model_analysis.utils import util
  from tensorflow.python.estimator import gc
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.platform import gfile
  from tensorflow.python.platform import tf_logging
label_desc: Use image node_id 4 for calling the LatestExporter obj's underlying member method code with example usage: obj._garbage_collect_exports(export_dir_base) and returns: path, None