/
Starolat
/
DeepDive
Обзор
Документация
Войти
/
Starolat
/
DeepDive
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
main
tmp_check.py
24 строки
1 KB
Starolat Sergei
chore: sync project state for Gitverse
16 июн 2026, 16:06
16 июн 2026, 16:06
1cb951e
Код
Авторство
О чём код?
import ast, re from pathlib import Path lucide_dir = Path("package_tmp/package/dist/esm/icons") missing_samples = ["accessibility", "air-vent", "ambulance", "anvil", "apple"] for name in missing_samples: f = lucide_dir / f"{name}.js" text = f.read_text(encoding="utf-8") m = re.search(r"default\s*=\s*(\[[^\]]+\])", text) if not m: print(f"{name}: no match") continue arr = ast.literal_eval(m.group(1)) svg_attrs = ['xmlns="http://www.w3.org/2000/svg"', 'width="24"', 'height="24"', 'viewBox="0 0 24 24"', 'fill="none"', 'stroke="currentColor"', 'stroke-width="2"', 'stroke-linecap="round"', 'stroke-linejoin="round"'] svg_open = "<svg " + " ".join(svg_attrs) + ">" def el_to_svg(el): tag = el[0] attrs = " ".join(f'{k}="{v}"' for k, v in el[1].items()) if len(el) > 2 and el[2]: children = "".join(el_to_svg(c) for c in el[2]) return f"<{tag} {attrs}>{children}</{tag}>" return f"<{tag} {attrs}/>" svg = svg_open + "".join(el_to_svg(c) for c in arr) + "</svg>" print(f"{name}: {svg[:120]}...")