class_docstr: Context manager for tensorflow-transform.
  
  All the attributes in this context are kept on a thread local state.
  
  Attributes:
    temp_dir: (Optional) The temporary directory used within in this block.
    desired_batch_size: (Optional) A batch size to batch elements by. If not
        provided, a batch size will be computed automatically.
    passthrough_keys: (Optional) A set of strings that are keys to
        instances that should pass through the pipeline and be hidden from
        the preprocessing_fn. This should only be used in cases where additional
        information should be attached to instances in the pipeline which should
        not be part of the transformation graph, instance keys is one such
        example.
    use_deep_copy_optimization: (Optional) If True, makes deep copies of
        PCollections that are used in multiple TFT phases.
    force_tf_compat_v1: (Optional) If True, TFT's public APIs
        (e.g. AnalyzeDataset) will use Tensorflow in compat.v1 mode irrespective
        of installed version of Tensorflow. Defaults to `False`.
  
  Note that the temp dir should be accessible to worker jobs, e.g. if running
  with the Cloud Dataflow runner, the temp dir should be on GCS and should have
  permissions that allow both launcher and workers to access it.
class_docstr_tok: ["Context","manager","for","tensorflow-transform",".","All","the","attributes","in","this","context","are","kept","on","a","thread","local","state",".","Attributes",":","temp_dir",":","(","Optional",")","The","temporary","directory","used","within","in","this","block",".","desired_batch_size",":","(","Optional",")","A","batch","size","to","batch","elements","by",".","If","not","provided",",","a","batch","size","will","be","computed","automatically",".","passthrough_keys",":","(","Optional",")","A","set","of","strings","that","are","keys","to","instances","that","should","pass","through","the","pipeline","and","be","hidden","from","the","preprocessing_fn",".","This","should","only","be","used","in","cases","where","additional","information","should","be","attached","to","instances","in","the","pipeline","which","should","not","be","part","of","the","transformation","graph",",","instance","keys","is","one","such","example",".","use_deep_copy_optimization",":","(","Optional",")","If","True",",","makes","deep","copies","of","PCollections","that","are","used","in","multiple","TFT","phases",".","force_tf_compat_v1",":","(","Optional",")","If","True",",","TFT","'s","public","APIs","(","e.g",".","AnalyzeDataset",")","will","use","Tensorflow","in","compat.v1","mode","irrespective","of","installed","version","of","Tensorflow",".","Defaults","to","`","False","`",".","Note","that","the","temp","dir","should","be","accessible","to","worker","jobs",",","e.g",".","if","running","with","the","Cloud","Dataflow","runner",",","the","temp","dir","should","be","on","GCS","and","should","have","permissions","that","allow","both","launcher","and","workers","to","access","it","."]
docstr: Generate a temporary location.
docstr_tok: ["Generate","a","temporary","location","."]
code: def create_base_temp_dir(cls) -> str:
      """Generate a temporary location."""
      state = cls._get_topmost_state_frame()
      if not state.temp_dir:
          raise ValueError(
              "A tf.Transform function that required a temp dir was called but no "
              "temp dir was set.  To set a temp dir use the impl.Context context "
              "manager."
          )
      base_temp_dir = os.path.join(state.temp_dir, cls._TEMP_SUBDIR)
  
      # TODO(b/35363519): Perhaps use Beam IO eventually?
      tf.io.gfile.makedirs(base_temp_dir)
      return base_temp_dir
  
file_path: transform/tensorflow_transform/beam/context.py
imports: import dataclasses
  import os
  import threading
  from typing import Iterable, Optional
  import tensorflow
  from tensorflow_transform import tf2_utils
label_desc: Use image node_id 5 for calling the Context obj's underlying member method code with example usage: obj.create_base_temp_dir(cls) and returns: base_temp_dir