/
niceSOFT
/
python3-hatchling
Обзор
Документация
Войти
/
niceSOFT
/
python3-hatchling
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
backend/src/hatchling/utils/fs.py
26 строк
714 B
Dimitri Papadopoulos Orfanos
Upgrade Ruff to 0.13.2 (#1890)
28 сен 2025, 21:20
Не верифицирован
28 сен 2025, 21:20
aff6f39
Код
Авторство
О чём код?
from __future__ import annotations import os def locate_file(root: str, file_name: str, *, boundary: str | None = None) -> str | None: while True: file_path = os.path.join(root, file_name) if os.path.isfile(file_path): return file_path if boundary is not None and os.path.exists(os.path.join(root, boundary)): return None new_root = os.path.dirname(root) if new_root == root: return None root = new_root def path_to_uri(path: str) -> str: if os.sep == "/": return f"file://{os.path.abspath(path).replace(' ', '%20')}" return f"file:///{os.path.abspath(path).replace(' ', '%20').replace(os.sep, '/')}"