/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/python/testing/swag/pathutil.py
26 строк
756 B
Anton Myagkov
Update ydb version to 24.4 (#4579)
07 фев 2026, 11:59
Не верифицирован
07 фев 2026, 11:59
2c21cae
Код
Авторство
О чём код?
import os import tempfile def get_valid_filename(filename, dirname): current_file, counter = filename, 0 while os.path.exists(os.path.join(dirname, current_file)): current_file = "%s_%d" % (filename, counter) counter += 1 valid_path = os.path.join(dirname, current_file) os.mknod(valid_path) return valid_path def get_valid_tmpdir(name, tmp_dir): current_dir, counter = name, 0 while os.path.exists(os.path.join(tmp_dir, current_dir)): current_dir = "%s_%d" % (name, counter) counter += 1 os.mkdir(os.path.join(tmp_dir, current_dir)) return os.path.join(tmp_dir, current_dir) def get_base_tmpdir(name): tmppath = tempfile.gettempdir() return get_valid_tmpdir(name, tmppath)