parameters: (hint, keep)
docstring: Responsible for the report directory.
  
      hint -- could specify the parent directory of the output directory.
      keep -- a boolean value to keep or delete the empty report directory.
docstring_summary: Responsible for the report directory.
docstring_tokens: Responsible for the report directory .
function: def report_directory(hint, keep):
      """ Responsible for the report directory.
  
      hint -- could specify the parent directory of the output directory.
      keep -- a boolean value to keep or delete the empty report directory. """
  
      stamp_format = 'scan-build-%Y-%m-%d-%H-%M-%S-%f-'
      stamp = datetime.datetime.now().strftime(stamp_format)
      parent_dir = os.path.abspath(hint)
      if not os.path.exists(parent_dir):
          os.makedirs(parent_dir)
      name = tempfile.mkdtemp(prefix=stamp, dir=parent_dir)
  
      logging.info('Report directory created: %s', name)
  
      try:
          yield name
      finally:
          if os.listdir(name):
              msg = "Run 'scan-view %s' to examine bug reports."
              keep = True
          else:
              if keep:
                  msg = "Report directory '%s' contains no report, but kept."
              else:
                  msg = "Removing directory '%s' because it contains no report."
          logging.warning(msg, name)
  
          if not keep:
              os.rmdir(name)
function_tokens: def report_directory ( hint , keep ) : stamp_format = 'scan-build-%Y-%m-%d-%H-%M-%S-%f-' stamp = datetime . datetime . now ( ) . strftime ( stamp_format ) parent_dir = os . path . abspath ( hint ) if not os . path . exists ( parent_dir ) : os . makedirs ( parent_dir ) name = tempfile . mkdtemp ( prefix = stamp , dir = parent_dir ) logging . info ( 'Report directory created: %s' , name ) try : yield name finally : if os . listdir ( name ) : msg = "Run 'scan-view %s' to examine bug reports." keep = True else : if keep : msg = "Report directory '%s' contains no report, but kept." else : msg = "Removing directory '%s' because it contains no report." logging . warning ( msg , name ) if not keep : os . rmdir ( name )