# Path: app/util.py
# def cached_function(func: Callable[..., Any]) -> Callable[..., Any]:
#     data = {}
# 
#     def wrapper(*args: Any) -> Any:
#         if not SHOULD_CACHE:
#             return func(*args)
#         cache_key = ' '.join([str(x) for x in args])
#         if cache_key not in data:
#             data[cache_key] = func(*args)
#         return data[cache_key]
# 
#     wrapper.__qualname__ = func.__qualname__
#     wrapper.__signature__ = inspect.signature(func)  # type: ignore
#     return wrapper


import json
import os
from typing import Dict, List
from app.util import cached_function


class Section():
    def __init__(self) -> None:
        self.name: str = ''
        self.items: List[Item] = []

    @staticmethod
    def load(name: str, data: List[Dict[str, str]]) -> 'Section':
        section = Section()
        section.name = name
        for d in data:
            item = Item.load(d)
            section.items.append(item)
        return section


class Item():
    def __init__(self) -> None:
        self.name: str = ''
        self.link: str = ''

    @staticmethod
    def load(data: Dict[str, str]) -> 'Item':
        item = Item()
        item.name = data['name']
        item.link = data['link']
        return item



# Path: app/util.py
# def cached_function(func: Callable[..., Any]) -> Callable[..., Any]:
#     data = {}
# 
#     def wrapper(*args: Any) -> Any:
#         if not SHOULD_CACHE:
#             return func(*args)
#         cache_key = ' '.join([str(x) for x in args])
#         if cache_key not in data:
#             data[cache_key] = func(*args)
#         return data[cache_key]
# 
#     wrapper.__qualname__ = func.__qualname__
#     wrapper.__signature__ = inspect.signature(func)  # type: ignore
#     return wrapper


# Path: app/data.py
import json
import os
from typing import Dict, List
from app.util import cached_function



class Section():
    def __init__(self) -> None:
        self.name: str = ''
        self.items: List[Item] = []

    @staticmethod
    def load(name: str, data: List[Dict[str, str]]) -> 'Section':
        section = Section()
        section.name = name
        for d in data:
            item = Item.load(d)
            section.items.append(item)
        return section


class Item():
    def __init__(self) -> None:
        self.name: str = ''
        self.link: str = ''

    @staticmethod
    def load(data: Dict[str, str]) -> 'Item':
        item = Item()
        item.name = data['name']
        item.link = data['link']
        return item



@cached_function