def get_temp_file_name(tmp_dir=None, extension=''):
"""Return an availiable name for temporary file."""
if tmp_dir is None:
tmp_dir = iCount.TMP_ROOT
# pylint: disable=protected-access
tmp_name = next(tempfile._get_candidate_names())
if not tmp_dir:
# pylint: disable=protected-access
tmp_dir = tempfile._get_default_tempdir()
if extension is not None:
tmp_name = tmp_name + '.' + extension
return os.path.join(tmp_dir, tmp_name)
评论列表
文章目录