/
niceSOFT
/
python3-hatchling
Обзор
Документация
Войти
/
niceSOFT
/
python3-hatchling
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/hatch/template/__init__.py
33 строки
780 B
Dimitri Papadopoulos Orfanos
Upgrade Ruff to 0.13.2 (#1890)
28 сен 2025, 21:20
Не верифицирован
28 сен 2025, 21:20
aff6f39
Код
Авторство
О чём код?
from __future__ import annotations from contextlib import suppress from typing import TYPE_CHECKING if TYPE_CHECKING: from hatch.utils.fs import Path class File: def __init__(self, path: Path | None, contents: str = ""): self.path = path self.contents = contents self.feature = None def write(self, root): if self.path is None: # no cov return path = root / self.path path.ensure_parent_dir_exists() path.write_text(self.contents, encoding="utf-8") def find_template_files(module): for name in dir(module): obj = getattr(module, name) if obj is File: continue with suppress(TypeError): if issubclass(obj, File): yield obj