initial commit
This commit is contained in:
commit
39fdd43d8e
127 files changed
+13919
No files matched your search
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from functools import lru_cache
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
|
||||
PROGRAM_PATH = Path(__file__).resolve().parent.parent / "data" / "program.json"
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
def load_program() -> dict[str, Any]:
|
||||
with PROGRAM_PATH.open(encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
|
||||
|
||||
def get_week(week_number: int) -> dict[str, Any]:
|
||||
program = load_program()
|
||||
for week in program["weeks"]:
|
||||
if week["week"] == week_number:
|
||||
return week
|
||||
raise ValueError(f"Неделя {week_number} не найдена")
|
||||
Reference in new issue
Block a user