# 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 datetime
import os
import markdown2
from typing import Any, List, Optional, cast
from zoneinfo import ZoneInfo
from varsnap import varsnap
from app.util import cached_function
        if note_file[0] == '.':
            return False
        return True
    files = [note_file for note_file in note_files if is_valid_note(note_file)]
    return files


def get_note_files(directory: str) -> List[str]:
    current_directory = os.path.dirname(os.path.realpath(__file__))
    notes_directory = os.path.join(current_directory, directory)
    files = os.listdir(notes_directory)
    files.sort(reverse=True)
    files = prune_note_files(files)
    files = [os.path.join(notes_directory, note_file) for note_file in files]
    return files


# @varsnap
@cached_function
def get_notes(directory: str) -> List[Note]:
    note_files = get_note_files(directory)
    notes = []
    for note_file in note_files:
        note_parsed = Note.get_note_file_data(note_file)
        if note_parsed:
            notes.append(note_parsed)
    return notes


@varsnap

# 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/note_util.py
import datetime
import os
import markdown2
from typing import Any, List, Optional, cast
from zoneinfo import ZoneInfo
from varsnap import varsnap
from app.util import cached_function

        if note_file[0] == '.':
            return False
        return True
    files = [note_file for note_file in note_files if is_valid_note(note_file)]
    return files


def get_note_files(directory: str) -> List[str]:
    current_directory = os.path.dirname(os.path.realpath(__file__))
    notes_directory = os.path.join(current_directory, directory)
    files = os.listdir(notes_directory)
    files.sort(reverse=True)
    files = prune_note_files(files)
    files = [os.path.join(notes_directory, note_file) for note_file in files]
    return files


# @varsnap
@cached_function
def get_notes(directory: str) -> List[Note]:
    note_files = get_note_files(directory)
    notes = []
    for note_file in note_files:
        note_parsed = Note.get_note_file_data(note_file)
        if note_parsed:
            notes.append(note_parsed)
    return notes


@varsnap

@cached_function